[IronPython] New User

JoeSox joesox at gmail.com
Thu Feb 23 23:01:16 CET 2006


I guess I should add more details, in case anyone is interested:

I believe I am importing everything Tkinter needs but I am not sure:

myMethod()
            PythonEngine engine = new PythonEngine();

            try
            {

                engine.SetVariable("IronPyTest", this);

                //Let the engine know what directories we are working in
                engine.AddToPath(Common.RuntimeDir);
                engine.AddToPath(Common.ConceptNetDir);
                engine.AddToPath(Common.Python24_LibDir);
                engine.AddToPath(Common.Python24_libsDir);
                engine.AddToPath(Common.montylinguaDir);

                //Natural Python24 Modules needed
                engine.Import("types");
                engine.Import("inspect");
                engine.Import("from repr import Repr");
                engine.Import("FixTk");
                engine.Import("from types import *");
                engine.Import("from Tkconstants import *");
                engine.Import("_tkinter");
                engine.Import("zlib");
                engine.Import("Tkinter");
                engine.Import("from Tkinter import *");

<snipped>....}


Here is the exception info:
=====
IronPython.Runtime.PythonImportError was unhandled
  Message="No module named Tkinter"
  Source="IronPython"
  StackTrace:
       at IronPython.Runtime.ReflectedMethodBase.Invoke(MethodBinding
binding) in C:\Documents and Settings\Joe\My Documents\Visual Studio
2005\Code Snippets\Visual
C#\IronPython-1.0-Beta3\Src\IronPython\Runtime\ReflectedMethod.cs:line
303
       at IronPython.Runtime.ReflectedMethodBase.TryCallWorker(Object[]
args, Object& ret) in C:\Documents and Settings\Joe\My
Documents\Visual Studio 2005\Code Snippets\Visual
C#\IronPython-1.0-Beta3\Src\IronPython\Runtime\ReflectedMethod.cs:line
477
       at IronPython.Runtime.ReflectedMethodBase.Call(Object[] args)
in C:\Documents and Settings\Joe\My Documents\Visual Studio 2005\Code
Snippets\Visual
C#\IronPython-1.0-Beta3\Src\IronPython\Runtime\ReflectedMethod.cs:line
134
       at IronPython.Runtime.ReflectedMethodBase.Call(ICallerContext
context, Object[] args) in C:\Documents and Settings\Joe\My
Documents\Visual Studio 2005\Code Snippets\Visual
C#\IronPython-1.0-Beta3\Src\IronPython\Runtime\ReflectedMethod.cs:line
124
       at IronPython.Runtime.Ops.CallWithContext(ICallerContext
context, Object func, Object[] args) in C:\Documents and
Settings\Joe\My Documents\Visual Studio 2005\Code Snippets\Visual
C#\IronPython-1.0-Beta3\Src\IronPython\Runtime\Ops.cs:line 823
       at IronPython.Runtime.Ops.CallWithContext(ICallerContext
context, Object func, Object arg0, Object arg1, Object arg2, Object
arg3) in C:\Documents and Settings\Joe\My Documents\Visual Studio
2005\Code Snippets\Visual
C#\IronPython-1.0-Beta3\Src\IronPython\Runtime\Ops.Generated.cs:line
155
       at IronPython.Runtime.Importer.Import(PythonModule mod, String
fullName, List from) in C:\Documents and Settings\Joe\My
Documents\Visual Studio 2005\Code Snippets\Visual
C#\IronPython-1.0-Beta3\Src\IronPython\Runtime\Importer.cs:line 40
       at IronPython.Runtime.Ops.ImportStar(PythonModule mod, String
fullName) in C:\Documents and Settings\Joe\My Documents\Visual Studio
2005\Code Snippets\Visual
C#\IronPython-1.0-Beta3\Src\IronPython\Runtime\Ops.cs:line 1407
       at tmp0.Initialize() in C:\Documents and Settings\Joe\My
Documents\Python Projects\conceptnet2.1\ConceptNetGUI.py:line 32
       at IronPython.Runtime.PythonModule.Initialize() in C:\Documents
and Settings\Joe\My Documents\Visual Studio 2005\Code Snippets\Visual
C#\IronPython-1.0-Beta3\Src\IronPython\Runtime\PythonModule.cs:line
126
       at IronPython.Hosting.PythonEngine.RunFile(String fileName) in
C:\Documents and Settings\Joe\My Documents\Visual Studio 2005\Code
Snippets\Visual
C#\IronPython-1.0-Beta3\Src\IronPython\Hosting\PythonEngine.cs:line
259
       at myIronPythonDemo.Form1.btPyBrowse_Click(Object sender,
EventArgs e) in C:\Documents and Settings\Joe\My Documents\Visual
Studio 2005\Projects\myIronPythonDemo\myIronPythonDemo\Form1.cs:line
142
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m,
MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32
reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at myIronPythonDemo.Program.Main() in C:\Documents and
Settings\Joe\My Documents\Visual Studio
2005\Projects\myIronPythonDemo\myIronPythonDemo\Program.cs:line 17
       at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
=====


And ConceptNetGUI.py:line 32 reads:

from Tkinter import *

--
Joseph



More information about the Ironpython-users mailing list