python 2.3.1 issues DeprecationWarning for FCNTL when importing tempfile

Discussion in 'Python' started by Pierre Rouleau, Oct 2, 2003.

  1. Hi all!

    I am using Python 2.3.1 on Win32 (NT, 2000).

    Whenever a file imports the standard tempfile module, Python 2.3.1
    issues the following warning:

    C:\Python23\lib\fcntl.py:7: DeprecationWarning: the FCNTL module is
    Deprecated; please use fcntl DeprecationWarning).

    A quick look into tempfile.py show that it does import fcnt. Python 2.3
    tempfile documentation says that it was changed. Was the use of fcntl()
    forgotten? Is this a bug?

    Thanks for your time.

    Pierre
     
    Pierre Rouleau, Oct 2, 2003
    #1
    1. Advertising

  2. Pierre Rouleau <> writes:

    > Hi all!
    >
    > I am using Python 2.3.1 on Win32 (NT, 2000).
    >
    > Whenever a file imports the standard tempfile module, Python 2.3.1
    > issues the following warning:
    >
    > C:\Python23\lib\fcntl.py:7: DeprecationWarning: the FCNTL module is
    > Deprecated; please use fcntl DeprecationWarning).
    >
    > A quick look into tempfile.py show that it does import fcnt. Python
    > 2.3 tempfile documentation says that it was changed. Was the use of
    > fcntl() forgotten? Is this a bug?


    Do you have the environment variable PYTHONCASEOK set? You probably
    don't want to...

    Cheers,
    mwh

    --
    The "of course, while I have no problem with this at all, it's
    surely too much for a lesser being" flavor of argument always
    rings hollow to me. -- Tim Peters, 29 Apr 1998
     
    Michael Hudson, Oct 3, 2003
    #2
    1. Advertising

  3. Re: python 2.3.1 issues DeprecationWarning for FCNTL when importingtempfile

    >>Whenever a file imports the standard tempfile module, Python 2.3.1
    >>issues the following warning:
    >>
    >>C:\Python23\lib\fcntl.py:7: DeprecationWarning: the FCNTL module is
    >>Deprecated; please use fcntl DeprecationWarning).
    >>
    >>A quick look into tempfile.py show that it does import fcnt. Python
    >>2.3 tempfile documentation says that it was changed. Was the use of
    >>fcntl() forgotten? Is this a bug?

    >
    >
    > Do you have the environment variable PYTHONCASEOK set? You probably
    > don't want to...
    >


    No, PYTHONCASEOK is not set.

    I get the problem with right away in the python shell:

    D:\dev\python>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

    c:\python23\lib\fcntl.py:7: DeprecationWarning: the FCNTL module is
    deprecated; please use fcntl
    DeprecationWarning)
    >>>
    >>> import os
    >>> 'PYTHONCASEOK' in os.environ

    False
    >>>


    I also tried it within PythonWin: same result.


    PythonWin 2.3.1 (#47, Sep 23 2003, 23:47:32) [MSC v.1200 32 bit (Intel)]
    on win32.
    Portions Copyright 1994-2001 Mark Hammond () -
    see 'Help/About PythonWin' for further copyright information.
    >>> import tempfile

    C:\Python23\lib\fcntl.py:7: DeprecationWarning: the FCNTL module is
    deprecated; please use fcntl
    DeprecationWarning)
    >>> import os
    >>> 'PYTHONCASEOK' in os.environ

    False
    >>>


    I did not edit any of the files in the Python library. It does the same
    on WinNT and Win2000 but i also tried it on a XP machine and the problem
    is not on the XP machine. But the source is the same on the XP machine
    (the FCNTL.py and tempfile.py) and the NT and 2000 machines.

    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.

    Thanks!

    Pierre
     
    Pierre Rouleau, Oct 3, 2003
    #3
  4. Pierre Rouleau <> writes:

    > >>Whenever a file imports the standard tempfile module, Python 2.3.1
    > >>issues the following warning:
    > >>
    > >>C:\Python23\lib\fcntl.py:7: DeprecationWarning: the FCNTL module is
    > >>Deprecated; please use fcntl DeprecationWarning).
    > >>
    > >>A quick look into tempfile.py show that it does import fcnt. Python
    > >>2.3 tempfile documentation says that it was changed. Was the use of
    > >>fcntl() forgotten? Is this a bug?

    > > Do you have the environment variable PYTHONCASEOK set? You probably
    > > don't want to...
    > >

    >
    > No, PYTHONCASEOK is not set.


    Hmm, weird.

    > I get the problem with right away in the python shell:
    >
    > D:\dev\python>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

    > c:\python23\lib\fcntl.py:7: DeprecationWarning: the FCNTL module is

    ^^^^^^^^
    This is a bit bizarre; the file is really called FCNTL.py, right?

    > I did not edit any of the files in the Python library. It does the
    > same on WinNT and Win2000 but i also tried it on a XP machine and the
    > problem is not on the XP machine. But the source is the same on the
    > XP machine (the FCNTL.py and tempfile.py) and the NT and 2000 machines.
    >
    > 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.


    Could be. I've reached the outer edge of my windows knowledge (not
    very far, you'll notice), so I hope another reader can get you
    further...

    Cheers,
    mwh

    --
    You're posting to a Scheme group. Around here, arguing that Java is
    better than C++ is like arguing that grasshoppers taste better than
    tree bark. -- Thant Tessman, comp.lang.scheme
     
    Michael Hudson, Oct 3, 2003
    #4
  5. Re: python 2.3.1 issues DeprecationWarning for FCNTL when importingtempfile


    >>I get the problem with right away in the python shell:
    >>
    >>D:\dev\python>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

    >>c:\python23\lib\fcntl.py:7: DeprecationWarning: the FCNTL module is

    >
    > ^^^^^^^^
    > This is a bit bizarre; the file is really called FCNTL.py, right?
    >
    >

    Yes. The file is old though:

    C:\Python23\Lib>ls -l [fF]*.py
    -rwxrwxrwa 1 Administrators None 418 May 9 2001 FCNTL.py
    -rwxrwxrwa 1 Administrators None 10173 Sep 2 07:47 filecmp.py
    -rwxrwxrwa 1 Administrators None 12732 Jan 8 2003 fileinput.py
    -rwxrwxrwa 1 Administrators None 3126 Jul 13 18:06 fnmatch.py
    -rwxrwxrwa 1 Administrators None 15548 Feb 27 2003 formatter.py
    -rwxrwxrwa 1 Administrators None 4709 Jan 21 2001 fpformat.py
    -rwxrwxrwa 1 Administrators None 27589 Jun 3 2002 ftplib.py

    I wonder if FCNTL.py is a valid file. Here is what it contains:

    C:\Python23\Lib>cat FCNTL.py
    cat FCNTL.py
    """Backward-compatibility version of FCNTL; export constants exported by
    fcntl, and issue a deprecation warning.
    """

    import warnings
    warnings.warn("the FCNTL module is deprecated; please use fcntl",
    DeprecationWarning)


    # Export the constants known to the fcntl module:
    from fcntl import *

    # and *only* the constants:
    __all__ = [s for s in dir() if s[0] in "ABCDEFGHIJKLMNOPQRSTUVWXYZ"]

    C:\Python23\Lib>

    ----

    BTW, I solved the problem by deleting the fcntl.pyc. See my other post
    below.

    Thanks for your help!
     
    Pierre Rouleau, Oct 3, 2003
    #5
  6. Pierre Rouleau <> writes:

    > BTW, I solved the problem by deleting the fcntl.pyc. See my other
    > post below.


    Actaully, I read this thread completely out of order, but glad to see
    you got it sorted. Definitely a good mystery!

    Cheers,
    mwh

    --
    I have a feeling that any simple problem can be made arbitrarily
    difficult by imposing a suitably heavy administrative process
    around the development. -- Joe Armstrong, comp.lang.functional
     
    Michael Hudson, Oct 6, 2003
    #6
  7. Pierre Rouleau

    Guest

    Re: python 2.3.1 issues DeprecationWarning for FCNTL when importingtempfile

    Michael Hudson wrote:
    >
    > Pierre Rouleau <> writes:
    >
    > > BTW, I solved the problem by deleting the fcntl.pyc. See my other
    > > post below.

    >


    use McMillan installer on Windows, too, and I've also been getting
    these messages. Didn't know they were fixable until reading this
    thread. I was getting two sets of messages, one for fcntl and one
    for termios. Each of these had a *.py, a *.pyc, and a *.pyo in the
    python\Lib folder. Deleting them all seems to fix it.



    Al
     
    , Oct 6, 2003
    #7
  8. Pierre Rouleau

    David Bolen Guest

    Michael Hudson <> writes:

    > Pierre Rouleau <> writes:
    >
    > > Hi all!
    > >
    > > I am using Python 2.3.1 on Win32 (NT, 2000).
    > >
    > > Whenever a file imports the standard tempfile module, Python 2.3.1
    > > issues the following warning:
    > >
    > > C:\Python23\lib\fcntl.py:7: DeprecationWarning: the FCNTL module is
    > > Deprecated; please use fcntl DeprecationWarning).
    > >
    > > A quick look into tempfile.py show that it does import fcnt. Python
    > > 2.3 tempfile documentation says that it was changed. Was the use of
    > > fcntl() forgotten? Is this a bug?

    >
    > Do you have the environment variable PYTHONCASEOK set? You probably
    > don't want to...


    Either that or just check the installed Python lib directory for an
    "fcntl.pyc" file (lowercase). It shouldn't be there under Windows,
    but something (outside of a Python installation) has created it on my
    system in the past erroneously - e.g., the compiled version of that
    file if it was ever used should be uppercase FCNTL.pyc.

    In my case, I believe it may have been related to using the McMillan
    Installer package. Yeah, I just tried using Installer (5b5) on a file
    that imports fcntl and it does create the lower case file compiled
    file while processing things. But I'm not sure if it's more an issue
    with Installer or with the py_compile module. Under Windows if you
    tell py_compile.compile to compile "fcntl.py" without picking a
    destination name then it works even if the actual file is FCNTL.py,
    and regardless of the PYTHONCASEOK setting, and it creates the
    lowercase output file since that's the form you gave it on input. And
    since I think installer just goes based on the module name in the
    source code and passes that on to py_compile.compile, you end up with
    the erroneous module.

    But yes, tempfile changed in 2.3 so that it conditionally tries to
    import fcntl, so once that erroneous compiled module exists, you'll
    get the warning on tempfile (or anything else that tries to import
    fcntl). And if the OP installed Python 2.3 on top of a prior version,
    then it's also possible that the erroneous compiled file may have been
    around on the OP's system for a while and just wasn't noticed since
    typical use didn't involve a module that tried to import it.

    -- David
     
    David Bolen, Oct 6, 2003
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tim Peters
    Replies:
    2
    Views:
    406
    Pierre Rouleau
    Oct 3, 2003
  2. Tim Peters
    Replies:
    1
    Views:
    341
    Pierre Rouleau
    Oct 3, 2003
  3. Tony Meyer
    Replies:
    3
    Views:
    299
    Pierre Rouleau
    Oct 8, 2003
  4. Omid Fatemi

    fcntl and FCNTL

    Omid Fatemi, Oct 30, 2004, in forum: Python
    Replies:
    4
    Views:
    7,017
    Steve Holden
    Nov 1, 2004
  5. Mitko Haralanov

    Invalid argument with fcntl.fcntl

    Mitko Haralanov, Jun 6, 2007, in forum: Python
    Replies:
    0
    Views:
    583
    Mitko Haralanov
    Jun 6, 2007
Loading...

Share This Page