supress creation of .pyc files

Discussion in 'Python' started by Thomas Guettler, Feb 16, 2005.

  1. Hi,

    Is there a way to import a file without creating
    a .pyc file?

    Of course you can delete the pyc in my script after
    the import statement, but maybe there is a switch
    that I have not found yet.

    The imported file is a config file, not a script.

    Thomas


    --
    Thomas G├╝ttler, http://www.thomas-guettler.de/
    Thomas Guettler, Feb 16, 2005
    #1
    1. Advertising

  2. On Wed, 16 Feb 2005 14:53:22 +0100, Thomas Guettler wrote:

    > The imported file is a config file, not a script.


    You could use execfile() to read the file, and not import.

    Jeremy
    Jeremy Sanders, Feb 16, 2005
    #2
    1. Advertising

  3. Thomas Guettler

    Ron Garret Guest

    In article <>,
    Thomas Guettler <> wrote:

    > Hi,
    >
    > Is there a way to import a file without creating
    > a .pyc file?
    >
    > Of course you can delete the pyc in my script after
    > the import statement, but maybe there is a switch
    > that I have not found yet.
    >
    > The imported file is a config file, not a script.
    >
    > Thomas


    If you're on unix, you can put the .py files you want to import in a new
    directory, then change the permissions on this directory so that you do
    not have write permission for it.

    rg
    Ron Garret, Feb 16, 2005
    #3
  4. Thomas Guettler wrote:
    > Is there a way to import a file without creating
    > a .pyc file?


    That is part of PEP 304, which is not implemented
    yet, and apparently currently stalled due to lack
    of interest.

    Regards,
    Martin
    =?ISO-8859-15?Q?=22Martin_v=2E_L=F6wis=22?=, Feb 16, 2005
    #4
    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. JG
    Replies:
    3
    Views:
    4,000
    Scott Allen
    Oct 21, 2004
  2. Edwin Knoppert

    Supress error/warning of winapi in class?

    Edwin Knoppert, Dec 13, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    949
    Edwin Knoppert
    Dec 13, 2005
  3. mrstephengross

    How to force creation of a .pyc?

    mrstephengross, Feb 22, 2006, in forum: Python
    Replies:
    3
    Views:
    406
    Peter Hansen
    Feb 23, 2006
  4. craf
    Replies:
    0
    Views:
    193
  5. Mircescu Andrei
    Replies:
    3
    Views:
    76
    Mircescu Andrei
    Feb 20, 2014
Loading...

Share This Page