Investigating a query about the python path I see that my win32 installation has
c:/windows/system32/python24.zip (which is non existent) second on sys.path
before the actual python24/lib etc etc.
Firstly should python start up with non-existent entries on the path?
Secondly is this entry be the default for some other kind of python installation?
--
Robin Becker 24 3760
Robin Becker wrote: Firstly should python start up with non-existent entries on the path?
Yes, this is by design.
Secondly is this entry be the default for some other kind of python installation?
Yes. People can package everything they want in python24.zip (including
site.py). This can only work if python24.zip is already on the path
(and I believe it will always be sought in the directory where
python24.dll lives).
Regards,
Martin
"Martin v. Löwis" <ma****@v.loewi s.de> writes on Fri, 20 May 2005 18:13:56 +0200: Robin Becker wrote: Firstly should python start up with non-existent entries on the path?
Yes, this is by design.
Secondly is this entry be the default for some other kind of python installation?
Yes. People can package everything they want in python24.zip (including site.py). This can only work if python24.zip is already on the path (and I believe it will always be sought in the directory where python24.dll lives).
The question was:
"should python start up with **non-existent** objects on the path".
I think there is no reason why path needs to contain an object
which does not exist (at the time the interpreter starts).
In your use case, "python24.z ip" does exist and therefore may
be on the path. When "python24.z ip" does not exist, it does
not contain anything and especially not "site.py".
I recently analysed excessive import times and
saw thousands of costly and unneccesary filesystem operations due to:
* long "sys.path", especially containing non-existing objects
Although non-existent, about 5 filesystem operations are
tried on them for any module not yet located.
* a severe weakness in Python's import hook treatment
When there is an importer "i" for a path "p" and
this importer cannot find module "m", then "p" is
treated as a directory and 5 file system operations
are tried to locate "p/m". Of course, all of them fail
when "p" happens to be a zip archive.
Dieter
Dieter Maurer wrote:
...... The question was:
"should python start up with **non-existent** objects on the path".
I think there is no reason why path needs to contain an object which does not exist (at the time the interpreter starts).
In your use case, "python24.z ip" does exist and therefore may be on the path. When "python24.z ip" does not exist, it does not contain anything and especially not "site.py".
I think this was my intention, but also I think I have some concern over
having two possible locations for the standard library. It seems non pythonic
and liable to cause confusion if some package should manage to install
python24.zip while I believe that python24\lib is being used. I recently analysed excessive import times and saw thousands of costly and unneccesary filesystem operations due to:
* long "sys.path", especially containing non-existing objects
Although non-existent, about 5 filesystem operations are tried on them for any module not yet located.
* a severe weakness in Python's import hook treatment
When there is an importer "i" for a path "p" and this importer cannot find module "m", then "p" is treated as a directory and 5 file system operations are tried to locate "p/m". Of course, all of them fail when "p" happens to be a zip archive.
Dieter
I suppose that's a reason for eliminating duplicates and non-existent entries.
--
Robin Becker
Dieter Maurer wrote: The question was:
"should python start up with **non-existent** objects on the path".
I think there is no reason why path needs to contain an object which does not exist (at the time the interpreter starts).
There is. When the interpreter starts, it doesn't know what object
do or do not exist. So it must put python24.zip on the path
just in case.
In your use case, "python24.z ip" does exist and therefore may be on the path. When "python24.z ip" does not exist, it does not contain anything and especially not "site.py".
Yes, but the interpreter cannot know in advance whether
python24.zip will be there when it starts.
I recently analysed excessive import times and saw thousands of costly and unneccesary filesystem operations due to:
Hmm. In my Python 2.4 installation, I only get 154 open calls, and
63 stat calls on an empty Python file. So somebody must have messed
with sys.path really badly if you saw thoughsands of file operations
(although I wonder what operating system you use so that failing
open operations are costly; most operating systems should do them
very efficiently).
Regards,
Martin
Robin Becker wrote: Dieter Maurer wrote:
[...] I think this was my intention, but also I think I have some concern over having two possible locations for the standard library. It seems non pythonic and liable to cause confusion if some package should manage to install python24.zip while I believe that python24\lib is being used.
I recently analysed excessive import times and saw thousands of costly and unneccesary filesystem operations due to:
* long "sys.path", especially containing non-existing objects
Although non-existent, about 5 filesystem operations are tried on them for any module not yet located.
* a severe weakness in Python's import hook treatment
When there is an importer "i" for a path "p" and this importer cannot find module "m", then "p" is treated as a directory and 5 file system operations are tried to locate "p/m". Of course, all of them fail when "p" happens to be a zip archive.
Dieter
I suppose that's a reason for eliminating duplicates and non-existent entries.
There are some aspects of Python's initialization that are IMHO a bit
too filesystem-dependent. I mentioned one in http://sourceforge.net/tracker/index...70&atid=105470
but I'd appreciate further support. Ideally there should be some means
for hooked import mechanisms to provide answers that are currently
sought from the filestore.
regards
Steve
--
Steve Holden +1 703 861 4237 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/
"Martin v. Löwis" <ma****@v.loewi s.de> writes on Sat, 21 May 2005 23:53:31 +0200: Dieter Maurer wrote: ... The question was:
"should python start up with **non-existent** objects on the path".
I think there is no reason why path needs to contain an object which does not exist (at the time the interpreter starts). There is. When the interpreter starts, it doesn't know what object do or do not exist. So it must put python24.zip on the path just in case.
Really?
Is the interpreter unable to call "C" functions ("stat" for example)
to determine whether an object exists before it puts it on "path".
Yes, but the interpreter cannot know in advance whether python24.zip will be there when it starts.
Thus, it checks dynamically when it starts. I recently analysed excessive import times and saw thousands of costly and unneccesary filesystem operations due to:
Hmm. In my Python 2.4 installation, I only get 154 open calls, and 63 stat calls on an empty Python file. So somebody must have messed with sys.path really badly if you saw thoughsands of file operations (although I wonder what operating system you use so that failing open operations are costly; most operating systems should do them very efficiently).
The application was Zope importing about 2.500 modules
from 2 zip files "zope.zip" and "python24.z ip".
This resulted in about 12.500 opens -- about 4 times more
than would be expected -- about 10.000 of them failing opens.
Dieter
Steve Holden <st***@holdenwe b.com> writes on Sun, 22 May 2005 09:14:43 -0400: ... There are some aspects of Python's initialization that are IMHO a bit too filesystem-dependent. I mentioned one in http://sourceforge.net/tracker/index...70&atid=105470
but I'd appreciate further support. Ideally there should be some means for hooked import mechanisms to provide answers that are currently sought from the filestore.
There are such hooks. See e.g. the "meta_path" hooks as
described by PEP 302.
Dieter Maurer wrote: Really?
Is the interpreter unable to call "C" functions ("stat" for example) to determine whether an object exists before it puts it on "path".
What do you mean, "unable to"? It just doesn't.
Could it? Perhaps, if somebody wrote a patch.
Would the patch be accepted? Perhaps, if it didn't break something
else.
In the past, there was a silent guarantee that you could add
items to sys.path, and only later create the directories behind
these items. I don't know whether people rely on this guarantee.
The application was Zope importing about 2.500 modules from 2 zip files "zope.zip" and "python24.z ip". This resulted in about 12.500 opens -- about 4 times more than would be expected -- about 10.000 of them failing opens.
I see. Out of curiosity: how much startup time was saved
when sys.path was explicitly stripped to only contain these
two zip files?
I would expect that importing 2500 modules takes *way*
more time than doing 10.000 failed opens.
Regards,
Martin
Dieter Maurer wrote: Steve Holden <st***@holdenwe b.com> writes on Sun, 22 May 2005 09:14:43 -0400:
... There are some aspects of Python's initialization that are IMHO a bit too filesystem-dependent. I mentioned one in http://sourceforge.net/tracker/index...70&atid=105470
but I'd appreciate further support. Ideally there should be some means for hooked import mechanisms to provide answers that are currently sought from the filestore.
There are such hooks. See e.g. the "meta_path" hooks as described by PEP 302.
Indeed I have written PEP 302-based code to import from a relational
database, but I still don't believe there's any satisfactory way to have
[such a hooked import mechanism] be a first-class component of an
architecture that specifically requires an os.py to exist in the file
store during initialization.
I wasn't asking for an import hook mechanism (since I already knew these
to exist), but for a way to allow such mechanisms to be the sole import
support for certain implementations .
regards
Steve
--
Steve Holden +1 703 861 4237 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: A. B., Khalid |
last post by:
For those how downloaded the new python, how big is it? I am speaking
of the DLL on Windows.
I am just curious; it would be interesting to compare the sizes of
earlier versions with this alpha release. These are the python
versions I know about:
python21.dll, July, 26th, 2001, 693KB
python23.dll, July, 29th, 2003, 953KB
|
by: Jose Rivera |
last post by:
Hi
I changed for python24 and the only thing missed is metakit for python24.
Thanks
|
by: Warren Postma |
last post by:
It seems that WinCvs needs a python??.dll runtime but that when I
install Python2.4 it doesn't include this dll.
Python 2.3 does.
What's the recommendation here?
Warren
|
by: Stormbringer |
last post by:
Hello,
I am trying to make an executable for one of my applications with cx
freeze. All works ok although I must include python24.dll with it if I
want to redistribute it. The big problem is python24.dll size, it's 1.8
MB and I am sure I don't need much of what's in there.
I downloaded python source code and built the dll using the VC 7.1
project (directory PCBuild/), still can't figure out how I can tweak
the project so I get smaller...
|
by: Robert |
last post by:
updating a py2exe'd software I was impressed by python24.dll's footprint -
double size of python23.dll
Is there a version without/separate asianc codecs (which seem to mainly blow
up python24.dll)? Or how to build one?
Robert
| |
by: Robert |
last post by:
Martin v. Löwis schrieb:
> Robert wrote:
> > Wouldn't it be an issue to think about if future win-python distributions
> > should keep on including the asian codecs in the main-dll?
>
> Indeed, it would. As I said before: if somebody defines a clear, fair
> policy which finds agreement in the community, I'm willing to change the
> current policy on what goes into python24.dll, and what is built
> separately. Bonus points if the policy is...
|
by: Bugs |
last post by:
I believe I read in a relatively recent thread that the reason
python24.dll is so large compared to previous releases is that all the
language encodings are linked into the library?
Are there any plans for future releases to split the encodings out so
that, for example, if someone wanted to make a smaller executable using
py2exe without all the language encodings, they could do so?
I suppose one could always compile their own version...
|
by: magazine |
last post by:
-----Original Message-----
From: Steve Holden
Sent: 2006Äê4ÔÂ4ÈÕ 20:00
To: DMagazine@163.com
Cc: tim@pollenation.net
Subject: Re: #286: Py_Initialize faliure if the python24.lib build
with vc8
psf wrote:
|
by: Jonathan Fine |
last post by:
Hello
My problem is that I want a Python 2.4 module on
a server that is running Python 2.3. I definitely
want to use the 2.4 module, and I don't want to
require the server to move to Python 2.4.
More exactly, I am using subprocess, which is
new in Python 2.4. What I am writing is something
like
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |