How to use the PyPerforce api

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • slalande50
    New Member
    • Feb 2007
    • 11

    How to use the PyPerforce api

    I want to automate perforce. So I am using the PyPerforce given on the http://pyperforce.sour ceforge.net web site. The problem I am facing is that it is not in the python script, results.py, it does not seem to find an import it is doing.

    In results.py it is doing an import protocols but it can't be find anywhere. The only protocols.py or a folder called protocols is from a package called Twisted. I even tried changing the import in results.py for the following

    Code:
    from twisted import protocols
    but now in the results.py we are looking for protocol.interf ace which cannot be found.

    In conclusion, it seems that protocols is missing from the PyPerforce package.

    Could someone help me.

    tkx
  • bartonc
    Recognized Expert Expert
    • Sep 2006
    • 6478

    #2
    Originally posted by slalande50
    I want to automate perforce. So I am using the PyPerforce given on the http://pyperforce.sour ceforge.net web site. The problem I am facing is that it is not in the python script, results.py, it does not seem to find an import it is doing.

    In results.py it is doing an import protocols but it can't be find anywhere. The only protocols.py or a folder called protocols is from a package called Twisted. I even tried changing the import in results.py for the following

    Code:
    from twisted import protocols
    but now in the results.py we are looking for protocol.interf ace which cannot be found.

    In conclusion, it seems that protocols is missing from the PyPerforce package.

    Could someone help me.

    tkx
    It looks like you may be doing the import incorrectly. A python package is a directory with an __init__.py file in it. Most packages are installed in a place like D:\Python24\Lib \site-packages". If you look for (and can find) the desired module in the package (probably perforce, but maybe twisted) then it's
    Code:
    import packagename.modulename

    Comment

    • slalande50
      New Member
      • Feb 2007
      • 11

      #3
      Originally posted by bartonc
      It looks like you may be doing the import incorrectly. A python package is a directory with an __init__.py file in it. Most packages are installed in a place like D:\Python24\Lib \site-packages". If you look for (and can find) the desired module in the package (probably perforce, but maybe twisted) then it's
      Code:
      import packagename.modulename
      Presently I have the Perforce package which is in the site-packages directory. I also have the twisted package which is also in the site-packages directory. The results.py file is in the Perforce package and the protocols.py is in the twisted package.

      Also I am not even sure if the protocols module is the right on for this import since I am not the one who implemented this results.py.

      Also I know that the import that I was doing was working since first I was having a problem about the Protocols.py, It was saying that it couldn't find it. But since I did change the import, python seems to be looking for protocols.Inter face which interface is not in the Protocols package.

      For now, I don't even know if I am importing the proper package or maybe there is just something I am missing.

      Comment

      • slalande50
        New Member
        • Feb 2007
        • 11

        #4
        I finally found how to use this pyperforce.

        I was simply missing a package, The package name is PyProtocols.

        now that it is install, I can finally run my PyPerforce.

        Comment

        Working...