A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-May/004063.html below:

ImportModule (was Re: [Python-Dev] for the todo list: cStringIO uses string.joinfields)

ImportModule (was Re: [Python-Dev] for the todo list: cStringIO uses string.joinfields) ImportModule (was Re: [Python-Dev] for the todo list: cStringIO uses string.joinfields)Gordon McMillan gmcm@hypernet.com
Sat, 13 May 2000 12:25:42 -0400
Fredrik wrote:

> (btw, the C API reference implies that ImportModule doesn't
> use import hooks.  does that mean that cStringIO doesn't work
> under e.g. Gordon's installer?)

You have to fool C code that uses ImportModule by doing an 
import first in your Python code. It's the same for freeze. It's 
tiresome tracking this stuff down. For example, to use shelve:

# this is needed because of the use of __import__ in anydbm 
# (modulefinder does not follow __import__)
import dbhash
# the next 2 are needed because cPickle won't use our import
# hook so we need them already in sys.modules when
# cPickle starts
import string
import copy_reg
# now it will work
import shelve

Imagine the c preprocessor letting you do
#define snarf #include
and then trying to use a dependency tracker.


- Gordon



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4