In Python 2.0 the following code writes a binary file.
 
original = 48565078965739
twobis = 256l
a = []
f = open('c:\\code.gz','w')
try:
  while original > 0:
    original, binary = divmod(original, twobis)
    a.insert(0, (chr(binary)))
  for c in a:
    f.write(c)
finally:
  f.close()
 
In Python this file is written correctly , but when we tried the same code in Jython 2.0 the code did not do the job.
The problem we found was an incompatibility writting the binary file, in Python is allowed to write the code:
 
f = open('c:\\code.gz','w')     or     f = open('c:\\code.gz','wb')
 
While in Jython only the second option is valid.
 
 
Greetings
 
Jorge Tellez
jtellez@testandgo.com