Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Documentation fails to build with Python 3

#107

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

Reported by Psycopg website · March 31st, 2012 @ 09:16 PM

State: resolved
Milestone: none
Assigned to: nobody

Activity

  1. Arfrever
    Arfrever

    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
    

    March 31st, 2012 @ 09:20 PM

  2. Daniele Varrazzo
    Daniele Varrazzo

    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.

    March 31st, 2012 @ 09:36 PM

  3. Arfrever
    Arfrever

    What is minimal supported version of Python?

    March 31st, 2012 @ 09:47 PM

  4. Daniele Varrazzo
    Daniele Varrazzo

    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.

    March 31st, 2012 @ 09:52 PM

  5. Arfrever
    Arfrever

    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.

    March 31st, 2012 @ 10:10 PM

  6. Daniele Varrazzo
    Daniele Varrazzo
    • State changed from new to open

    Thank you: will apply the patch.

    March 31st, 2012 @ 11:34 PM

  7. Daniele Varrazzo
    Daniele Varrazzo
    • State changed from open to resolved

    Patch applied in my dev branch. Thank you very much.

    April 11th, 2012 @ 05:19 PM