This project is archived and is in readonly mode.
Documentation fails to build with Python 3
Reported by Psycopg website | March 31st, 2012 @ 09:16 PM
Submitted by: Arfrever.FTA@GMail.Com
Unpack tarball and run:
$ cd psycopg2-2.4.5/doc $ make text cd src && make text
make[1]: Entering directory `/tmp/psycopg2-2.4.5/doc/src'
sphinx-build -b text -d build/doctrees . build/text
Making output directory...
Running Sphinx v1.1.3
loading pickled environment... not yet created
loading intersphinx inventory from http://docs.python.org/objects.inv...
loading intersphinx inventory from http://docs.python.org/3.2/objects.inv...
building [text]: targets for 12 source files that are out of
date
updating environment: 12 added, 0 changed, 0 removed
reading sources... [100%] usage
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] usage
build succeeded.
Build finished. The text pages are in build/text.
make[1]: Leaving directory `/tmp/psycopg2-2.4.5/doc/src'
cd src && tools/stitch_text.py index.rst build/text
> ../psycopg2.txt
tools/stitch_text.py:21: ResourceWarning: unclosed file
<_io.TextIOWrapper name='index.rst' mode='r'
encoding='UTF-8'>
have_line = iter(open(fn)).next Traceback (most recent call
last):
File "tools/stitch_text.py", line 55, in
sys.exit(main())
File "tools/stitch_text.py", line 15, in main
for fb in iter_file_base(index):
File "tools/stitch_text.py", line 21, in iter_file_base
have_line = iter(open(fn)).next
AttributeError: '_io.TextIOWrapper' object has no attribute
'next'
make: *** [text] Error 1
Comments and changes to this ticket
-
Arfrever March 31st, 2012 @ 09:20 PM
Above output was misformatted. Correct output:
$ cd psycopg2-2.4.5/doc $ make text cd src && make text make[1]: Entering directory `/tmp/psycopg2-2.4.5/doc/src' sphinx-build -b text -d _build/doctrees . _build/text Making output directory... Running Sphinx v1.1.3 loading pickled environment... not yet created loading intersphinx inventory from http://docs.python.org/objects.inv... loading intersphinx inventory from http://docs.python.org/3.2/objects.inv... building [text]: targets for 12 source files that are out of date updating environment: 12 added, 0 changed, 0 removed reading sources... [100%] usage looking for now-outdated files... none found pickling environment... done checking consistency... done preparing documents... done writing output... [100%] usage build succeeded. Build finished. The text pages are in _build/text. make[1]: Leaving directory `/tmp/psycopg2-2.4.5/doc/src' cd src && tools/stitch_text.py index.rst _build/text > ../psycopg2.txt tools/stitch_text.py:21: ResourceWarning: unclosed file <_io.TextIOWrapper name='index.rst' mode='r' encoding='UTF-8'> have_line = iter(open(fn)).next Traceback (most recent call last): File "tools/stitch_text.py", line 55, in <module> sys.exit(main()) File "tools/stitch_text.py", line 15, in main for fb in iter_file_base(index): File "tools/stitch_text.py", line 21, in iter_file_base have_line = iter(open(fn)).next AttributeError: '_io.TextIOWrapper' object has no attribute 'next' make: *** [text] Error 1
-
Daniele Varrazzo March 31st, 2012 @ 09:36 PM
Any specific need to build the docs with python 3?
I personally don't feel such a need. If you do, feel free to provide a patch for the error:
stitch_text.py
is a very simple script. -
Daniele Varrazzo March 31st, 2012 @ 09:52 PM
Psycopg works with Python between 2.4 and 3.2, but building the docs is something we only do at release time, so it likely happens with python 2.6 or 2.7.
-
Arfrever March 31st, 2012 @ 10:10 PM
This patch preserves compatibility with Python 2.4.
This patch also fixes some ResourceWarnings about unclosed files, which can be seen with Python >=3.2 when PYTHONWARNINGS="d" environmental variable is exported. -
Daniele Varrazzo March 31st, 2012 @ 11:34 PM
- State changed from new to open
Thank you: will apply the patch.
-
Daniele Varrazzo April 11th, 2012 @ 05:19 PM
- State changed from open to resolved
Patch applied in my dev branch. Thank you very much.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
<b>WARNING:</b> the informations in this tracker are archived. Please submit new tickets or comments to <a href="https://github.com/psycopg/psycopg2/issues">the new tracker</a>.
<br/>
Psycopg is the most used PostgreSQL adapter for the Python programming language. At the core it fully implements the Python DB API 2.0 specifications. Several extensions allow access to many of the features offered by PostgreSQL.