python 2.3.1 issues DeprecationWarning for FCNTL when importing tempfile
Pierre Rouleau
prouleau at impathnetworks.com
Fri Oct 3 15:06:50 EDT 2003
>
> It's curious that your Python executable is apparently in D:\dev\python\,
> but that fcntl.py is getting loaded from c:\python23\lib\. Your setup may
> be too complicated to understand <wink>.
>
I know that /dev is a bad name (in my case on Windows its the directory
for development, not device). The but i have a set of pathon scripts
under development. The PYTHONPATH environment variable is set to make
sure that it looks into it. If i remove d:/dev/python from the
PYTHONPATH and import tempfile i get the same results.
C:\Python23\Lib>set PYTHONPATH=
C:\Python23\Lib>python
Python 2.3.1 (#47, Sep 23 2003, 23:47:32) [MSC v.1200 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tempfile
fcntl.py:7: DeprecationWarning: the FCNTL module is deprecated; please
use fcntl
DeprecationWarning)
>>>
>
>>...
>>I am starting to wonder if the problem is caused by a package that was
>>installed on one set of machines and not the other.
>
>
> Do what you did above but add -vv to the command line, like so:
>
> python -vv
>
> Then "import tempfile" when a prompt finally appears. -vv sprays an
> enormous amount of info to the screen about (among other things) the steps
> Python takes to try to satisfy imports.
I did that. Helped solve the problem: fcntl.pyc was present and that
was causing the problem!
Before deleting fcntl.pyc:
python -vv
....
....
>>> import tempfile
# trying tempfile.pyd
# trying tempfile.dll
# trying tempfile.py
# tempfile.pyc matches tempfile.py
import tempfile # precompiled from tempfile.pyc
import errno # builtin
# trying random.pyd
# trying random.dll
# trying random.py
# random.pyc matches random.py
import random # precompiled from random.pyc
import math # builtin
import _random # builtin
import time # builtin
# trying fcntl.pyd
# trying fcntl.dll
# trying fcntl.py
# trying fcntl.pyw
# trying fcntl.pyc
import fcntl # precompiled from fcntl.pyc
fcntl.py:7: DeprecationWarning: the FCNTL module is deprecated; please
use fcntl
DeprecationWarning)
import thread # builtin
Then I deleted fcntl.pyc:
C:\Python23\Lib>del fcntl.pyc
C:\Python23\Lib>python
Python 2.3.1 (#47, Sep 23 2003, 23:47:32) [MSC v.1200 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tempfile
>>>
The problem is SOLVED!
^^^^^^^^^^^^^^^^^^^^^^
Now, I looked at the C/Python23/Lib files before deleting fcntl.pyc and
this is what i had:
C:\Python23\Lib>lt -l [fF]*.py*
-rwxrwxrwa 1 Administrators None 4709 Jan 21 2001 fpformat.py
-rwxrwxrwa 1 Administrators None 418 May 9 2001 FCNTL.py
-rwxrwxrwa 1 Administrators None 27589 Jun 3 2002 ftplib.py
-rwxrwxrwa 1 Administrators None 12732 Jan 8 2003 fileinput.py
-rwxrwxrwa 1 Administrators None 15548 Feb 27 2003 formatter.py
-rwxrwxrwa 1 Administrators None 3126 Jul 13 18:06 fnmatch.py
-rwxrwxrwa 1 Administrators None 10173 Sep 2 07:47 filecmp.py
-rwxrwxrwa 1 Administrators None 3637 Sep 29 12:01 fnmatch.pyc
-rwxrwxrwa 1 Administrators None 11652 Sep 29 12:01 filecmp.pyc
-rwxrwxrwa 1 Administrators None 583 Sep 30 10:28 fcntl.pyc
What is strange is that it seems that the import of FCNTL.py is case
insensitive, where my system does not make it case insensitive (i dont
have PYTHONCASEOK set).
>
> Also
>
> import sys
> print sys.path
>
>
C:\Python23\Lib>python
Python 2.3.1 (#47, Sep 23 2003, 23:47:32) [MSC v.1200 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> for theDir in sys.path: print theDir
...
C:\WINNT\System32\python23.zip
C:\Python23\lib\site-packages\Pythonwin
C:\Python23\lib\site-packages\win32
C:\Python23\lib\site-packages\win32\lib
C:\Python23\lib\site-packages
c:\python23\DLLs
c:\python23\lib
c:\python23\lib\plat-win
c:\python23\lib\lib-tk
c:\python23
>>>
So, the problem got solved by deleting the fcntl.pyc. I don't really
understand why it solved the problem unless the .pyc was from an old
version (however when i installed Python 2.3 and 2.3.1, I created a new
directory).
Tim and Michael, Thanks for your help!
More information about the Python-list
mailing list