Reputation: 1925
I tried downloading the Perforce for python API (Platform independent)version from here and tried executing a simple connect() script:
from P4 import P4, P4Exception
p4 = P4()
p4.port = "111"
p4.user = "xxx"
p4.client = "yyy"
p4.connect()
I have this script and p4.py and the remaining dist stuff(c++ files) in the same folder. But I get this error:
Importerror: No module named P4API.
Can someone please help me?
Upvotes: 3
Views: 7041
Reputation: 101
In my case, I got that error because I had forgotten to install the module after building. I was missing the following command
sudo python3 setup.py install --apidir <Perforce C++ API absolute path>
Upvotes: 0
Reputation: 1925
So I found out what was messing things up. My Python 2.7 is 32 bit and the Perforce build which I downloaded (and which is put up on their site) is 64 bit. Here's the link you have to follow if you have a 32 bit Python.
This link has the 32 bit python distribution of P4P
To check whether you have a 32 bit or 64 bit Python just go to your command line and start the python shell(type python). The first line contains this information.
Upvotes: 4