Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #66723

Re: Python 2.7 importing pyc files without py files

From Terry Reedy <tjreedy@udel.edu>
Subject Re: Python 2.7 importing pyc files without py files
Date 2014-02-19 17:26 -0500
References <8a6aff2d-777a-4f80-8c26-6d1a586e6c5c@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.7167.1392848807.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 2/19/2014 5:03 PM, Mircescu Andrei wrote:
> Hi,
>
>
> I encountered a strange issue. I have an application which uses
> extensively python 2.7.6 (CPython).
>
>
> The issue that I see is the following: If there are only pyc files,
> the loading time of the application is much more than if I have pyc
> and py files. It is behind with 2 minutes more than if it had py
> files
>
> Do you have any idea why this is happening ? Maybe is because, python
> tries to search the py file in all the paths and this search is
> exhaustive ? This is the best guess I could figure it out but I'm not
> sure.

It seems plausible. Once .py is found, the .pyc is in the same directory.

> Also, if this is the scenario, there is a way I can stop this, to not
> search for the py files ?

Try reducing sys.path to the minimum needed.

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Python 2.7 importing pyc files without py files Mircescu Andrei <mircescu.andrei@gmail.com> - 2014-02-19 14:03 -0800
  Re: Python 2.7 importing pyc files without py files Emile van Sebille <emile@fenx.com> - 2014-02-19 14:25 -0800
    Re: Python 2.7 importing pyc files without py files Mircescu Andrei <mircescu.andrei@gmail.com> - 2014-02-20 05:36 -0800
  Re: Python 2.7 importing pyc files without py files Terry Reedy <tjreedy@udel.edu> - 2014-02-19 17:26 -0500

csiph-web