473,722 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

python24.zip

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

Jul 19 '05 #1
24 3728
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
Jul 19 '05 #2
"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
Jul 19 '05 #3
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
Jul 19 '05 #4
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
Jul 19 '05 #5
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/

Jul 19 '05 #6
"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
Jul 19 '05 #7
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.
Jul 19 '05 #8
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
Jul 19 '05 #9
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/

Jul 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2197
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
0
1178
by: Jose Rivera | last post by:
Hi I changed for python24 and the only thing missed is metakit for python24. Thanks
1
3875
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
2
2260
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...
3
1586
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
1
1477
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...
10
1820
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...
0
1272
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:
7
1857
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
1
9157
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9088
tracyyun
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...
0
8052
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6681
isladogs
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...
0
5995
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();...
0
4502
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...
0
4762
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2602
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2147
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.