Re: strace of python shows nonsense

2013-01-14 Thread Steven D'Aprano
On Tue, 15 Jan 2013 00:50:01 +0100, Joep van Delft wrote:

> Hi there,
> 
> 
> I am puzzled at how I borked my installation. Python loads slow on my
> machine, and I decided to use strace and /usr/bin/time to see what is
> actually happening.

Before dropping down to such a low level, I suggest you start at a 
higher, Python level.

Run `python -E` to disable any environment variables and startup file. 
Does that help?

Compare sys.path when running with and without the -E switch. Any 
important differences? Anything unusual in sys.path, such as directories 
that don't exist?

Run `python -v` to print modules as they are loaded. (Warning: there are 
a lot of them.) Can you see any obvious delays?


[...]
> What puzzles me, is the amount of errors for open and stat64. There are
> references to stuff I don't know (~/GNUStep directory? Stuff under
> site-packages that does not exist? Subdirs of site-packages that are not
> included in sys.path?) What is python doing there, and why? And, more
> importantly, how can this be corrected?

What's the value of the environment variable PYTHONPATH?

Do you have a PYTHONSTARTUP set? What is in that file?



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: strace of python shows nonsense

2013-01-14 Thread Dieter Maurer
Joep van Delft  writes:

> ...
> What puzzles me, is the amount of errors for open and stat64.

The high number of errors comes from Python's import logic:
when Python should import a module/package (not yet imported),
it looks into each member on "sys.path" for about 6 different potential
filename spellings corresponding to the module -- until it succeeds
or has tried all members. Most such filesystem lookups will fail -
giving a high number of "stat" errors.

-- 
http://mail.python.org/mailman/listinfo/python-list