P4DTI issue job001098

TitlePython 2.4 breaks p4.py
Statusclosed
Priorityessential
Assigned userNick Barnes
OrganizationRavenbrook
DescriptionPython 2.4 has recently been released. Running the P4DTI under Python 2.4 causes errors when invoking the Perforce client, usually of the form "Unknown field name".
AnalysisPython 2.4 includes a silent change to the binary format of marshalled objects. The Perforce client 'p4 -G' accepts and produces marshalled objects in format version 0 (i.e. that generated by versions of Python prior to 2.4). Python 2.4 can produce such objects, but by default produces objects in format version 1 [2].
To produce an object in format version 0, one uses marshal.dump(object, file, 0). Note that this call will generate an error in Python 2.3 (or earlier) so for compatibility we need to test which version of the marshal module we have (by using marshal.__dict__.has_key('version').
Note that Python 2.4 has no problem reading objects in format version 0, so this is only a problem with passing information to 'p4 -G', not receiving information back.
This problem was found by Perforce [1].
Here's a typical error message:
  File "run.py", line 21, in ?
    r.run()
  File "E:\Bugzilla\P4DTI-2.1.2\replicator.py", line 897, in run
    self.prepare_to_run()
  File "E:\Bugzilla\P4DTI-2.1.2\replicator.py", line 888, in prepare_to_run
    self.update_and_check_jobspec()
  File "E:\Bugzilla\P4DTI-2.1.2\replicator.py", line 254, in update_and_check_jobspec
    self.p4.install_jobspec(self.config.jobspec)
  File "E:\Bugzilla\P4DTI-2.1.2\p4.py", line 480, in install_jobspec
    self.run('jobspec -i', jobspec_dict)
  File "E:\Bugzilla\P4DTI-2.1.2\p4.py", line 217, in run
    raise error, catalog.msg(706, (msg, exit_status))
Perforce error: (P4DTI-7065) Error in job spec specification.
Error detected at line 2.
Unknown field name 'Status'.
   The Perforce client exited with error code 1.
How foundcustomer
Evidence[1] <http://info.ravenbrook.com/mail/2004/12/30/23-14-17/0.txt>
[2] <http://www.python.org/doc/2.4/lib/module-marshal.html>
Observed in2.2.0
Test proceduretest_p4dti.py normal.runTest
Created byNick Barnes
Created on2005-01-03 14:55:31
Last modified byGareth Rees
Last modified on2010-10-06 21:45:18
History2004-01-03 NB Created.

Fixes

Change Effect Date User Description
137049 closed 2005-01-03 14:57:56 Nick Barnes Fix marshal format problem with Python 2.4.