[p4python] parse_forms() causing crash

Sven Erik Knop sknop at perforce.com
Wed Jul 11 07:20:51 PDT 2012


Hi Martin,

look at the test cases in p4test.py for general usage ideas.

In my public depot you can find scripts and triggers that should give 
you an idea as well:

http://public.perforce.com:8080/guest/sven_erik_knop/P4Pythonlib/?ac=83

I also gave a presentation on P4Python at the 2009 user conference. You 
can find the presentation here:

http://www.perforce.com/documentation/multimedia_library/user_conferences/adventures_scripting_land

and the paper here

http://www.perforce.com/sites/default/files/pdf/knop-adventuresinscriptingland-paper.pdf

Last not least there is also a 1-day public scripting training course. 
Just send an email to training at perforce.com to find out more.

Good luck :-)

Cheers

Sven Erik

On 11/07/2012 15:09, Martin Linklater wrote:
> Thanks for the answers guys. I'll bare that in mind when I google for 
> help.
>
> Outside of the official documentation are there any good pages on the 
> web with examples of common usage ?
>
> Thanks.
>
> Martin Linklater
> Programmer
> Lucid Games Ltd
>
>
> On 11 Jul 2012, at 15:00, Sven Erik Knop wrote:
>
>> Hi Martin,
>>
>> p4.parse_forms() doesn't exist in the official P4Python release. Use, 
>> for example,
>>
>> with open('clientform.file') as f:
>>     clientform = f.read()
>> client = p4.parse_client(clientform)
>>
>> ... but you are probably referring to the (old) public depot version 
>> of P4Python, which required this particular method.
>>
>> In the officially supported P4Python release you are using, you do 
>> not require this method at all (form parsing is always implicitly done).
>> Simply remove the line and you will be fine :-)
>>
>> Kind regards
>>
>> Sven Erik
>>
>>
>>
>> On 11/07/2012 14:46, Martin Linklater wrote:
>>> Hi - I've just started integrating perforce commands into my python 
>>> based asset management scripts and I'm hitting a problem when I call 
>>> parse_forms()
>>>
>>> My code is:
>>>
>>> from P4 import P4, P4Exception
>>>
>>> :
>>> :
>>>
>>> self.p4 = P4()
>>> self.p4.parse_forms()
>>>
>>> As soon as the parse_forms() line is executed I get the following 
>>> output:
>>>
>>> Traceback (most recent call last):
>>>   File "/Applications/PyCharm.app/helpers/pydev/pydevd.py", line 
>>> 1401, in <module>
>>>     debugger.run(setup['file'], None, None)
>>>   File "/Applications/PyCharm.app/helpers/pydev/pydevd.py", line 
>>> 1055, in run
>>>     pydev_imports.execfile(file, globals, locals) #execute the script
>>>   File 
>>> "/Users/link/Work/dev/projects/Skylight/bin/DLCBuilder/builder.py", 
>>> line 132, in <module>
>>>     Run()
>>>   File 
>>> "/Users/link/Work/dev/projects/Skylight/bin/DLCBuilder/builder.py", 
>>> line 28, in Run
>>>     p4 = DLC.perforce.Perforce( options, args )
>>>   File 
>>> "/Users/link/Work/dev/projects/Skylight/bin/DLCBuilder/DLC/perforce.py", 
>>> line 47, in __init__
>>>     self.p4.parse_forms()
>>>   File "/Library/Python/2.7/site-packages/P4.py", line 399, in <lambda>
>>>     return lambda *args, **kargs: self.parse_spec(cmd, *args, **kargs)
>>> TypeError: function takes exactly 2 arguments (1 given)
>>> Disconnecting from Perforce
>>>
>>> It's asking for a parameter, but I have no idea what it wants. All 
>>> the sample code I've seen calls parse_forms() without a parameter. 
>>> Can anyone help pls ?
>>>
>>> Thanks.
>>>
>>> Martin Linklater
>>> Programmer
>>> Lucid Games Ltd
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> p4python mailing list
>>> p4python at perforce.com
>>> http://maillist.perforce.com/mailman/listinfo/p4python
>>
>>
>
>
>
> _______________________________________________
> 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/20120711/22afa9da/attachment-0002.html>


More information about the p4python mailing list