PyWC3 icon indicating copy to clipboard operation
PyWC3 copied to clipboard

map build error

Open Ceasy opened this issue 3 years ago • 16 comments

Hello! Please tell me, when building the map "python PyWC3 map.w3x --build" gives an error:

File "E:\Files\WarcraftIII\Jetbrains\projects\PyWC3\pythonlua\nodevisitor.py", line 615, in visit_Subscript
if not isinstance(node.slice,ast.Slice) and not isinstance(node.slice,ast.ExtSlice) and isinstance(node.slice.va lue,ast.Tuple): AttributeError: 'Name' object has no attribute 'value'

What do I need to do?

Ceasy avatar Feb 20 '22 10:02 Ceasy

Hello!

Could you attach the script you are trying to translate? Without that I'm looking a bit in the dark as to what would cause this error.

Thanks,

Blimba avatar Feb 21 '22 08:02 Blimba

This is a module from the "pythontolua" library. Its name is "nodevisitor.py ". I followed your guide step by step and when I type "python PyWC3 map.w3x --build" I get this error. I downloaded the "pythontolua" library from the link: "https://github.com/Blimba/python-lua error_build-001 "

Ceasy avatar Feb 21 '22 15:02 Ceasy

I meant the mapscript. Or is the mapscript also the standard one? I'll check it out asap.

Blimba avatar Feb 21 '22 15:02 Blimba

Yes, mapscript is standart

Ceasy avatar Feb 22 '22 14:02 Ceasy

Thanks. I'm waiting. And I really want to make maps in python =( I'm glad that I found your way, and I hope you can help me.

Ceasy avatar Feb 22 '22 14:02 Ceasy

I just cloned a new PyWC3 with the current versions, and I can't reproduce your issue. Can you send me a zip of your folder? Also, which version of python are you using?

Blimba avatar Feb 22 '22 21:02 Blimba

Python version 3.9.5. I work in Pycharm editor. Project archive attached projects.zip

  1. I open this project in Pycharm.
  2. I go along the path: "E:\Files\WarcraftIII\Jetbrains\projects".
  3. Next, I run the command: "python PyWC3 test.w3x --build". While executing the command, I get an error (which I wrote about above): ...... " File "E:\Files\WarcraftIII\Jetbrains\projects\PyWC3\pythonlua\nodevisitor.py", line 621, in visit_Subscript node.slice.value, ast.Tuple): AttributeError: 'Name' object has no attribute 'value'

Ceasy avatar Feb 23 '22 14:02 Ceasy

your file builds without any problems on my system (py3.7, [yea I should update]), both from within pycharm, or commandline. Can you use pythonlua directly without PyWC3? for example, if you run "runtests.py"?

Do you have the requirements of python-lua installed?

Blimba avatar Feb 23 '22 18:02 Blimba

i just copied the pythonlua folder to the pywc3 folder. I didn't install any dependencies. Can you please tell me how to install dependencies? Maybe that's why I'm having problems. When I run the command "python runtests.py" it says: "C:\Users\User\AppData\Local\Programs\Python\Python39\python.exe: can't open file 'E:\Files\WarcraftIII\Jetbrains\pr ojects\runtests.py': [Errno 2] No such file or directory"

Ceasy avatar Feb 24 '22 14:02 Ceasy

just open runtests.py (in the python-lua directory) in pycharm and run it. according to the requirements.txt file, you need: colorama>=0.3.7 PyYAML>=3.12 so you can install those using pip: python -m pip install colorama python -m pip install pyyaml I suppose.. but they should come with anaconda. Did you install python with anaconda?

Blimba avatar Feb 24 '22 19:02 Blimba

Now I deleted the whole project and installed everything again, including the installation of "Anaconda". After all the instructions, I ran the command "python PyWC3 test.w3x --build" ---> got an error: " File "E:\Files\WarcraftIII\Jetbrains\projects\PyWC3\PyWC3\map.py", line 5, in from pythonlua.translator import Translator ModuleNotFoundError: No module named 'pythonlua'". I then copied to the project folder "..\venv\Lib\site-packages" a folder called "pythonlua" from the folder "python-lua-master" (which I downloaded from your repository). And after running the same command "python PyWC3 test.w3x --build" got another error: "File "E:\Files\WarcraftIII\Jetbrains\projects\venv\lib\site-packages\pythonlua\nodevisitor.py", line 615, in visi t_Subscript if not isinstance(node.slice,ast.Slice) and not isinstance(node.slice,ast.ExtSlice) and isinstance(node.slice.v alue,ast.Tuple): AttributeError: 'Name' object has no attribute 'value'" I don't know what to do next =(

Ceasy avatar Feb 25 '22 15:02 Ceasy

In general, I managed to fix the error: I removed the 'value' value in the "nodevisitor.py" module, line 615, which caused the error. Now at startup, everything is fine assembled and launched. Thank you very much for your help and for taking the time to solve my problem =)

Ceasy avatar Feb 25 '22 15:02 Ceasy

Perhaps there is a difference in how python 3.9 looks at stuff compared to python 3.7.. hmm. I'll look into if the line should be changed to not have the .value. Thanks for getting back after (hopefully) fixing it. Let me know how you get along with pywc3 :)

Cheers

Blimba avatar Feb 25 '22 16:02 Blimba

Of course! I'm going to gain experience in the building, thanks again to you =)

Ceasy avatar Feb 25 '22 17:02 Ceasy

In general, I managed to fix the error: I removed the 'value' value in the "nodevisitor.py" module, line 615, which caused the error. Now at startup, everything is fine assembled and launched. Thank you very much for your help and for taking the time to solve my problem =)

Thanks, I got the same problen on python 3.10, And I fixed it followed your steps!

StriverLite avatar Jul 13 '23 16:07 StriverLite

Perhaps there is a difference in how python 3.9 looks at stuff compared to python 3.7.. hmm. I'll look into if the line should be changed to not have the .value. Thanks for getting back after (hopefully) fixing it. Let me know how you get along with pywc3 :)

Cheers

Cheers!

StriverLite avatar Jul 13 '23 16:07 StriverLite