Maya2012 and the P4PythonApi, Fatal Errors

I’ve been using the old version with 2009 its entwined through out the maya sided tools.
We’re stepping up to 2012 and I’ve grabbed the latest version of the p4api - both r10.1 and r10.2 from the P4 ftp’s but using either in 32bit or in x64 Maya when I import the P4 script Maya Fatal Errors…

Anyone have any experience of beating youself to death with this one?

Are you doing anything special as far as putting it into its own package or anything like that? I had noticed in the past the P4 api stuff has some specifics it likes re:import/package setup, that sorta thing…

Nothing fancy, beyond the files I was running with before.
I have just taken the core P4PythonApi files (from sitepackages default python installation C:\Python26\Lib\site-packages) and moved them into P4 and I access via a python path set to the external package directory:

import external.p4.version.P4 as P4

the P4Api files that live there are:
init.py
P4.py
P4API.pyd
(P4Client is missing with this revision, presumed deprecated)

I’m a little confused about the default installer being a 5.3 meg file so that would suggest that there are other files that have been put elsewhere other than pythons site-packages.

I would be right in thinking that the maya 2012 python version is 2.6 and that both revisions r10.1 and r10.2 should work with Maya?

I’m a little confused about the default installer being a 5.3 meg file so that would suggest that there are other files that have been put elsewhere other than pythons site-packages.

okay so the rest of the crap is uninstaller the important bit is no different.

the files are:
P4.py
P4.pyc
P4API.pyd

the fatal crash occurs importing the P4API.pyd - nice

This is actually the thing i found it didn’t like, might be different now, but yeah, when i actually tried to set it up like a package (with an init.py and all that goodness), Maya would shit itself.

Hmm… Will try a different setup tomorrow;
Guess the odd thing, having looked in the p4.py, and running through everything that gets imported by that script, seemed that the only thing that caused it to topple over with the fatal crash was the import of the pyd. That’s the instant crash, I’ll try that from within the site package location within maya, if i can, and see if it does the same.
I was wondering about whether we could compile the p4 plugin against Maya’s own python version in case there was something mis-matched, would that be feasible? I’ll be getting Doc Bob to do that for me. :wink:

Confirmed, putting the P4Api:

C:\Program Files (x86)\Autodesk\Maya2012\Python\lib\site-packages

Allows it to function against Maya’s python

Putting it in a package for distributed access does not … that’s crap, any ideas what would cause this?

[QUOTE=rhexter;14451]Confirmed, putting the P4Api:

C:\Program Files (x86)\Autodesk\Maya2012\Python\lib\site-packages

Allows it to function against Maya’s python

Putting it in a package for distributed access does not … that’s crap, any ideas what would cause this?[/QUOTE]

Not sure, but you can just take the .py and .pyd files and stick them in their own folder and stick that folder on your sys.path. That’s what i ended up doing, quick and dirty.

Sounds Perfect, many thanks.
Hope this thread helps others out.

Sorry to dredge up this old thread, I just got around to p4python recently. Seems that if you want to package and distribute p4python you just need to ensure that the .pyd is in the system path before you attempt to load P4.py

The following package structure is working for me:


.
├── /p4python/
│   └── __init__.py
│   └── P4.py
│   └── P4API.pyd

with the init.py containing:


import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(__file__)))

__all__ = ['P4']

Tested on Maya 2015 SP6, windows x64
-csa

indulges in further thread necro

Thanks csa3d, i just ran across the same issues.

I recently changed studio and have been reviewing a lot of my old tools, including changing back to using init’s for subdirectories in a module ( rather than just adding all subdir’s to sys.path - wasteful timewise ) and encountered this issue as a result.

The only difference i’ve made to the solution is using

import os
import sys
import inspect
sys.path.append(os.path.dirname(os.path.abspath(inspect.getfile( inspect.currentframe() ))))

instead as file wasn’t working ( i have some callbacks in my start up sequence that run code before Maya’s loaded its scripting environment so the file method fails as a result )

… so yeah - signed in for the first time in a year to say thanks :smiley:

~ PJ