Jump to content


P4Python ImportError: DLL load failed on "import P4API" line

p4python

  • Please log in to reply
9 replies to this topic

#1 Dan.H

Dan.H

    Member

  • Members
  • PipPip
  • 12 posts

Posted 15 May 2013 - 07:09 PM

I'm trying to install Robert Cowham's trigger for case checking of submits (http://public.perfor...gers/index.html).  I have installed ActivePython 2.7.2.5 on Windows Server 2008R2 and p4python 2.7 x64.  The p4python installer placed the files P4.py, P4.pyc, and P4API.pyd in the Lib\site-packages directory of my python installation as expected.  When I run the case check script, I get the error below.  I assume it's a python configuration problem, but I can't come up with anything to resolve the problem.

Traceback (most recent call last):
File "C:\p4tools\CheckCaseTrigger.py", line 38, in <module>
import P4
File "C:\Python27\lib\site-packages\P4.py", line 315, in <module>
import P4API
ImportError: DLL load failed: The specified module could not be found.


#2 P4Matt

P4Matt

    Advanced Member

  • Members
  • PipPipPip
  • 1383 posts

Posted 16 May 2013 - 07:13 PM

Take a crack at installing the 12.1 version: I think we're having issues with the 13.1 version.

http://ftp.perforce....12.1/bin.ntx64/

His script shouldn't be reliant on any 13.1 functionality.

#3 Dan.H

Dan.H

    Member

  • Members
  • PipPip
  • 12 posts

Posted 16 May 2013 - 08:53 PM

Thanks, I tried that version and I get the same error.  Is there some Python-specific configuration setting or environment variable that's necessary for locating the p4api.pyd file?

#4 P4Matt

P4Matt

    Advanced Member

  • Members
  • PipPipPip
  • 1383 posts

Posted 16 May 2013 - 09:12 PM

Not that I'm familiar with. My experiences with the installer have been pretty straightforward; I've never had to do any post install config.

From a command prompt run "python" to get an interactive prompt and then try "import P4". Apparently the interactive prompt sometimes gives better error messages.

#5 Dan.H

Dan.H

    Member

  • Members
  • PipPip
  • 12 posts

Posted 16 May 2013 - 09:23 PM

I will add that running Dependency Walker on p4api.pyd listed msvcr90.dll (among others) as a missing dependency.  That is, as I understand it, part of the Visual Studio 2008 redistributable runtime which I did not have installed on my machine.  Installing that eliminated that particular dependency, but a bunch of API-MS-WIN-CORE-* dependencies are listed as still missing.  I understand those to be a change in the structure of some of the Windows APIs, so I don't know if that's all a red herring or not.

#6 P4Matt

P4Matt

    Advanced Member

  • Members
  • PipPipPip
  • 1383 posts

Posted 16 May 2013 - 11:45 PM

I'll see if I can find a Win Server 2008 VM to play with to try it out myself. I've seen other times where Server 2008 was missing dlls that the rest of the world are quite attached to.

#7 Dan.H

Dan.H

    Member

  • Members
  • PipPip
  • 12 posts

Posted 17 May 2013 - 01:46 PM

I did get the script working from the command line.  I had a bunch of python files littering up my work directory in my attempt to get it working and after I got rid of all of those, the combination of the VS2008 redistributable and p4python 12.1 works from the command line.  My only remaining problem is that when I install the script as a Perforce trigger, I get an "ImportError: DLL load failed: A dynamic link library initialization routine failed" error.  The Perforce server process is configured to run as the local system user, so I presume there is some necessary configuration related to the different users.

#8 P4Matt

P4Matt

    Advanced Member

  • Members
  • PipPipPip
  • 1383 posts

Posted 17 May 2013 - 06:11 PM

I could imagine the path or pythonpath needs to be updated for the system user. If you have multiple Python installs it could be grabbing the wrong Python.

#9 Dan.H

Dan.H

    Member

  • Members
  • PipPip
  • 12 posts

Posted 17 May 2013 - 07:38 PM

I had those environment variables set as system env vars so the Local System user does have access to them.  The problem was that you cannot just restart Windows services that run under the Local System account in order to pick up changes to the env vars -- you have to reboot the machine.  After rebooting the server (and deflecting complaints about source control going down), the Python trigger worked fine.  Thanks for your suggestions.

#10 P4Matt

P4Matt

    Advanced Member

  • Members
  • PipPipPip
  • 1383 posts

Posted 17 May 2013 - 08:28 PM

Woo hoo! Glad to hear you were able to get it up and running.





Also tagged with one or more of these keywords: p4python

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users