Modify

Opened 14 years ago

Closed 3 years ago

#8425 closed defect (wontfix)

plugin loading error

Reported by: anonymous Owned by: Lewis Baker
Priority: high Component: PerforcePlugin
Severity: major Keywords:
Cc: Trac Release: 0.11

Description (last modified by Ryan J Ollos)

Seems like the PerforcePlugin is not loading. I installed 1PyPerforce 0.4 and PyProtocols 0.93 globally. PerforcePlugin is installed in the trac environment (although I did also try it globally, resulting in exactly the same issue).

Seems to me (a python n00b) that in setup.py it cannot find the namespace "p4trac.api". I am confused by the "DLL not found" issue - should I have a DLL somewhere? If yes, which and where?

For the record: Trac 0.11.7 on Win XP pro, Apache 2.2 via mod_wsgi on Python 2.7

...
[Thu Jan 20 09:51:29 2011] [error] 09:51:29 Trac[loader] DEBUG: Loading perforce from c:\\python27\\lib\\site-packages\\tracperforce-0.5.0dev-py2.7.egg
[Thu Jan 20 09:51:29 2011] [error] 09:51:29 Trac[loader] ERROR: Skipping "perforce = p4trac.api": (can't import "ImportError: DLL load failed: The specified module could not be found.")
...
[Thu Jan 20 09:51:34 2011] [error] 09:51:34 Trac[main] WARNING: HTTPInternalError: 500 Trac Error (Unsupported version control system "perforce": Can't find an appropriate component, maybe the corresponding plugin was not enabled? )

Attachments (0)

Change History (18)

comment:1 Changed 14 years ago by anonymous

Anybody there?

comment:2 Changed 14 years ago by Ryan J Ollos

Description: modified (diff)

comment:3 Changed 14 years ago by anonymous

*bump*

comment:4 Changed 14 years ago by Lewis Baker

The issue is most likely that it can't load the PyPerforce module perforce.api which is implemented as a DLL. You can check this by running a Python shell and trying 'import perforce.api'.

PyPerforce hasn't been updated for Python 2.7 yet so it may be a problem with trying to use a version of PyPerforce built for older versions of Python. You could try compiling PyPerforce from source for Python 2.7 if you have the MSVC 2008 compiler.

comment:5 Changed 14 years ago by anonymous

Hi guys

sorry for the delay, but I am picking this up again now.

Please give me some details on that compilation - where is the source code (exactly) that I have to recompile? I have VS2008 somewhere, but since I am more of a .NET guy I would appreciate any help on getting this compiled. I looked for a tutorial on how to compile but could not find...

This plugin is the last lever I have to get my company to start using Trac - once P4 is in, it is happy Trac-ing time!

Thanks

comment:6 Changed 14 years ago by anonymous

Btw I compiled an .egg for PyPerforce 0.4 that is automagically named PyPerforce-0.4-py2.7-win32.egg, which I assume must work with python 2.7, or not?

Doing "import perforce.api" works nicely, but the log indicates it is missing "p4trac.api" - that also does not work from python command line.

comment:7 Changed 14 years ago by OriginalPoster (formerly known as anonymous)

It appears to me that I might need to add something to the PATH, from what I could google about the error "ImportError: DLL load failed: The specified module could not be found." it seems that many users are missing some classpath value.

comment:8 Changed 14 years ago by OriginalPoster (formerly known as anonymous)

I have been using ProcessMonitor to determine what is missing at runtime. After moving some of the pyperforce and p4trac libraries into globally visible locations (in the PATH), just to make sure that is not the problem, I stumbled over some unsuccessful queries for MSVCR90.DLL. Since you mentioned that part of this is compiled using MSVC, can I assume the MSVC runtime is a dependency that should be mentioned on the plugin page?

Anyway, I installed that runtime and rebooted, now I see a new error in the log (instead of the "DLL not found" issue), leading me to believe that the above mentioned MSVC DLL was causing my initial error. The new one says this: 2011-03-09 09:44:00,700 Trac[loader] ERROR: Skipping "perforce = p4trac.api": (can't import "ImportError: DLL load failed: %1 is not a valid Win32 application.")

Any ideas?

Thanks!

comment:9 Changed 14 years ago by anonymous

Cc: Ryan J Ollos added; anonymous removed

comment:10 Changed 14 years ago by anonymous

*re-bump*

comment:11 Changed 14 years ago by anonymous

Come on, guys, a little help here would really go appreciated - googling these errors does not really help me find out what is actually going on, and I assume I am making some ridiculously obvious mistake you could help me with...

comment:12 Changed 14 years ago by anonymous

Apologies for the delay in replying.

I would first check that it's not the perforce.api module that can't be loaded by running a simple Perforce script:

from perforce import Connection
p4 = Connection(port='perforce:1666')
p4.connect()
p4.run('info')
p4.disconnect()

If this succeeds when using the same version of Python you are running Trac with then you can eliminate PyPerforce as the problem.

The other thing to verify would be that you have built PyPerforce using the version of the C++ P4API libraries that matches the corresponding Python interpreter's msvc runtime version. In this case, Python 2.7 uses MSVC 2008 so you would want to compile PyPerforce with p4api_vs2008_dyn.zip. Also make sure that the architecture of the PyPerforce libraries matches that of the Python interpreter (ie x86 vs amd64).

comment:13 Changed 14 years ago by OriginalPoster (formerly known as anonymous)

Thanks for the response!

I tried the test in command line right away, the "info" call results in
<perforce.results.Results object at 0x00C3EF10>. I read that as if I get an object returned, so the test worked - right?
For the sake of completeness, here the "log":

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

P:\>python
Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "cr*****" or "license" for more information.
>>> from perforce import Connection
>>> p4 = Connection(port='coderepodub500:1777')
>>> p4.connect()
>>> p4.run('info')
<perforce.results.Results object at 0x00C3EF10>
>>> p4.disconnect()
>>>

I will have to take a closer look at the compiling thing. I might need a bit more hand-holding through that, though. I will get back to you after I tried it on my own.

Thanks for the help; as I already mentioned, getting this to work is a deal-breaker(or maker) for my company switching to Trac, so hope it works...

comment:14 Changed 14 years ago by OriginalPoster (formerly known as anonymous)

OK, I finally have some news.

I downloaded that version of p4api you linked, dumped the headers/libs/samples into the ThirdParty/ntx86 directory that is part of the pyperforce directory tree and did "setup.py bdist_wininst". I installed using the resulting exe, but am still getting the error in the log:

2011-04-11 10:15:23,716 Trac[loader] ERROR: Skipping "perforce = p4trac.api": (can't import "ImportError: DLL load failed: %1 is not a valid Win32 application.")

Any idea what that means? Ever seen that before?

comment:15 Changed 13 years ago by Raphael (formerly known as the OriginalPoster (formerly known as anonymous))

I gave up trying to have this work with Trac 0.11. No point in sticking with the "old" trac just because I hoped to get this plugin here working with it. Now my hopes are I'll have it working with 0.12...

Some changes I needed to make in order for PyPerforce to compile as win32:

  • change path to vsvars32.bat in python27/distutils/msvc9compiler
    It did not find it. I just hard coded the path to mine. Because I'm lazy.
  • src/perforce/api.py
    lines 3967,3968: change usage of "." to "->", i.e. self->myFileSys->Path().Text() to self->myFileSys->Path()->Text()
  • in the p4 cpp api (the one you linked to above), modified spec.h in line 290: moved the private SpecElem::preset into the public block. Looks like this used to be public, was made private in the newer version and your code was not updated yet.

There are a variety of runtime "compile" (interpreter) issues with using the current trunk version of PerforcePlugin with the newest stable Trac 0.12. I am digging my way through them, brute-force hacking them to work...mostly just interface changes so far (e.g. some functions now take 5 instead of 4 params...). It would be awesome if one of you "real" Trac devs had a look at this because what I am doing it likely to be messy...

Please respond!

Almost there...

comment:16 Changed 13 years ago by anonymous

Sorry, that second bullet point should be "api.cpp", not "api.py".

comment:17 Changed 5 years ago by Ryan J Ollos

Cc: Ryan J Ollos removed

comment:18 Changed 3 years ago by Ryan J Ollos

Resolution: wontfix
Status: newclosed

Plugin is deprecated.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Lewis Baker.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.