trying to use code_swarm but Im having some python scripting problems with perforce on osx

173 Views Asked by At

I am having issues running this:

link-mbp:codeswarm-0.1 benb$ python convert_logs/convert_logs.py -perforce-path
Traceback (most recent call last):
File “convert_logs/convert_logs.py”, line 408, in
main()
File “convert_logs/convert_logs.py”, line 350, in main
files = run_marshal(’p4 -G describe -s “‘ + changelist['change'] + ‘”‘)
KeyError: ‘change’
link-mbp:codeswarm-0.1 benb$

I am trying to use code_swarm from this link http://blog.perforce.com/blog/?p=780&cpage=1#comment-965 to visualize my codebase changes.

if I run p4 changes everything shows correct but the code in this python script doesnt seem to process correctly...

if I run p4 describe on a a changelist number it correctly reports

ideas?

1

There are 1 best solutions below

0
On

I had the exact same problem. Not being an expert on python I debugged the script using a print-statement on line 350 like this:

for changelist in changelists:
    print changelist # <-- here
    files = run_marshal('p4 -G describe -s "' + changelist['change'] + '"')

This revealed my problem - I had used an alias like p4='p4 -C utf8' to pass charset to perforce. So when I run it from the command line the alias was processed and the describe command worked like a charm, but when invoked from python the alias was not processed. I just hacked the script by replacing 'p4' with 'p4 -C utf8' in the two places in the python script.

You problem might be the same or a diffrent one, but hopefully this will help you debugg it quickly!