[IronPython] Newbie questions & comments
Edward K. Ream
edreamleo at charter.net
Sun Dec 4 12:20:56 CET 2005
> To run Python script from the file, simply run:
> IronPythonConsole whatever.py
Something strange is happening when I do this. If I invoke
IronPythonConsole interactively, I can import winforms. But
something different happens when I execute a file. For example, suppose
ironPythonTest.py contains:
print 'Hello Iron Python!!'
import winforms
Possible bug 1: If I invoke IronPythonConsole like this:
C:\prog\IronPython-0.9.5\bin>IronPythonConsole ironPythonTest.py
I get:
Hello Iron Python!!
Unhandled Exception: No module named winforms
Possible bug 2: This generates the XP dialog: 'IronPythonConsole.exe has
encountered a problem and needs to close. We are sorry for the
inconvenience.'
Possible bug 3: The same XP dialog appears if the file does not exist.
Possible bug 4: Without a workable -i option it is difficult to run
IronPython from a batch file: the console goes away before it is possible to
see whatever exception caused IronPython to exist.
Anyway, any ideas about what is causing IronPython not to be able to import
winforms?
Edward
P.S. Here is a contents of the console illustrating this strange behavior:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\WINDOWS\system32>cd c:\prog\IronPython-0.9.5
C:\prog\IronPython-0.9.5>bin\IronPythonConsole.exe test.py
Unhandled Exception: System.IO.FileNotFoundException: Could not find file
'C:\prog\IronPython-0.9.5\test.py'.
File name: 'C:\prog\IronPython-0.9.5\test.py'
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess
access, Int32 rights, Boolean useRights, FileShare share, I
nt32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String
msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share)
at IronPython.AST.Parser.fromFile(String filename)
at IronPython.Hosting.PythonEngine.RunFileInNewModule(String fileName,
String moduleName)
at IronPython.Hosting.PythonEngine.RunFileInNewModule(String fileName)
at IronPythonConsole.PythonCommandLine.RunFile(PythonEngine engine,
String filename)
at IronPythonConsole.PythonCommandLine.Main(String[] rawArgs)
C:\prog\IronPython-0.9.5>bin\IronPythonConsole.exe ironPythonTest.py
Hello Iron Python!!
Unhandled Exception: No module named winforms
C:\prog\IronPython-0.9.5>
EKR
--------------------------------------------------------------------
Edward K. Ream email: edreamleo at charter.net
Leo: http://webpages.charter.net/edreamleo/front.html
--------------------------------------------------------------------
More information about the Ironpython-users
mailing list