wasm-demo/demo/ermis-f/python_m/cur/0488

49 lines
1.6 KiB
Plaintext

From: jand at easics.be (Jan Decaluwe)
Date: Fri, 23 Apr 1999 12:52:19 +0200
Subject: Running idle as a package
Message-ID: <372050E3.9D05CE8F@easics.be>
Content-Length: 1404
X-UID: 488
I was trying to run idle as a package, so I turned the idle
directory into a python package. But then I got:
Python 1.5.2 (#2, Apr 21 1999, 17:14:19) [GCC 2.8.1] on sunos5
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> from idle import idle
Failed to load extension 'SearchBinding'
Traceback (innermost last):
File "/usr/local/lib/python1.5/site-packages/idle/EditorWindow.py", line 470, in
load_standard_extensions
self.load_extension(name)
File "/usr/local/lib/python1.5/site-packages/idle/EditorWindow.py", line 481, in load_extension
mod = __import__(name)
ImportError: No module named SearchBinding
...
Apparently the problem is caused by the call to __import__,
that is not aware of the intra-package shortcut.
I have been able to solve this for my case as follows:
diff -r1.1 EditorWindow.py
481c481,482
< mod = __import__(name)
---
> pck = __import__('idle.' + name)
> mod = getattr(pck, name)
Regards, Jan
--
===================================================================
Jan Decaluwe === Easics ===
Design Manager === VHDL-based ASIC design services ===
Tel: +32-16-395 600 ===================================
Fax: +32-16-395 619 Interleuvenlaan 86, B-3001 Leuven, BELGIUM
mailto:jand at easics.be http://www.easics.com