Questions tagged [p4python]

p4python is a Python interface to Perforce, a source-code control system.

P4Python: Perforce's API for Python allows you to write Python scripts that directly execute Perforce commands. Documentation can be found here: Helix Core P4Python Developer Guide.

98 questions
1
vote
2 answers

Using p4python with grep command

Does anyone knows how to use grep() command in P4Python? I am developing an script that runs with Perforce and makes it easy for me to search for specific texts inside multiple files. I already tried to create a tool in Perforce > Tools > Manage…
hadmung
  • 78
  • 1
  • 7
1
vote
1 answer

Need p4python commands to sync code from Perforce

I'm writing a script to sync code from Perforce. I'm using P4Python. Im very new to this. i need P4Python commands for below. How to find latest Changelist number of a directory in Perforce. e.g. Want to find latest CL of //cbuDepot/cpe/foo/...…
user1734852
  • 11
  • 1
  • 4
1
vote
1 answer

need equivalent python command for p4 describe

I need equivalent for p4 describe #cl, in p4 python. However, running the same command p4.run_describe("#cl") using p4python. I get dict: [{'client': 'NonDev1408-Dev', 'digest': ['E41FFB100C73F7B443EE8DE7A0DD966C'], 'desc': 'Merging…
mohit
  • 5,696
  • 3
  • 24
  • 37
1
vote
0 answers

P4Python build errors in linux

I have installed reviewboard on linux and now trying to install P4Python to use Perforce. Using Python 2.7.6, P4Python-2014.2.962887 and p4api-2014.2.978861. How do i resolve this error: $python setup.py build --apidir…
1
vote
1 answer

Is it possible to use P4Python API with IronPython?

Is it possible to use P4Python (the perforce python api) with IronPython? I'd like to use the python api because it seems much faster than using p4.net implementionat of a Perforce API but when I try to import p4 into IronPython I receive the…
Bryan
  • 551
  • 4
  • 9
1
vote
1 answer

p4 status -A only to sub directory of perforce workspace

I have folders like this in my perforce workspace view. //depot/... //rajesh_ws/... where //depot/... has all the source code and the compiled code will be copied to bin sub directory. I am syncing //depot/... & Building it and copying the binary…
1
vote
1 answer

Can't print using p4python

I am not certain if this is a bug with P4API or a problem with my usage of p4python. p4.run_print("-q", "-o " + targetPath, depotFile + "#" + rev) ...gives an exception. Traceback (most recent call last): File "C:\pyTools\p4test.py", line 218, in…
ChipJust
  • 1,376
  • 12
  • 20
1
vote
1 answer

P4Python - p4.run_changes returning empty list

The following code printing empty list "[]".I am expecting list of all change list between the date range specified. What do I need to fix to get the change list? from P4 import P4,P4Exception p4 = P4() p4.port = "perforce:1666" p4.user =…
Red Ant
  • 315
  • 4
  • 17
1
vote
1 answer

how to get all change numbers from sync - p4python

I periodically get a p4 sync and want to know what actually got synced. So I get the return from p4.run_sync which is a list of dicts per change (as far as I understood) sync = p4.run_sync() when I print the keys it looks like that: sync dict Nr: 0…
ewerybody
  • 1,443
  • 16
  • 29
1
vote
1 answer

Not able to use p4 module in python

I am using ubuntu 12.04 64 bit and i have installed p4python in it.. I tried to import p4 module but it is giving me below error import p4 Traceback (most recent call last): File "", line 1, in ImportError: No module named p4 Can someone please…
mrutyunjay
  • 6,850
  • 7
  • 25
  • 35
1
vote
2 answers

Why does P4Python not recognize P4CONFIG setting?

I have the following code: # script0.py def main(): p4 = p4python.P4.P4() p4.connect() print os.environ['P4CONFIG'] print p4.p4config_file p4.disconnect() which is being called via: #…
Noel Yap
  • 18,822
  • 21
  • 92
  • 144
0
votes
2 answers

P4python how do I mark a list of files for add/edit?

I have a TON of files (~260,000) sorted into files with lists of files by type. (binary, binary+Dx, text, text+x, etc...) EI…
Xolin_
  • 53
  • 1
  • 8
0
votes
1 answer

Perforce P4Python create new stream without vim opening

I am trying to create and populate streams from a parent using P4Python. using the .run command I can send the terminal command, but I cannot surpress vim opening, which prevents the script from populating the stream. Ultimately the script is going…
macadam
  • 3
  • 2
0
votes
1 answer

How to call .cpp function inside p4python script?

My job: I want to create a python script that changes the content of a file automatically and then commit the change in Perforce. Because the file at first is read-only. So I need to create a python script which check out the file (in order to edit…
gnase
  • 580
  • 2
  • 10
  • 25
0
votes
3 answers

Trouble building P4Python with P4API

I'm trying to build P4Python, as described here and a more recent version found here. I have the P4 API located at C:\p4api. I have set the p4_api variable correctly in setup.cfg. While in C:\P4Python-2010.1, which is where P4Python is extracted,…
Adam S
  • 8,945
  • 17
  • 67
  • 103