Blimba / PyWC3

Script template for creating Warcraft III map scripts in python. Uses python-lua as translator to generate lua code for warcraft.
MIT License
18 stars 2 forks source link

map build error #3

Open Ceasy opened 2 years ago

Ceasy commented 2 years ago

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?

Blimba commented 2 years ago

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,

Ceasy commented 2 years ago

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 "

Blimba commented 2 years ago

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

Ceasy commented 2 years ago

Yes, mapscript is standart

Ceasy commented 2 years ago

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.

Blimba commented 2 years ago

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?

Ceasy commented 2 years ago

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'

Blimba commented 2 years ago

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?

Ceasy commented 2 years ago

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"

Blimba commented 2 years ago

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?

Ceasy commented 2 years ago

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 commented 2 years ago

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 =)

Blimba commented 2 years ago

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

Ceasy commented 2 years ago

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

StriverLite commented 1 year ago

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 commented 1 year ago

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!