I'm curious what the final size was of that py2exe file? On Wed, Nov 11, 2009 at 12:21 PM, chadrik <[email protected]> wrote:
> this is another place where unix has windows beat. on a unix-like system > python scripts can be executables themselves, so there's no need for this > extra exe layer: > > ----------foo.py------------- > #!/path/to/mayapy > import pymel > > def doSomething(): > print pymel.ls() > > if __name__ == '__main__': > doSomething() > ----------end------------ > > this file, foo.py, can be executed just like an exe via the shell, but it > can also be imported and used as a module. pretty handy. > > now, i realize that py2exe does a lot more than this, by attempting to > create a fully-standalone executable, so this is just an FYI for everyone > out there looking into writing python executables that work with maya. > > for windows folks, setuptools is able to generate exe wrappers of python > scripts: this is what creates ipymel.exe during the pymel install, which is > just an exe wrapper of ipymel.py. with a bit of work i'm sure it would be > possible to rip out this code and make an all purpose exe-wrapper-generator. > this, of course, would only be useful for internal use, not for a > standalone exe. > > anyway, if you get pymel working with py2exe i'd be interested in packaging > up any helper scripts as a tool within pymel. > > > -chad > > > > > > On Nov 11, 2009, at 10:55 AM, Seth Gibson wrote: > > It wasn't a completely straightforward process, but the gist of it was > installing py2exe to my Python25 install, nothing special in the setup.py, > although i did have to copy the MSVC runtimes to the directory i was > building from (could maybe be fixed by double checking your PATH for the > location of those?). Most of the heavy lifting happened in the actual py > file i was converting, which involved appending Maya's bin and site-packages > directories to sys.path, setting PYTHONHOME to maya's Python dir, and > setting the MAYA_LOCATION (these could all be set outside of your code > probably). > > You do obviously have to have maya installed to do the build, but it does > copy all the requisite DLLs to your dist directory, although there's > probably all sorts of questionable legality concerning distributing that > package to someone who isn't a licensed Maya user;). If you do have Maya > installed and on your PATH somewhere, the exe just runs and you can scrap > the Maya DLLs in your dist directory, at least that's what i'm leaning > towards based on my testing so far. We aren't planning on distributing this > externally for now, it's mainly for internal purposes. The short is we > wanted a command line version of our exporter, sure i could have done it > with mayabatch but this seemed like a good opportunity to experiment a bit. > > > On Tue, Nov 10, 2009 at 8:34 PM, Chad Dombrova <[email protected]> wrote: > >> >> i'm curious how you got it working with maya.standalone. if you >> distribute this exe, surely the user on the other end has to have maya >> installed (and likely in the exact same location with the same >> version). are you using it for distribution purposes or just for nice >> packaging internally? >> >> -chad >> >> On Nov 10, 2009, at 5:04 PM, djTomServo wrote: >> >> > >> > Just out of curiousity, has anyone gotten py2exe and pymel to play >> > nice together? I've had success with py2exe and vanilla >> > maya.standalone but pymel seems a bit more elusive... >> > > >> >> >> >> > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/python_inside_maya -~----------~----~----~----~------~----~------~--~---
