[MacPorts] #40227: error in tempfile of python 2.7.5
#40227: error in tempfile of python 2.7.5 ----------------------+-------------------------------- Reporter: renz@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.0 Keywords: tempfile | Port: python27 ----------------------+-------------------------------- {{{
tempfile.mktemp('.dat') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tempfile.py", line 356, in mktemp dir = gettempdir() File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tempfile.py", line 265, in gettempdir tempdir = _get_default_tempdir() File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tempfile.py", line 200, in _get_default_tempdir with _io.open(fd, 'wb', closefd=False) as fp: AttributeError: 'module' object has no attribute 'open' }}}
-- Ticket URL: <https://trac.macports.org/ticket/40227> MacPorts <http://www.macports.org/> Ports system for OS X
#40227: error in tempfile of python 2.7.5 -----------------------+------------------- Reporter: renz@… | Owner: jwa@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.0 Resolution: | Keywords: Port: python27 | -----------------------+------------------- Changes (by macsforever2000@…): * owner: macports-tickets@… => jwa@… * keywords: tempfile => Comment: In the future, please Cc the port maintainers ({{{port info --maintainers python27}}}). -- Ticket URL: <https://trac.macports.org/ticket/40227#comment:1> MacPorts <http://www.macports.org/> Ports system for OS X
#40227: error in tempfile of python 2.7.5 -----------------------+------------------- Reporter: renz@… | Owner: jwa@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.0 Resolution: | Keywords: Port: python27 | -----------------------+------------------- Comment (by larryv@…): FWIW, I can’t reproduce this. {{{ % port -v installed python27 The following ports are currently installed: python27 @2.7.5_1 (active) platform='darwin 12' archs='x86_64' % /opt/local/bin/python2.7 -c 'import tempfile; print(tempfile.mktemp(".dat"))' /var/folders/wb/4r15t9nx5bd4zht628hhnnqm0000gn/T/tmpVr5xzv.dat % }}} -- Ticket URL: <https://trac.macports.org/ticket/40227#comment:2> MacPorts <http://www.macports.org/> Ports system for OS X
#40227: error in tempfile of python 2.7.5 -----------------------+------------------- Reporter: renz@… | Owner: jwa@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.0 Resolution: | Keywords: Port: python27 | -----------------------+------------------- Comment (by renz@…): It seems that tempfile.py imports io, but it somehow loads one of my file io.py in my PYTHONPATH. However, this didn't happen in python2.7.2. Do I have to keep out from a construction zone? How would I know? {{{ % python -c 'import tempfile; print tempfile.mktemp(".dat")' Traceback (most recent call last): File "<string>", line 1, in <module> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tempfile.py", line 32, in <module> import io as _io File "/Users/renz/code/cpl/io.py", line 217, in <module> ... }}} -- Ticket URL: <https://trac.macports.org/ticket/40227#comment:3> MacPorts <http://www.macports.org/> Ports system for OS X
#40227: error in tempfile of python 2.7.5 -----------------------+------------------- Reporter: renz@… | Owner: jwa@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.0 Resolution: | Keywords: Port: python27 | -----------------------+------------------- Changes (by larryv@…): * cc: nad@… (added) -- Ticket URL: <https://trac.macports.org/ticket/40227#comment:4> MacPorts <http://www.macports.org/> Ports system for OS X
#40227: error in tempfile of python 2.7.5 -----------------------+------------------- Reporter: renz@… | Owner: jwa@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.0 Resolution: | Keywords: Port: python27 | -----------------------+------------------- Comment (by nad@…): The `io` module has been in the Python standard library since Python 2.6. It looks like you've just been lucky up to now that having your own module named `io` did not conflict with the one in the standard library. For the record, as part of the fixes for [http://bugs.python.org/issue16800] which was released in Python 2.7.4, the `tempfile` module was changed to use `io`. Shadowing of module names is a common trap. Probably the best general way to avoid it is by structuring your project as one or more Python packages thereby putting your modules in their own namespace (see http://docs.python.org/2/tutorial/modules.html#packages). -- Ticket URL: <https://trac.macports.org/ticket/40227#comment:5> MacPorts <http://www.macports.org/> Ports system for OS X
#40227: error in tempfile of python 2.7.5 -----------------------+------------------- Reporter: renz@… | Owner: jwa@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.0 Resolution: | Keywords: Port: python27 | -----------------------+------------------- Comment (by ryandesign@…): It sounds like there's nothing we need to do in MacPorts for this issue and could close it as invalid? -- Ticket URL: <https://trac.macports.org/ticket/40227#comment:7> MacPorts <http://www.macports.org/> Ports system for OS X
#40227: error in tempfile of python 2.7.5 -----------------------+------------------- Reporter: renz@… | Owner: jwa@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.0 Resolution: | Keywords: Port: python27 | -----------------------+------------------- Comment (by nad@…): Yes, this is neither a MacPorts nor a Python issue. Either rename the user module that conflicts with the standard library one or restructure the user program to use its own package namespace. -- Ticket URL: <https://trac.macports.org/ticket/40227#comment:8> MacPorts <http://www.macports.org/> Ports system for OS X
#40227: error in tempfile of python 2.7.5 -----------------------+-------------------- Reporter: renz@… | Owner: jwa@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: 2.2.0 Resolution: invalid | Keywords: Port: python27 | -----------------------+-------------------- Changes (by mf2k@…): * status: new => closed * resolution: => invalid -- Ticket URL: <https://trac.macports.org/ticket/40227#comment:9> MacPorts <http://www.macports.org/> Ports system for OS X
participants (1)
-
MacPorts