Well, I've been experimenting with this a bit and I'm still stumped. I thought perhaps the problem was that in my usersetup.py I was importing maya.utils before inserting the pymel directory to sys.path, so I tried disabling usersetup.py and adding these lines to the top of usersetup.mel:
string $pymelPath = "C:\\Users\\John\\Documents\\maya\\scripts\ \pymel-1.0.0b2"; python("import sys"); python("sys.path.insert(0,\"" + $pymelPath + "\")"); However, I still get the same error message when importing pymel.core. The funny thing is that when I set up and place the pymel.pth file (included in extras) into mayapy's site-packages folder, everything works great. I'm not up to speed on the intricacies of .pth files, but my impression is that it basically does the same thing? It looks like this file adds the PyMEL directory to the path and then rearranges sys.path so that PyMEL comes first. So long story short, it *works*, just not exactly the way I'd prefer, and I feel like there's some path-related magic I'm not quite understanding. I'm moving on for now, but if anyone can enlighten me, I'd very much appreciate it! On Jan 4, 5:59 am, Sylvain Berger <sylvain.ber...@gmail.com> wrote: > Try adding the path to the sys.path in a usersetup.mel instead of the > usersetup.py > > I had trouble with the usersetup.py, it gets evaluated later than the .mel > one. > > I made a init.py script that I launch in the usersetup.mel using the > python() command > > python("myInitScript()") > > Hope this helps > > > > > > On Mon, Jan 4, 2010 at 6:55 AM, JP <jspatr...@gmail.com> wrote: > > Hey all, > > > I had an easy time using the included installer, however I'm having a > > little trouble with a manual installation (which I need to set up to > > put the PyMEL resources on our network). > > > What I'm doing instead of altering the system environment variables or > > maya.env is running a procedure within usersetup.py that inserts the > > path to the top-level pymel-1.x.x directory to sys.path. Here is my > > sys.path after inserting: > > > for p in sys.path: print p > > > C:/Users/John/Documents/maya/scripts/pymel-1.0.0b2 > > C:\Program Files\Autodesk\Maya2009\bin > > C:\Program Files\Autodesk\Maya2009\bin > > C:\Program Files\Autodesk\Maya2009\bin\python25.zip > > C:\Program Files\Autodesk\Maya2009\Python\DLLs > > C:\Program Files\Autodesk\Maya2009\Python\lib > > C:\Program Files\Autodesk\Maya2009\Python\lib\plat-win > > C:\Program Files\Autodesk\Maya2009\Python\lib\lib-tk > > C:\Program Files\Autodesk\Maya2009\Python > > C:\Program Files\Autodesk\Maya2009\Python\lib\site-packages > > C:/Users/John/Documents/maya/2009-x64/prefs/scripts > > C:/Users/John/Documents/maya/2009-x64/scripts > > C:/Users/John/Documents/maya/scripts > > C:/Users/John/Documents/maya/scripts/.svn > > C:/Users/John/Documents/maya/scripts/aor > > C:/Users/John/Documents/maya/scripts/comet > > C:/Users/John/Documents/maya/scripts/dev > > C:/Users/John/Documents/maya/scripts/gnomonStudios > > C:/Users/John/Documents/maya/scripts/jasonSchleifer > > C:/Users/John/Documents/maya/scripts/jp > > C:/Users/John/Documents/maya/scripts/kevinPoly > > C:/Users/John/Documents/maya/scripts/maya > > C:/Users/John/Documents/maya/scripts/stopStarring > > C:/Users/John/Documents/maya/scripts/toolsGeneral > > C:/Users/John/Documents/maya/scripts/toolsRigging > > C:/Users/John/Documents/maya/scripts/toolsScripting > > C:/Users/John/Documents/maya/scripts/toolsTexture > > > After this, I try to import pymel.core, and get this error: > > # Error: If you manually installed pymel, ensure that pymel comes > > before Maya's site-packages directory on PYTHONPATH / sys.path. See > > pymel docs for more info. > > > The docs recommend adding this top-level directory to the path, but I > > also tried individually adding the pymel and maya subdirectories to > > sys.path with the same result. > > > If anyone has any thoughts as to what's happening here, I'm all ears! > > Thanks all! > > > -JP > > On Dec 28 2009, 4:04 am, Miguel González Viñé <lichi...@gmail.com> > > wrote: > > > Thanks for the explanation, Chad. > > > I was following the tutorial and I was totally confused. There's a few > > > examples like: > > > cam = ls(type='camera')[0] > > > parent = cam.getParent() > > > trans = parent.getTranslation() # <--- > > > trans > > > # Result: dt.Vector([28.0, 21.0, 28.0]) > > > > where I was trying to get dt.Vector and I was thinking there was a > > > problem in my installation or something wrong. > > > > Thanks again, > > > miguel. > > > > On Sun, Dec 27, 2009 at 7:41 PM, Chad Dombrova <chad...@gmail.com> > > wrote: > > > > > sphere1, hist = polySphere(name='mySphere') > > > > grp = group(sphere1) > > > > sphere1 > > > > # Result: group1|mySphere # > > > > > nothing has changed in his regard. from the beginning, autodesk chose > > to > > > > deviate from standard python practice of using repr() to display > > results, > > > > instead they use str(). this inevitably leads to confusion. here's how > > you > > > > can get what you expect: > > > > print repr(sphere1) > > > > > this prints: > > > > nt.Transform(u'group1|mySphere') > > > > here's a shorthand for the same thing: > > > > print `sphere1` > > > > i need to clarify this in the tutorial. > > > > -chad > > > > > -- > > > >http://groups.google.com/group/python_inside_maya > > > -- > >http://groups.google.com/group/python_inside_maya > > -- > "A pit would not be complete without a Freeman coming out of it." > The Vortigaunt
-- http://groups.google.com/group/python_inside_maya