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/2002-January/019708.html below:

[Python-Dev] Odd errors when catching ImportError

[Python-Dev] Odd errors when catching ImportError [Python-Dev] Odd errors when catching ImportErrorPaul Dubois paul@pfdubois.com
Wed, 30 Jan 2002 09:39:45 -0800
Please excuse me if this is in the bug list; I looked through it but the
list is too long for old people.

I have been running into a number of odd errors caused by code like the
following. The behavior seems to be machine dependent.

fooflag = 0
try:
    import foo
except ImportError:
    fooflag = 1

I have had this result in a seg fault upon exit, and also when something
like this was in file xxx.py inside a package, and the __init__.py did

from xxx import fooflag

I've had it tell me xxx had no attribute fooflag. I added "print fooflag" at
the bottom of the file and it fixed it. That was on a DEC. On Linux it
worked.

I suppose I should be testing for the ability to import foo some other way
but I don't know what it is.





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