[paramiko] Compatibility with Python 2.2 and 2.3 (was: _def_urandom is not defined)

Dwayne Litzenberger dwayne at oscl.ca
Tue Feb 12 07:33:25 PST 2008


On February 12, 2008 02:42:28 am Justin Cook wrote:
> Apparently, line 47 in 'site-packages/paramiko/osrandom.py' has a
> typographical error and should read 'return _dev_urandom.read(bytes)'
> versus 'return _def_urandom.read(bytes)'.

Hmm. It looks like neither Robey nor I have tested our changes with Python 2.2 
or Python 2.3.

**********
PYTHON 2.2

When I do "setup.py install" using Python 2.2.3, I get this:

  byte-compiling /home/dwon/python2.2/lib/python2.2/site-packages/paramiko/sftp_file.py to sftp_file.pyc
  <string>:428: Warning: 'yield' will become a reserved keyword in the future
    File "/home/dwon/python2.2/lib/python2.2/site-packages/paramiko/sftp_file.py", line 428
      yield self.read(x[1])
               ^
  SyntaxError: invalid syntax

Running test.py returns this:

  $ ~/python2.2/bin/python test.py
  test.py:58: Warning: 'yield' will become a reserved keyword in the future
    File "test.py", line 58
      yield item
               ^
  SyntaxError: invalid syntax

Adding "from __future__ import generators" to those files isn't sufficient 
(at least not for the test suite) because the test suite uses several 
features from Python 2.3's standard library.

**********
PYTHON 2.3

With Python 2.3.6, the situation is somewhat better, though the following 
tests still fail:
  
  ======================================================================
  ERROR: test_4_or_pipe (test_buffered_pipe.BufferedPipeTest)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "tests/test_buffered_pipe.py", line 83, in test_4_or_pipe
      self.assertFalse(p._set)
  AttributeError: 'BufferedPipeTest' object has no attribute 'assertFalse'
  
  ======================================================================
  ERROR: test_1_import (test_util.UtilTest)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "tests/test_util.py", line 73, in test_1_import
      self.assertTrue('Transport' in symbols)
  AttributeError: 'UtilTest' object has no attribute 'assertTrue'
  
  ======================================================================
  ERROR: test_E_reverse_port_forwarding (test_transport.TransportTest)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "tests/test_transport.py", line 463, in test_E_reverse_port_forwarding
      self.assertTrue(self.server._listen is None)
  AttributeError: 'TransportTest' object has no attribute 'assertTrue'
  
  ----------------------------------------------------------------------
  Ran 102 tests in 102.095s
  
  FAILED (errors=3)

**********
FIXES

Robey: I've attached a bundle that fixes both the typo and the tests for 
Python 2.3.6, but Python 2.2 support (at least in the test suite) is still 
pretty broken.  Do you want to have a look at it?

-- 
Dwayne Litzenberger, B.A.Sc.
Information Technology Analyst

Open Systems Canada Limited
#210 - 2332 11th Ave
Regina, SK S4P0K1
Office: (306) 359-OSCL (6725)
http://www.oscl.ca/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: paramiko-python2.3-fixes.bundle
Type: text/x-diff
Size: 4490 bytes
Desc: not available
Url : http://www.lag.net/pipermail/paramiko/attachments/20080212/4fb0089f/attachment.diff 


More information about the paramiko mailing list