[petsc-dev] [PATCH] bin/pythonscripts: updated petsc_conf.py and PetscBinaryIO.py to be compatible with Python 3

Jed Brown jedbrown at mcs.anl.gov
Wed Dec 18 14:56:59 CST 2013


Wenjun Deng <wdeng at wdeng.info> writes:

> Dear Sir/Madam,
>
> I found that bin/pythonscripts/PetscBinaryIO.py couldn't be used in
> Python 3 due to usage of print and file() in Python 2 style. I made a
> few changes to make it compatible with Python 3 now. 

Thanks for the patch, though it looks like you didn't actually test with
python3:

$ python3 -c 'from PetscBinaryIO import *; PetscBinaryIO().readBinaryFile("/home/jed/petsc/datafiles/matrices/small")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "./PetscBinaryIO.py", line 90, in decorated_f
    result = f(self, *args, **kwargs)
  File "./PetscBinaryIO.py", line 389, in readBinaryFile
    if type(fid) is types.StringType:
AttributeError: 'module' object has no attribute 'StringType'


I have fixed this problem and merged to 'next'.

https://bitbucket.org/petsc/petsc/commits/ce23a07af1cfd62018d2fb9065b2565d8fd1650e
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20131218/53ff7e7e/attachment.sig>


More information about the petsc-dev mailing list