[Python.NET] Python.Runtime as a reference in my C# project

Guillaume Buisson guillaume.buisson at ubisoft.com
Tue May 12 16:04:27 CEST 2009


Hello

 

I'm trying to develop a python console in WPF : to do it I have to execute a C# string as a python expression.

When I initialize the python engine (python 2.6), I get an exception (incorrect format). If I delete the python26.dll, it is asking for it, so it must be a version issue but I really have no clue to solve it.

It turns out that the "Console" project inside pythonnet solution has the same issue.

 

Does it work for you?

 

Thanks

Guillaume

Ps:

System.BadImageFormatException was unhandled

  Message="Tentative de chargement d'un programme de format incorrect. (Exception de HRESULT : 0x8007000B)"

  Source="Python.Runtime"

  StackTrace:

       à Python.Runtime.Runtime.Py_Initialize()

       à Python.Runtime.Runtime.Initialize() dans D:\pythonnet\trunk\pythonnet\src\runtime\runtime.cs:ligne 70

       à Python.Runtime.PythonEngine.Initialize() dans D:\pythonnet\trunk\pythonnet\src\runtime\pythonengine.cs:ligne 118

       à Python.Runtime.PythonEngine.InitExt() dans D:\pythonnet\trunk\pythonnet\src\runtime\pythonengine.cs:ligne 150

       à ProtoCPython.Window1.Button_Click(Object sender, RoutedEventArgs e) dans C:\Users\guillaume.buisson\Documents\Visual Studio 2008\Projects\ProtoCPython\ProtoCPython\Window1.xaml.cs:ligne 29

       à System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)

       à System.Windows.UIElement.RaiseEventImpl(RoutedEventArgs args)

       à System.Windows.Controls.Button.OnClick()

       à System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)

       à System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)

       à System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)

       à System.Windows.UIElement.ReRaiseEventAs(RoutedEventArgs args, RoutedEvent newEvent)

       à System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)

       à System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)

       à System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)

       à System.Windows.UIElement.RaiseEventImpl(RoutedEventArgs args)

       à System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)

       à System.Windows.Input.InputManager.ProcessStagingArea()

       à System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)

       à System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)

       à System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)

       à System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

       à System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

       à MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

       à MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)

       à System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)

       à System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)

       à System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)

       à MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

       à MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)

       à System.Windows.Threading.Dispatcher.TranslateAndDispatchMessage(MSG& msg)

       à System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)

       à System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)

       à System.Windows.Application.RunInternal(Window window)

       à System.Windows.Application.Run(Window window)

       à ProtoCPython.App.Main() dans C:\Users\guillaume.buisson\Documents\Visual Studio 2008\Projects\ProtoCPython\ProtoCPython\obj\Debug\App.g.cs:ligne 0

       à System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)

       à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

       à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

       à System.Threading.ThreadHelper.ThreadStart()

  InnerException:

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythondotnet/attachments/20090512/0c86da0d/attachment.htm>


More information about the PythonDotNet mailing list