[p4python] Test code erroring out

Matt Fielding (R* New England) Matt.Fielding at rockstarnewengland.com
Tue Aug 12 07:16:43 PDT 2008


I've recently installed the p4python API on top of python 2.5.2 on my
machine to try and test out some perforce scripts, but I am running into
an issue that I don't quite understand.
 
    Traceback (most recent call last):
      File "test.py", line 12, in <module>
        except p4.P4Exception:
      File "C:\Python25\lib\site-packages\P4.py", line 244, in
__getattr__
        raise AttributeError, name
    AttributeError: P4Exception
 
This error is coming up while running the following code:
 
    from P4 import P4
    p4 = P4()
    p4.port = "port"           #actual port was here, no worries
    p4.user = "username"  #actual user name was here as well
 
    try:
       p4.connect()
       info1 = p4.run("info")
       s = info['serverVersion']
       print s
       p4.disconnect()
    except p4.P4Exception:
       for e in p4.errors:
        print e
 
The code comes straight out of the P4Python manual, and is the first,
most basic chunk of code I could possibly run. It appears something is
incorrect in my P4.py file, but seeing as I just installed the API, I
don't see why something would be messed up already. I'm hoping someone
else has run into this problem and has a quick solution for me.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.perforce.com/pipermail/p4python/attachments/20080812/093d1c3a/attachment-0001.html>


More information about the p4python mailing list