I'm new to using pydev, and I"m having problems getting Maya 2008 remote debugging up and running. My goal is to be able to debug a script that I developed using Maya 2008 standard python, meaning I did not use pymel. In general, my script has bug in it, where an element inside a list variable is not keeping its original data. Being that the bug is irrelevant to this thread, my point is that I found documentation for setting up pymel and Eclipse. Like said previously however, I'm not so much interested in using pymel, but it did include instructions for installing Maya's interpreter into pydev. In addition, I also then saw the instructions for running pydev's debugger, by turning on the debug server and then calling the settrace command. However, doing so, most of the times I get an error stating that it could not find the real location for a bunch of different files in the path C:\Program Files\Maya2008\bin\python25.zip. I've could of sworn I had followed the instructions to the tee.
I just realized that I forgot to tell you the versions of software
I am using Eclipse 3.6.3 Windows XP and I am not exactly sure which version of PyDev, but I think it is version 1.6.3. I got it from installing the plugin through Eclipse plugin manager.
Also, new update. I took a look at my system environment variables, and l noticed that Python25 was not in the PYTHONPATH variable. Once I had included that, I now get another error, stating…
AttributeError 'NoneType' object has no attribute addCommand.
I think I know what. Is going on. Just as I was about to give up, I thought to myself, why couldn't I try rrunning maya standalone in Python IDLE. At first I was simply getting an import error no module named maya.standalone. I searched this error and the best answer I could find was to make sure that my system enviroment pythonpath was set to
I did that, and I still got the same import error. So I did some more searching, and one person had asked almost the same question at autodesk's forum. Although no one had replied, the person asking the question said that he tried copying the standalone.pyd file to the main site-packages folder, and it worked. So rather than copying the file, I decided to use pythonKs os module to change the current working directory like so…
I then tried
I did not get an error, but it did not take as long to import as if I was doing this in mayapy.exe, and sure enough, when I tried importing maya.cmds the import worked, but the ls command spit out an AttributeError module object has no attribute 'ls'
…so it sounds like to me that my enviroment varaibles are being ignored, and possibly answers why I am getting all sorts of errors trying to use eclipse. If so, is there a fix for this?
Hi. I do not mean to have 2 topics going on, but I thought my problem is the way I have configured my run configuration. That is why I posted in the other thread. However, I am now going to stick with this thread. So like I was saying, there are a few things I am doing wrong. The first being that I was suppose to add the import pydevd; pydevd.settrace() inside my script I want to debug. The other mistake I am doing wrong is that I am using python 2.5. However, when I went to the python 2.5.1 download page, it said that it was recommended to download python 2.5.4. So I am wondering if Maya is that picky where I am requried to download python 2.5.1 or is it okay to download python 2.5.4
Sorry for the delay in getting back to you…
Actually, you shouldn't need to have anything special… Just start Maya as you'd start it usually, then start the remote debugger server in pydev (http://pydev.org/manual_adv_remote_debugger.html), then later, inside your script, without having any special configuration you should be able to add the remote debugger to the pythonpath and start it.
Now, the real problem you mention is that you get messages saying that the debugger can not find a bunch of different files in the path, right? Can you post the exact messages you're having? Also, can you debug the actual script you have properly (and the things it cannot find are only from the maya install)?
hi Fabio, I'm sorry I haven't gotten back to, but I was having some problems with my pc continuesly rebooting by itself. I think everything is ok now.
So getting back to my remote debugging problem, since you have mentioned that Maya needs to be openned, that fixed the "cannot find the real location for…" problem as well as the pydev settrac() to work. However, this still does not fix the problem with getting my script to work.
… sorry but my ps3 limits me with texting. I will finish in the next thread.
… So here is my script.
import pydev; pydev.settrac()
import maya.standalone as ms
import maya.cmds as cmds
results = cmds.polyPlane(name = 'myPlane', ch=1, w=1, h=1, cuv=1)
so… when I run this, I get a TraceBack error….
AttributeError 'noneType' something something is unscriptable sorry but I couldn't remember the exact error, but from a python point of view, that error means that the variable, results, was never assigned to anything. So, if I am setting results to be ='ed to the results of polyPlane(…), and polyPlane(…) is suppose to return the name of the new object, then why is results ='ed to none?
so this is real annoyiing. When i go to debug the above script in Eclipse, i am back to getting that cannot find error again.
Could not copy all of the files it could not find, since I do not have an internet connection with my PC, but here are some of them…
pydev debugger: CRITICAL WARNING: This version of python seems to be incorrectly compiled (internal generated filenames are not absolute)
pydev debugger: The debugger may still function, but it will work slower and may miss breakpoints.
pydev debugger: Unable to find the real location of 'C:\Program Files\AutoDesk\Maya2008\bin\python25.zip\threading.py
pydev debugger: Unable to find the real location of 'C:\Program Files\AutoDesk\Maya2008\bin\python25.zip\stat.py
Also, I found out some things that I was doing wrong.
1. I noticed that mayapy.exe is really picky with which version of python you are suppose to use. You cannot have Python 2.5 or 2.5.4. Nope, must be Python 2.5.1.
2. Once I fixed that, I then noticed that for each script I run, I must change the current working directory to 'C:\...\Maya2008\bin'. So now my script looks like this....
import pydevd; pydevd.settrace()
import maya.standalone as ms
import maya.cmds as cmds
results = cmds.polyplane(name = 'myPlane', ch =1, w = 1, cuv = 2)
…but that was not the end of it. When I go to run this script I still get a traceback error, and the really annoying part is the fact that my script works in Python's IDLE. So what I did was, I printed the results of cmds in Python IDLE and it points to…
…. and when I run the script in Eclipse it is pointing to somewhere else, I forget where. However, the weird part is that I made sure that C:\Program Files\Autodesk\Maya2008\Python\libs\site-packages was the last thing listed in my system libraries path. In spite of this, and I am not sure if this would be the correct way of doing this, but I had setup a Run configuration, and entered the above correct path in the Envrioment Tab like so…
I set the variable to PYTHONPATH
and the value to C:\Program Files\Autodesk\Maya2008\Python\libs\site-packages
…. and that fixed that problem, but I am not sure why when I go to debug mode, I get those cannot find errors.
The problem may be that the pydev debugger does not handle zip files properly in a debugging session (i.e.: it's accessing C:\Program Files\AutoDesk\Maya2008\bin\python25.zip… If you have the python install extracted in your machine, you should be able to edit eclipse361\plugins\org.python.pydev.debug_220.127.116.111012519\pysrc\pydevd_file_utils.py to translate the paths from the .zip to the actual python install.
Now, you can take a look at that .zip (C:\Program Files\AutoDesk\Maya2008\bin\python25.zip) and if it contains the actual .py files (not only .pyc files), you can extract it to a folder with the name same of the .zip (i.e.: rename the python25.zip to python25.old.zip and create a folder named python25.zip with the .zip contents - but that'll only work if it actually holds the .py files).