[p4python] Version 2007.3

Shawn Hladky p4shawn at gmail.com
Thu Sep 4 11:24:28 PDT 2008


Running P4Python versions side-by-side on Windows

In the Perforce supported version of P4Python, the main module was renamed
from "p4" to "P4". Since Python is case-sensitive, it's possible to have
both modules loaded; however, on Windows it's not possible to have the files
"p4.py" and "P4.py" in the same folder. If you run the installers, one
version will overwrite the other. However, you can manually install the
public depot version of P4Python, and run it side-by-side with the Perforce
version. Here are the steps to get this to work:

   1. Install the Perforce version of P4Python
   2. Create a new folder for the public depot version of P4Python. I
   created my folder here:
   C:\Python25\Lib\pdp4
   3. Copy the following files into the new folder.
   P4Client.pyd
   p4.py
   You can get these files off a machine that has the public depot version
   of P4Python installed (will be in the site-packages folder), or you can
   compile P4Client.pyd from source.
   4. Set the environment variable PYTHONPATH to the new folder (or append
   it to the list if PYTHONPATH is already defined).

You can test with the following short script:

import p4 as pubdepotAPI
import P4 as perforceAPI

p4 = pubdepotAPI.P4()
p4.tagged()
p4.connect()
info1 = p4.run_info()
p4.disconnect()

p4 = perforceAPI.P4()
p4.connect()
info2 = p4.run_info()

p4.disconnect()

if info1[0]['serverAddress'] == info2[0]['serverAddress']:
    print "Both versions loaded and return same results!"




2008/9/4 <todd.benham at kodak.com>

>  After looking at
> http://public.perforce.com/guest/robert_cowham/perforce/API/python/official/RELNOTES.txt and
> trying the install, I don't quite understand the upgrade path for p4
> changed to P4 (lowercase vs. uppercase). I was using P4Python 1.0 (or 1.2),
> but when I install P4Python 2007.3, it breaks all previous scripts. It
> seems it is installed overtop instead of "next to" it. I don't see a way to
> have both.
>
> Quote:
>     If you are migrating from Public Depot version of P4Python, edit your
>     scripts to ensure that the scripts comply with the new
>     interface. The differences are detailed below.
> There must be a way to support both, right?
> I don't mind moving on to the new version of P4 (but not all at once).
>
> So, bottom line: is there *suppose* to be a way to support both upper and
> lower case P4Python on the same machine (Windows based)? If not, I can't see
> any practical way to change to the new supported version.
>
> Thanks for any ideas around this.
>
>
> *Todd*
>
> _______________________________________________
> p4python mailing list
> p4python at perforce.com
> http://maillist.perforce.com/mailman/listinfo/p4python
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.perforce.com/pipermail/p4python/attachments/20080904/aff14079/attachment-0001.html>


More information about the p4python mailing list