473,804 Members | 2,133 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Authoritative documentation on packages, import & ihooks

I am looking for information on packages & import hooks, including
simple examples on how to implement a simple import hook. Quick
googling turns out some documents, such as:

-- PEP 302:
http://www.python.org/peps/pep-0302.html

-- What's new on Python 2.3:
http://www.python.org/doc/2.3.4/what...on-pep302.html

-- Import SIG:
http://www.python.org/sigs/import-sig/

-- PyDoc for the ihooks module:
http://pydoc.org/2.3/ihooks.html

However, after reading them, I ended up more confused than before.
There are lots of references to the ihooks standard module, but there
is no documentation about it on the standard Python docs. The "Modules
That Needs Docs" Wiki entry
(http://www.python.org/moin/ModulesThatNeedDocs) lists ihooks and
imputils, but noone has volunteered to do it yet (worse, not even a
bug report was filled; this is something that I'm going to do).
Packages are also not documented (there is still a reference to an
essay from 1.5 days on the Python 2.3 docs). It's a messy state of
affairs.

For what I could see, the import system went over several iterations
and patches since the 1.5 release (when packages were added). It's now
hard to understand what is the preferred hooking mechanism as far as
Python 2.4 (and future versions) are concerned. For this reason, I
would like to know if there is any document which may be considered
"authoritat ive" for the import system (besides ihooks.py and
import.c). If *all* that exists is the source code, well, I guess I'll
have to read it. But anyway... pointers to simple examples also are
helpful. Thanks in advance.

--
Carlos Ribeiro
Consultoria em Projetos
blog: http://rascunhosrotos.blogspot.com
blog: http://pythonnotes.blogspot.com
mail: ca********@gmai l.com
mail: ca********@yaho o.com
Jul 18 '05 #1
0 1172

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

Similar topics

5
2276
by: Petri Savolainen | last post by:
I was trying to roll my own python code importer, but in the end, it seems that no matter what you try, it is always necessary to supply a REAL file object for python lower-level import machinery to work. Is this really true? Or did I miss something? Of course, it is easy to get the module source from somewhere, put it into a tmpfile etc. ... but I'd be nice to be able to skip that extra step. Thanks,
3
4021
by: Chris Barker | last post by:
Hi all, We've been having a discussion over on the wxPython-users mailing list about how to deal with multiple versions of wxPython. During the discussion it came up that this isn't a problem faced only by wxPython, but would have to be dealt with by virtually all packages. The root of the problem is what to do when you install a new version of wxPython, and want to be able to keep using the old one. This question comes up frequently...
8
2085
by: Grant D. Watson | last post by:
If this has been answered before, or if my terminology is off, please bear with me; my Python experience is limited to use in one class and to personal projects. I'd like to do something rather silly: I'd like to run a particular piece of code from a given module every time that the module is imported, and not just at the time that the module is originally loaded. So, every time a module says import foo or something analogous, I want...
2
5441
by: Peter Saffrey | last post by:
(apologies for starting a new thread - Google can't retrieve the other message for some reason) Yes, /usr/lib/python/site-packages is in sys.path. This series of commands should explain what I mean: I've put the Python ID3 module in a sub-directory of site-packages as an illustration. pzs@bonnie:~$ ls /usr/lib/python2.3/site-packages/ ID3.py ID3.pyc ID3.pyo README apt_inst.so apt_pkg.so apt_proxy bsddb3 debconf.py debconf.pyc ...
0
999
by: Amit Khemka | last post by:
Hello All, I have multiple modules with same name in different directories (well I guess thats may not be a good practise, but i needed it for debugging and working with various versions). Now how do I import a module with specifying a path. Few minutes of googling suggested: import ihooks
1
1538
by: Clarence | last post by:
It appears that the -W option on starting python doesn't work the same as the warnings module. In particular, the "message" parameter is not treated as a regular expression, but rather a string literal which must appear at the beginning of a warning message in order to match. The treatment of -W in "python -h" makes no mention of the warnings module (and I actually couldn't find any definitive documentation on command line switches),...
3
12094
by: yinglcs | last post by:
Hi, i have 2 python files in *different directory* , how can I import python functions from 1 python file to another? i get this error: import task ImportError: No module named task/ Thank you.
3
2472
by: Doug Robinson | last post by:
If I try to access another jar files default package I have no problem. When I try to access anythig else i.e. package com.mine.thing, I always get the not found message. What special thing do I need to do to make it work? package a.b.c.*; import Another.*;
5
1536
by: ManWithNoName | last post by:
Hi! I'm somewhat new to python (using 2.5 on w2k) Currently I am trying to organize a structure for a project, and import all necessary files and so on. Everything went fine until I tried to import a python file with no name (don't ask me why it has no name ;) e.g. root (the folder where the code is run from)
0
9595
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,...
0
10603
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10356
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
10099
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
9176
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...
0
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4314
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3836
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3003
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.