|
This is actually a correct behavior (*).
The “from __future__ import division” is detected at compile-time,
which is what will affect the division IronPython uses in the given module.
However, the module will still try to import the module called “__future__”
at runtime. Since IronPython distribution doesn’t contain that module,
you’ll see the exception you are getting. What you can do is point
IronPython to the standard python library directory (for example C:\Python24\Lib)
and IronPython will find the __future__.py module which is part of standard Python.
The easy way to do this once and for all is to modify IronPython’s
site.py (the only file in the IronPython’s Lib directory): import sys sys.path.append(“C:\\Python24\\Lib”) (*) you can try similar trick with standard
Python. This snippet will clear the import search path so the import statement
will not find the module __future__.py, but the division behavior will still
get changed. Python 2.4.3 (#69, Mar 29 2006,
17:35:34) [MSC v.1310 32 bit (Intel)] on win32 Type "help",
"copyright", "credits" or "license" for more
information. >>> import sys >>> sys.path = [] >>> 1/2 0 >>> from __future__ import
division Traceback (most recent call last): File "<stdin>",
line 1, in ? ImportError: No module named __future__ >>> 1/2 0.5 >>> From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kristof Wagemans IronPython 1.0.2365 (Beta) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. >>> 1/2 0 >>> from __future__ import division Traceback (most recent call last): File , line 0, in <stdin>##3 File , line 0, in __import__##7 ImportError: No module named __future__ >>> 1/2 0.500 |
_______________________________________________ users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
