This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: pydoc error - "No module named tempfile"
Type: behavior Stage: test needed
Components: Extension Modules Versions: Python 2.5
process
Status: closed Resolution: duplicate
Dependencies: Superseder: pydoc doesn't work from the command line
View: 7328
Assigned To: Nosy List: brian.curtin, eric.araujo, ggenellina, gib, r.david.murray
Priority: normal Keywords:

Created on 2010-01-21 21:23 by gib, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (10)
msg98111 - (view) Author: Gib Bogle (gib) Date: 2010-01-21 21:23
>python -m pydoc sys

gives

No module named tempfile
msg98112 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-01-21 21:26
Hello

I can’t reproduce your bug.

Please specify exact Python version, how you installed it, whether you did something unusual with the lib directory, and any other useful information.

Kind regards
msg98113 - (view) Author: Gib Bogle (gib) Date: 2010-01-21 21:42
Hi Eric,

I'm using Python 2.5.4 on Windows XP.  I installed pythonxy, which installed 
2.5.4.  I also have PyQt4.4 installed.  I haven't touched anything in the lib 
directory, as far as I know.

A poster on comp.lang.python finds the command works on one machine, but not on 
another.  Look for the post entitled "pyexe and pydocs.Downloads?"

Cheers
Gib

Dr. Gib Bogle
Senior Research Fellow
Auckland Bioengineering Institute
University of Auckland
New Zealand

http://www.bioeng.auckland.ac.nz

g.bogle@auckland.ac.nz
(64-9) 373-7599 Ext. 87030

Éric Araujo wrote:
> Éric Araujo <merwok@netwok.org> added the comment:
> 
> Hello
> 
> I can’t reproduce your bug.
> 
> Please specify exact Python version, how you installed it, whether you did something unusual with the lib directory, and any other useful information.
> 
> Kind regards
> 
> ----------
> nosy: +Merwok
> 
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue7749>
> _______________________________________
msg98114 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2010-01-21 21:45
I'm not seeing this on 2.5, 2.6, or trunk.
msg98117 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-01-21 22:18
Under 2.5 this could be due to various weird issues with your python path and the modules on it.  Try running python from a clean directory and specifying the -E flag and see if the behavior changes, and/or try importing tempfile at the python prompt and see if you get a more useful message.

Under 2.7 I think pydoc handles this better.  Note that even if you find a bug in 2.5 it no longer receives bug fixes, so you'd also have to be able to reproduce it in 2.6.
msg98118 - (view) Author: Gib Bogle (gib) Date: 2010-01-21 22:38
R. David Murray wrote:
> R. David Murray <rdmurray@bitdance.com> added the comment:
> 
> Under 2.5 this could be due to various weird issues with your python path and the modules on it.  Try running python from a clean directory and specifying the -E flag and see if the behavior changes, and/or try importing tempfile at the python prompt and see if you get a more useful message.
> 
> Under 2.7 I think pydoc handles this better.  Note that even if you find a bug in 2.5 it no longer receives bug fixes, so you'd also have to be able to reproduce it in 2.6.
> 
> ----------
> nosy: +r.david.murray
> 
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue7749>
> _______________________________________

I previously had 2.6 installed, removed it for compatibility with something. 
Maybe I did something wrong.  It isn't a big issue for me, I just reported it 
because someone suggested I should.  I plan to upgrade to 2.6 soon anyway.
msg98132 - (view) Author: Gabriel Genellina (ggenellina) Date: 2010-01-22 03:38
On Windows, trying with different Python versions:

D:\temp>python24 -m pydoc sys
[works as expected]

D:\temp>python25 -m pydoc sys
No module named tempfile

D:\temp>python26 -m pydoc sys
No module named tempfile

D:\temp>python27 -m pydoc sys
[works as expected]


If tempfile.py is in the current directory, it works:

D:\temp>cd \apps\python26\lib

D:\apps\Python26\Lib>dir /b tempfile.py
tempfile.py

D:\apps\Python26\Lib>python26 -m pydoc sys
Help on built-in module sys:
...


Directly executing pydoc.py works fine too:

D:\temp>d:\apps\Python26\lib\pydoc.py sys
Help on built-in module sys:
...


so this may be a runpy issue, not directly related to pydoc.
msg98133 - (view) Author: Gib Bogle (gib) Date: 2010-01-22 03:52
Importing tempfile from within python does not produce an error.
msg98135 - (view) Author: Gabriel Genellina (ggenellina) Date: 2010-01-22 04:37
This happens to be a duplicate of issue #7328 -- pydoc used to remove the Python standard library from sys.path (!) when run with -m

Fixed in r76312 (2.7). I think the fix should be backported to 2.6

@gib: you may patch your Python 2.5 installation yourself, it's very simple, you'll have to add a single line and reindent a block, that's all. See r76312
msg98670 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-02-01 17:38
Just FYI, it was backported to 2.6 in r76313.
History
Date User Action Args
2022-04-11 14:56:56adminsetgithub: 51997
2010-02-01 17:38:28r.david.murraysetmessages: + msg98670
2010-01-31 15:59:44georg.brandlsetstatus: open -> closed
resolution: duplicate
superseder: pydoc doesn't work from the command line
2010-01-22 04:37:43ggenellinasetmessages: + msg98135
2010-01-22 03:52:49gibsetmessages: + msg98133
2010-01-22 03:38:43ggenellinasetnosy: + ggenellina
messages: + msg98132
2010-01-21 22:38:13gibsetmessages: + msg98118
2010-01-21 22:18:44r.david.murraysetnosy: + r.david.murray
messages: + msg98117
2010-01-21 21:45:14brian.curtinsetpriority: normal

components: + Extension Modules
title: pydoc error -> pydoc error - "No module named tempfile"
nosy: + brian.curtin

messages: + msg98114
stage: test needed
2010-01-21 21:42:31gibsetmessages: + msg98113
2010-01-21 21:26:42eric.araujosetnosy: + eric.araujo
messages: + msg98112
2010-01-21 21:23:22gibcreate