PDA

View Full Version : pywin32 maya 2013


jaydru
06-26-2012, 10:26 AM
i cant import this now that i'm using maya 2013, anyone else had this problem?

zoharl
06-29-2012, 09:58 AM
pywin32 was never part of mayapy. Install it into the full 2.6 interpreter, and share the libraries with maya.

jaydru
06-29-2012, 04:27 PM
that's not the problem but thanks for the bump, figured it would be a given that i would have installed it to py2.6, and appended mayapy's sys.path but i guess i should have been more clear, from the reading i have done it would seem that mayapy 2013 and pywin32 have been compiled by different versions of vs and this may be causing the dlls to not load, but i dont really know anything about this compiling stuff so i'm not sure, btw this module loads just fine in idle, and maya 2011/2012

zoharl
06-29-2012, 04:55 PM
Given my behind... people ask here how to print hello world.

First, make sure that the required dlls are x64 as your maya.

Second, even if one was compiled on vs 2005, and the other on vs 2010, there shouldn't be a problem to run them both in conjunction. But make sure that the required dlls are x64 and in the path. For example vs 2010 x64 redist. Although it doesn't make sense that the dlls are missing and you can still use pywin on previous maya versions.

Third, if everything fails try to get hold of the sources and build them yourself.

Also you didn't provide the exact error message.

zoharl
06-29-2012, 05:44 PM
I think that my second point isn't entirely accurate. A win app can load any version, and the os has limitations only on the x32, x64 issue. So building a plugin to maya can be done in any compiler.

But I do remember that python for some reason might have an issue with it, and the official compiler for python 2.6 is vc9 (vs2008):

http://docs.python.org/whatsnew/2.6.html

http://docs.python.org/extending/windows.html#building-on-windows

Notice that you should use the same version of VC++that was used to build Python itself.

And see if this helps

http://stackoverflow.com/questions/4635734/trying-to-build-the-basic-python-extension-example-fails-windows

The last time I had a problem with it, while compiling a python extension, I didn't bothered to get to the bottom of this, and just used vc9 as was required.

If python has that limitation, and maya broke the standards and built its own python version with a different compiler, then it's the dumbest thing I heard about autodesk this week. :p

By the way, do you have the same issues running a standalone pywin script with mayapy?

jaydru
06-29-2012, 08:52 PM
yeah, its all 64 bit, i have no idea whats wrong, it works fine in 2012, same results runing script with mayapy too

zoharl
06-30-2012, 07:08 AM
So you didn't understand my point about vc, and the error message is a secret.

No matter. You actually don't need pywin at all. Instead use:

from ctypes import *
inc = windll.LoadLibrary(dllPath)
out = inc.required_function()
windll.FreeLibrary(dllPath)


Where dllPath is the dll that contains the winapi command that you require, and required_function is the winapi command name (Of course if windll contains what you want that just use it directly).

I tested it on 2013.

conflict
09-05-2012, 04:31 AM
I'm having the same issue with pywin32. Works fine for 2012, no go in 2013.

I'm win32net.NetUseEnum... really a pain to get this functionality a different way.

zoharl
09-05-2012, 06:24 AM
More info about the problem:

http://forums.cgsociety.org/showthread.php?t=1063178

And as I suggested in the post before your post, use ctypes and load the dll manually. Alternatively try to compile the package yourself using vs2010 (good luck with that...).

conflict
09-05-2012, 08:08 PM
I'm trying your ctypes import, but I'm getting an error.

Trying to use the win32net.pyd. Is that handled differently than a .dll?

zoharl
09-06-2012, 03:32 AM
Please provide a short code the reproduces the error.

I didn't understand your question. I have no idea what's inside the .pyd, and I can't see why you care about it. You are trying to use the winapi function:

http://msdn.microsoft.com/en-us/library/windows/desktop/aa370647%28v=vs.85%29.aspx

, which, as written in the bottom of the page, resides in Netapi32.dll.

See if this link helps you

http://bytes.com/topic/python/answers/833600-calling-netshareenum-win32api-ctypes

conflict
09-06-2012, 02:33 PM
I guess I saying that you can't load a .pyd using ctypes, since it expects you to import a .pyd.

I'll look into the links you sent. Looks useful.

zoharl
09-06-2012, 05:25 PM
Please read again my previous post. I emphasize again, you don't need the .pyd you need only the .dll.

CGTalk Moderation
09-06-2012, 05:25 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.