From lists at net-labs.de Tue Apr 1 15:19:19 2008 From: lists at net-labs.de (Ulrich Eck) Date: Tue, 1 Apr 2008 15:19:19 +0200 Subject: [Python.NET] Problems using Python.net in a TurboGears App on ubuntu/mono Message-ID: Hi all, i'm trying to use the C#-Library iTextSharp within a TurboGears Application. the most convenient way would be, to use pythonnet to access the needed methods of the c#-library. but .. i get a Segfault when trying to use clr imports: executed with: "mono python.exe start-netdemo.py" -------------------------- #!/usr/bin/python # -*- coding: utf-8 -*- """Start script for the netdemo TurboGears project. This script is only needed during development for running from the project directory. When the project is installed, easy_install will create a proper start script. """ import clr import System import sys from netdemo.commands import start, ConfigurationError if __name__ == "__main__": try: start() except ConfigurationError, exc: sys.stderr.write(str(exc)) sys.exit(1) --------------- the following traceback is produced - can anyone suggest, how to debug or find a solution - my expectation is, that there is some trouble with threading, but this is just guessing. pythonnet basically works, i can import from iTextSharp using the interpreter-cli. ----------------- root at wwdev:/data/develop/test/netdemo# mono python.exe start-netdemo.py Stacktrace: at (wrapper managed-to-native) Python.Runtime.Runtime.PyInt_FromLong (intptr) <0x00004> at (wrapper managed-to-native) Python.Runtime.Runtime.PyInt_FromLong (intptr) <0xffffffff> at Python.Runtime.Runtime.PyInt_FromInt32 (int) <0x0002f> at Python.Runtime.Runtime.Initialize () <0x00234> at Python.Runtime.PythonEngine.Initialize () <0x0002f> at (wrapper runtime-invoke) System.Object.runtime_invoke_void (object,intptr,intptr,intptr) <0xffffffff> Native stacktrace: /usr/lib/libmono.so.0 [0xb7b096c6] /usr/lib/libmono.so.0 [0xb7adbe96] [0xffffe440] [0xb6f69681] [0xb6f69630] [0xb71e267d] [0xb71dc790] [0xb71dc6f0] /usr/lib/libmono.so.0 [0xb7adbcc6] /usr/lib/libmono.so.0(mono_runtime_invoke+0x33) [0xb7b6f88e] /usr/lib/python2.5/site-packages/clr.so(main_thread_handler +0xc6) [0xb7cbde16] /usr/lib/python2.5/site-packages/clr.so(PyNet_Init+0x7f) [0xb7cbdf7f] /usr/lib/python2.5/site-packages/clr.so(initclr+0x76) [0xb7cbdc46] /usr/bin/python(_PyImport_LoadDynamicModule+0xa4) [0x80e1a34] /usr/bin/python [0x80df6d5] /usr/bin/python [0x80df98b] /usr/bin/python [0x80dfe3e] /usr/bin/python [0x80e0068] /usr/bin/python(PyImport_ImportModuleLevel+0x27) [0x80e04f7] /usr/bin/python [0x80c1db4] /usr/bin/python(PyObject_Call+0x27) [0x805c9e7] /usr/bin/python(PyEval_CallObjectWithKeywords+0x6c) [0x80c232c] /usr/bin/python(PyEval_EvalFrameEx+0x18bd) [0x80c4a9d] /usr/bin/python(PyEval_EvalCodeEx+0x775) [0x80ca115] /usr/bin/python(PyEval_EvalCode+0x57) [0x80ca187] /usr/bin/python(PyRun_FileExFlags+0xf8) [0x80e9698] /usr/bin/python(PyRun_SimpleFileExFlags+0x187) [0x80e9927] /usr/bin/python(Py_Main+0x9c0) [0x8059390] /usr/bin/python(main+0x22) [0x80588c2] /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe0) [0xb7d9f050] /usr/bin/python [0x8058831] Debug info from gdb: Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1". [Thread debugging using libthread_db enabled] [New Thread -1210545984 (LWP 8343)] [New Thread -1222792304 (LWP 8345)] [New Thread -1222710384 (LWP 8344)] 0xffffe410 in __kernel_vsyscall () 3 Thread -1222710384 (LWP 8344) 0xffffe410 in __kernel_vsyscall () 2 Thread -1222792304 (LWP 8345) 0xffffe410 in __kernel_vsyscall () 1 Thread -1210545984 (LWP 8343) 0xffffe410 in __kernel_vsyscall () Thread 3 (Thread -1222710384 (LWP 8344)): #0 0xffffe410 in __kernel_vsyscall () #1 0xb7f0d9f6 in ?? () from /lib/tls/i686/cmov/libpthread.so.0 #2 0xb7bec7db in ?? () from /usr/lib/libmono.so.0 #3 0xb71ee3cc in ?? () #4 0x00000000 in ?? () Thread 2 (Thread -1222792304 (LWP 8345)): #0 0xffffe410 in __kernel_vsyscall () #1 0xb7f0a676 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/i686/cmov/libpthread.so.0 #2 0xb7bf191e in ?? () from /usr/lib/libmono.so.0 #3 0xb76c81dc in ?? () #4 0xb76c81c4 in ?? () #5 0xb7f08541 in pthread_mutex_lock () from /lib/tls/i686/cmov/ libpthread.so.0 #6 0xb7bf1c2b in ?? () from /usr/lib/libmono.so.0 #7 0xb76c81dc in ?? () #8 0xb76c81c4 in ?? () #9 0x00000000 in ?? () Thread 1 (Thread -1210545984 (LWP 8343)): #0 0xffffe410 in __kernel_vsyscall () #1 0xb7e552a1 in select () from /lib/tls/i686/cmov/libc.so.6 #2 0xb7a36780 in g_spawn_sync () from /usr/lib/libglib-2.0.so.0 #3 0xb7a36b4c in g_spawn_command_line_sync () from /usr/lib/ libglib-2.0.so.0 #4 0xb7b097ad in ?? () from /usr/lib/libmono.so.0 #5 0xb797f840 in ?? () #6 0xb797f828 in ?? () #7 0xb797f824 in ?? () #8 0xb797f820 in ?? () #9 0x00000000 in ?? () #0 0xffffe410 in __kernel_vsyscall () ================================================================= Got a SIGSEGV while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application. ================================================================= 2008-04-01 15:10:11,740 cherrypy.msg INFO ENGINE: SystemExit raised: shutting down autoreloader 2008-04-01 15:10:11,741 cherrypy.msg INFO HTTP: HTTP Server shut down 2008-04-01 15:10:11,746 cherrypy.msg INFO ENGINE: CherryPy shut down ----------------- Do i need to do special things (like pythoncom->CoInitialize) when using pythonnet in a multithreaded environment ? thanks for all your hints - i'ld try to avoid using python and ironpython together with pyro ;-) or worse, code the itext-stuff in c# and call it from the cmd-line ;-) cheers Ulrich From brian.lloyd at revolutionhealth.com Tue Apr 1 15:50:34 2008 From: brian.lloyd at revolutionhealth.com (Brian Lloyd) Date: Tue, 01 Apr 2008 09:50:34 -0400 Subject: [Python.NET] Problems using Python.net in a TurboGears App on ubuntu/mono In-Reply-To: Message-ID: Any chance you're on a 64-bit system? If not, I suspect that the mono runtime is running in STA threading (which means you can't call it from other threads, generally). If so, you may be able to find a way to get mono to run in MTA (I don't know the details of how you would do that though). sorry-that's-probably-not-too-helpful'ly, Brian On 4/1/08 9:19 AM, "Ulrich Eck" wrote: > Hi all, > > i'm trying to use the C#-Library iTextSharp within a TurboGears > Application. > > the most convenient way would be, to use pythonnet to access the > needed methods of the c#-library. > > but .. i get a Segfault when trying to use clr imports: > > executed with: "mono python.exe start-netdemo.py" > > -------------------------- > #!/usr/bin/python > # -*- coding: utf-8 -*- > """Start script for the netdemo TurboGears project. > > This script is only needed during development for running from the > project > directory. When the project is installed, easy_install will create a > proper start script. > """ > > import clr > import System > > import sys > from netdemo.commands import start, ConfigurationError > > if __name__ == "__main__": > try: > start() > except ConfigurationError, exc: > sys.stderr.write(str(exc)) > sys.exit(1) > --------------- > > > the following traceback is produced - can anyone suggest, how to debug > or find a solution - my expectation is, that there is some trouble > with threading, but this is just guessing. pythonnet basically works, > i can import from iTextSharp using the interpreter-cli. > > ----------------- > root at wwdev:/data/develop/test/netdemo# mono python.exe start-netdemo.py > Stacktrace: > > at (wrapper managed-to-native) > Python.Runtime.Runtime.PyInt_FromLong (intptr) <0x00004> > at (wrapper managed-to-native) > Python.Runtime.Runtime.PyInt_FromLong (intptr) <0xffffffff> > at Python.Runtime.Runtime.PyInt_FromInt32 (int) <0x0002f> > at Python.Runtime.Runtime.Initialize () <0x00234> > at Python.Runtime.PythonEngine.Initialize () <0x0002f> > at (wrapper runtime-invoke) System.Object.runtime_invoke_void > (object,intptr,intptr,intptr) <0xffffffff> > > Native stacktrace: > > /usr/lib/libmono.so.0 [0xb7b096c6] > /usr/lib/libmono.so.0 [0xb7adbe96] > [0xffffe440] > [0xb6f69681] > [0xb6f69630] > [0xb71e267d] > [0xb71dc790] > [0xb71dc6f0] > /usr/lib/libmono.so.0 [0xb7adbcc6] > /usr/lib/libmono.so.0(mono_runtime_invoke+0x33) [0xb7b6f88e] > /usr/lib/python2.5/site-packages/clr.so(main_thread_handler > +0xc6) [0xb7cbde16] > /usr/lib/python2.5/site-packages/clr.so(PyNet_Init+0x7f) > [0xb7cbdf7f] > /usr/lib/python2.5/site-packages/clr.so(initclr+0x76) > [0xb7cbdc46] > /usr/bin/python(_PyImport_LoadDynamicModule+0xa4) [0x80e1a34] > /usr/bin/python [0x80df6d5] > /usr/bin/python [0x80df98b] > /usr/bin/python [0x80dfe3e] > /usr/bin/python [0x80e0068] > /usr/bin/python(PyImport_ImportModuleLevel+0x27) [0x80e04f7] > /usr/bin/python [0x80c1db4] > /usr/bin/python(PyObject_Call+0x27) [0x805c9e7] > /usr/bin/python(PyEval_CallObjectWithKeywords+0x6c) [0x80c232c] > /usr/bin/python(PyEval_EvalFrameEx+0x18bd) [0x80c4a9d] > /usr/bin/python(PyEval_EvalCodeEx+0x775) [0x80ca115] > /usr/bin/python(PyEval_EvalCode+0x57) [0x80ca187] > /usr/bin/python(PyRun_FileExFlags+0xf8) [0x80e9698] > /usr/bin/python(PyRun_SimpleFileExFlags+0x187) [0x80e9927] > /usr/bin/python(Py_Main+0x9c0) [0x8059390] > /usr/bin/python(main+0x22) [0x80588c2] > /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe0) > [0xb7d9f050] > /usr/bin/python [0x8058831] > > Debug info from gdb: > > Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1". > [Thread debugging using libthread_db enabled] > [New Thread -1210545984 (LWP 8343)] > [New Thread -1222792304 (LWP 8345)] > [New Thread -1222710384 (LWP 8344)] > 0xffffe410 in __kernel_vsyscall () > 3 Thread -1222710384 (LWP 8344) 0xffffe410 in __kernel_vsyscall () > 2 Thread -1222792304 (LWP 8345) 0xffffe410 in __kernel_vsyscall () > 1 Thread -1210545984 (LWP 8343) 0xffffe410 in __kernel_vsyscall () > > Thread 3 (Thread -1222710384 (LWP 8344)): > #0 0xffffe410 in __kernel_vsyscall () > #1 0xb7f0d9f6 in ?? () from /lib/tls/i686/cmov/libpthread.so.0 > #2 0xb7bec7db in ?? () from /usr/lib/libmono.so.0 > #3 0xb71ee3cc in ?? () > #4 0x00000000 in ?? () > > Thread 2 (Thread -1222792304 (LWP 8345)): > #0 0xffffe410 in __kernel_vsyscall () > #1 0xb7f0a676 in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/tls/i686/cmov/libpthread.so.0 > #2 0xb7bf191e in ?? () from /usr/lib/libmono.so.0 > #3 0xb76c81dc in ?? () > #4 0xb76c81c4 in ?? () > #5 0xb7f08541 in pthread_mutex_lock () from /lib/tls/i686/cmov/ > libpthread.so.0 > #6 0xb7bf1c2b in ?? () from /usr/lib/libmono.so.0 > #7 0xb76c81dc in ?? () > #8 0xb76c81c4 in ?? () > #9 0x00000000 in ?? () > > Thread 1 (Thread -1210545984 (LWP 8343)): > #0 0xffffe410 in __kernel_vsyscall () > #1 0xb7e552a1 in select () from /lib/tls/i686/cmov/libc.so.6 > #2 0xb7a36780 in g_spawn_sync () from /usr/lib/libglib-2.0.so.0 > #3 0xb7a36b4c in g_spawn_command_line_sync () from /usr/lib/ > libglib-2.0.so.0 > #4 0xb7b097ad in ?? () from /usr/lib/libmono.so.0 > #5 0xb797f840 in ?? () > #6 0xb797f828 in ?? () > #7 0xb797f824 in ?? () > #8 0xb797f820 in ?? () > #9 0x00000000 in ?? () > #0 0xffffe410 in __kernel_vsyscall () > > > ================================================================= > Got a SIGSEGV while executing native code. This usually indicates > a fatal error in the mono runtime or one of the native libraries > used by your application. > ================================================================= > > 2008-04-01 15:10:11,740 cherrypy.msg INFO ENGINE: SystemExit raised: > shutting down autoreloader > 2008-04-01 15:10:11,741 cherrypy.msg INFO HTTP: HTTP Server shut down > 2008-04-01 15:10:11,746 cherrypy.msg INFO ENGINE: CherryPy shut down > ----------------- > > > Do i need to do special things (like pythoncom->CoInitialize) when > using pythonnet in a multithreaded environment ? > > thanks for all your hints - i'ld try to avoid using python and > ironpython together with pyro ;-) or worse, code the itext-stuff in c# > and > call it from the cmd-line ;-) > > cheers Ulrich > > > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet -------------------------- Brian Lloyd brian.lloyd at revolutionhealth.com From chris.fraschetti at houghton.edu Tue Apr 1 18:04:41 2008 From: chris.fraschetti at houghton.edu (Christopher Fraschetti) Date: Tue, 1 Apr 2008 12:04:41 -0400 Subject: [Python.NET] PythonHome property referencing Python folder Message-ID: <47F25D19.9070908@houghton.edu> Hello, I am attempting to package Python with a .Net application and would like to run the packaged version of python that I have using Python for .Net. In other words, python will not be officially installed on the client but will be reference with the .Net package. Is there a way to set PythonEngine to use a specific location for PythonHome. It seems obvious that the Python.Engine.PythonHome property (Read/Write property) could be written with the folder containing the Python folder I would like to use but when I try writing the property, initializing the engine and then read the PythonHome it says the property contains "-4z". Also... it does not work. After initialization I try to import a module and it returns a null value. Here is some code: PythonEngine.PythonHome = "c:\\Python25"; //Not officially installed. Just a folder containing a python implementation. PythonEngine.Initialize(); PyObject appModule = PythonEngine.ImportModule("app"); //app.py found in root folder of .Net application PyObject startApplication = appModule.GetAttr("startApplication"); PyObject app = startApplication.Invoke() This does work with an officially installed version of Python (barring the change in PythonHome) but does not work just putting the Python25 folder in the given location and referencing it with the PythonHome property. So, is this the correct use of the property? Is there any way to accomplish what I am attempting to do? Thanks in advance for any insight. Chris From JBurnett at blizzard.com Tue Apr 1 19:29:23 2008 From: JBurnett at blizzard.com (John Burnett) Date: Tue, 1 Apr 2008 10:29:23 -0700 Subject: [Python.NET] Problems using Python.net in a TurboGears App onubuntu/mono In-Reply-To: References: Message-ID: <44055E60E3A2174080A3086D5CD4D03903C64619@BL-EXCHANGE.corp.blizzard.net> If you're not already doing this, you *might* want to grab the source from the svn repository and make your own build, as opposed to using the source/binaries available in the zip download. There's a fair amount of change in the repo now... not sure if it'll help though. Probably not :) -----Original Message----- From: pythondotnet-bounces at python.org [mailto:pythondotnet-bounces at python.org] On Behalf Of Ulrich Eck Sent: Tuesday, April 01, 2008 6:19 AM To: pythondotnet at python.org Subject: [Python.NET] Problems using Python.net in a TurboGears App onubuntu/mono Hi all, i'm trying to use the C#-Library iTextSharp within a TurboGears Application. the most convenient way would be, to use pythonnet to access the needed methods of the c#-library. but .. i get a Segfault when trying to use clr imports: executed with: "mono python.exe start-netdemo.py" -------------------------- #!/usr/bin/python # -*- coding: utf-8 -*- """Start script for the netdemo TurboGears project. This script is only needed during development for running from the project directory. When the project is installed, easy_install will create a proper start script. """ import clr import System import sys from netdemo.commands import start, ConfigurationError if __name__ == "__main__": try: start() except ConfigurationError, exc: sys.stderr.write(str(exc)) sys.exit(1) --------------- the following traceback is produced - can anyone suggest, how to debug or find a solution - my expectation is, that there is some trouble with threading, but this is just guessing. pythonnet basically works, i can import from iTextSharp using the interpreter-cli. ----------------- root at wwdev:/data/develop/test/netdemo# mono python.exe start-netdemo.py Stacktrace: at (wrapper managed-to-native) Python.Runtime.Runtime.PyInt_FromLong (intptr) <0x00004> at (wrapper managed-to-native) Python.Runtime.Runtime.PyInt_FromLong (intptr) <0xffffffff> at Python.Runtime.Runtime.PyInt_FromInt32 (int) <0x0002f> at Python.Runtime.Runtime.Initialize () <0x00234> at Python.Runtime.PythonEngine.Initialize () <0x0002f> at (wrapper runtime-invoke) System.Object.runtime_invoke_void (object,intptr,intptr,intptr) <0xffffffff> Native stacktrace: /usr/lib/libmono.so.0 [0xb7b096c6] /usr/lib/libmono.so.0 [0xb7adbe96] [0xffffe440] [0xb6f69681] [0xb6f69630] [0xb71e267d] [0xb71dc790] [0xb71dc6f0] /usr/lib/libmono.so.0 [0xb7adbcc6] /usr/lib/libmono.so.0(mono_runtime_invoke+0x33) [0xb7b6f88e] /usr/lib/python2.5/site-packages/clr.so(main_thread_handler +0xc6) [0xb7cbde16] /usr/lib/python2.5/site-packages/clr.so(PyNet_Init+0x7f) [0xb7cbdf7f] /usr/lib/python2.5/site-packages/clr.so(initclr+0x76) [0xb7cbdc46] /usr/bin/python(_PyImport_LoadDynamicModule+0xa4) [0x80e1a34] /usr/bin/python [0x80df6d5] /usr/bin/python [0x80df98b] /usr/bin/python [0x80dfe3e] /usr/bin/python [0x80e0068] /usr/bin/python(PyImport_ImportModuleLevel+0x27) [0x80e04f7] /usr/bin/python [0x80c1db4] /usr/bin/python(PyObject_Call+0x27) [0x805c9e7] /usr/bin/python(PyEval_CallObjectWithKeywords+0x6c) [0x80c232c] /usr/bin/python(PyEval_EvalFrameEx+0x18bd) [0x80c4a9d] /usr/bin/python(PyEval_EvalCodeEx+0x775) [0x80ca115] /usr/bin/python(PyEval_EvalCode+0x57) [0x80ca187] /usr/bin/python(PyRun_FileExFlags+0xf8) [0x80e9698] /usr/bin/python(PyRun_SimpleFileExFlags+0x187) [0x80e9927] /usr/bin/python(Py_Main+0x9c0) [0x8059390] /usr/bin/python(main+0x22) [0x80588c2] /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe0) [0xb7d9f050] /usr/bin/python [0x8058831] Debug info from gdb: Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1". [Thread debugging using libthread_db enabled] [New Thread -1210545984 (LWP 8343)] [New Thread -1222792304 (LWP 8345)] [New Thread -1222710384 (LWP 8344)] 0xffffe410 in __kernel_vsyscall () 3 Thread -1222710384 (LWP 8344) 0xffffe410 in __kernel_vsyscall () 2 Thread -1222792304 (LWP 8345) 0xffffe410 in __kernel_vsyscall () 1 Thread -1210545984 (LWP 8343) 0xffffe410 in __kernel_vsyscall () Thread 3 (Thread -1222710384 (LWP 8344)): #0 0xffffe410 in __kernel_vsyscall () #1 0xb7f0d9f6 in ?? () from /lib/tls/i686/cmov/libpthread.so.0 #2 0xb7bec7db in ?? () from /usr/lib/libmono.so.0 #3 0xb71ee3cc in ?? () #4 0x00000000 in ?? () Thread 2 (Thread -1222792304 (LWP 8345)): #0 0xffffe410 in __kernel_vsyscall () #1 0xb7f0a676 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/i686/cmov/libpthread.so.0 #2 0xb7bf191e in ?? () from /usr/lib/libmono.so.0 #3 0xb76c81dc in ?? () #4 0xb76c81c4 in ?? () #5 0xb7f08541 in pthread_mutex_lock () from /lib/tls/i686/cmov/ libpthread.so.0 #6 0xb7bf1c2b in ?? () from /usr/lib/libmono.so.0 #7 0xb76c81dc in ?? () #8 0xb76c81c4 in ?? () #9 0x00000000 in ?? () Thread 1 (Thread -1210545984 (LWP 8343)): #0 0xffffe410 in __kernel_vsyscall () #1 0xb7e552a1 in select () from /lib/tls/i686/cmov/libc.so.6 #2 0xb7a36780 in g_spawn_sync () from /usr/lib/libglib-2.0.so.0 #3 0xb7a36b4c in g_spawn_command_line_sync () from /usr/lib/ libglib-2.0.so.0 #4 0xb7b097ad in ?? () from /usr/lib/libmono.so.0 #5 0xb797f840 in ?? () #6 0xb797f828 in ?? () #7 0xb797f824 in ?? () #8 0xb797f820 in ?? () #9 0x00000000 in ?? () #0 0xffffe410 in __kernel_vsyscall () ================================================================= Got a SIGSEGV while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application. ================================================================= 2008-04-01 15:10:11,740 cherrypy.msg INFO ENGINE: SystemExit raised: shutting down autoreloader 2008-04-01 15:10:11,741 cherrypy.msg INFO HTTP: HTTP Server shut down 2008-04-01 15:10:11,746 cherrypy.msg INFO ENGINE: CherryPy shut down ----------------- Do i need to do special things (like pythoncom->CoInitialize) when using pythonnet in a multithreaded environment ? thanks for all your hints - i'ld try to avoid using python and ironpython together with pyro ;-) or worse, code the itext-stuff in c# and call it from the cmd-line ;-) cheers Ulrich _________________________________________________ Python.NET mailing list - PythonDotNet at python.org http://mail.python.org/mailman/listinfo/pythondotnet From lists at net-labs.de Tue Apr 1 21:01:47 2008 From: lists at net-labs.de (Ulrich Eck) Date: Tue, 1 Apr 2008 21:01:47 +0200 Subject: [Python.NET] Problems using Python.net in a TurboGears App onubuntu/mono In-Reply-To: <44055E60E3A2174080A3086D5CD4D03903C64619@BL-EXCHANGE.corp.blizzard.net> References: <44055E60E3A2174080A3086D5CD4D03903C64619@BL-EXCHANGE.corp.blizzard.net> Message-ID: Hi John, Hi Brian, thanks for your replies, i was already using a self-compiled pythonnet svn-checkout with ubuntu- python2.5 and -mono1.2.4 binaries. The stuff is running on an ubuntu 32-Bit linux server inside a virtual machine (vmware). I think i have solved the issue relatively simple: now i use the python2.5 binary from src/monoclr which says that it's compiled due tue the fact, that ubuntu python-binaries aren't linked against libpython2.5.so. with just using the dynamically linked version: #./pyhton2.5 my-server.py the system doesn't crash anymore - it doesn't behave exactly like IronPython (for example when passing str's to clr-methods, the overloading doesn't recognize them correctly) but i can workaround that. so .. let's go ahead and dive deeper ;-) thank you very much! cheers Ulrich Am 01.04.2008 um 19:29 schrieb John Burnett: > If you're not already doing this, you *might* want to grab the > source from the svn repository and make your own build, as opposed > to using the source/binaries available in the zip download. There's > a fair amount of change in the repo now... not sure if it'll help > though. > > Probably not :) > > > -----Original Message----- > From: pythondotnet-bounces at python.org [mailto:pythondotnet-bounces at python.org > ] On Behalf Of Ulrich Eck > Sent: Tuesday, April 01, 2008 6:19 AM > To: pythondotnet at python.org > Subject: [Python.NET] Problems using Python.net in a TurboGears App > onubuntu/mono > > Hi all, > > i'm trying to use the C#-Library iTextSharp within a TurboGears > Application. > > the most convenient way would be, to use pythonnet to access the > needed methods of the c#-library. > > but .. i get a Segfault when trying to use clr imports: > > executed with: "mono python.exe start-netdemo.py" > > -------------------------- > #!/usr/bin/python > # -*- coding: utf-8 -*- > """Start script for the netdemo TurboGears project. > > This script is only needed during development for running from the > project > directory. When the project is installed, easy_install will create a > proper start script. > """ > > import clr > import System > > import sys > from netdemo.commands import start, ConfigurationError > > if __name__ == "__main__": > try: > start() > except ConfigurationError, exc: > sys.stderr.write(str(exc)) > sys.exit(1) > --------------- > > > the following traceback is produced - can anyone suggest, how to debug > or find a solution - my expectation is, that there is some trouble > with threading, but this is just guessing. pythonnet basically works, > i can import from iTextSharp using the interpreter-cli. > > ----------------- > root at wwdev:/data/develop/test/netdemo# mono python.exe start- > netdemo.py > Stacktrace: > > at (wrapper managed-to-native) > Python.Runtime.Runtime.PyInt_FromLong (intptr) <0x00004> > at (wrapper managed-to-native) > Python.Runtime.Runtime.PyInt_FromLong (intptr) <0xffffffff> > at Python.Runtime.Runtime.PyInt_FromInt32 (int) <0x0002f> > at Python.Runtime.Runtime.Initialize () <0x00234> > at Python.Runtime.PythonEngine.Initialize () <0x0002f> > at (wrapper runtime-invoke) System.Object.runtime_invoke_void > (object,intptr,intptr,intptr) <0xffffffff> > > Native stacktrace: > > /usr/lib/libmono.so.0 [0xb7b096c6] > /usr/lib/libmono.so.0 [0xb7adbe96] > [0xffffe440] > [0xb6f69681] > [0xb6f69630] > [0xb71e267d] > [0xb71dc790] > [0xb71dc6f0] > /usr/lib/libmono.so.0 [0xb7adbcc6] > /usr/lib/libmono.so.0(mono_runtime_invoke+0x33) [0xb7b6f88e] > /usr/lib/python2.5/site-packages/clr.so(main_thread_handler > +0xc6) [0xb7cbde16] > /usr/lib/python2.5/site-packages/clr.so(PyNet_Init+0x7f) > [0xb7cbdf7f] > /usr/lib/python2.5/site-packages/clr.so(initclr+0x76) > [0xb7cbdc46] > /usr/bin/python(_PyImport_LoadDynamicModule+0xa4) [0x80e1a34] > /usr/bin/python [0x80df6d5] > /usr/bin/python [0x80df98b] > /usr/bin/python [0x80dfe3e] > /usr/bin/python [0x80e0068] > /usr/bin/python(PyImport_ImportModuleLevel+0x27) [0x80e04f7] > /usr/bin/python [0x80c1db4] > /usr/bin/python(PyObject_Call+0x27) [0x805c9e7] > /usr/bin/python(PyEval_CallObjectWithKeywords+0x6c) > [0x80c232c] > /usr/bin/python(PyEval_EvalFrameEx+0x18bd) [0x80c4a9d] > /usr/bin/python(PyEval_EvalCodeEx+0x775) [0x80ca115] > /usr/bin/python(PyEval_EvalCode+0x57) [0x80ca187] > /usr/bin/python(PyRun_FileExFlags+0xf8) [0x80e9698] > /usr/bin/python(PyRun_SimpleFileExFlags+0x187) [0x80e9927] > /usr/bin/python(Py_Main+0x9c0) [0x8059390] > /usr/bin/python(main+0x22) [0x80588c2] > /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe0) > [0xb7d9f050] > /usr/bin/python [0x8058831] > > Debug info from gdb: > > Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so. > 1". > [Thread debugging using libthread_db enabled] > [New Thread -1210545984 (LWP 8343)] > [New Thread -1222792304 (LWP 8345)] > [New Thread -1222710384 (LWP 8344)] > 0xffffe410 in __kernel_vsyscall () > 3 Thread -1222710384 (LWP 8344) 0xffffe410 in __kernel_vsyscall () > 2 Thread -1222792304 (LWP 8345) 0xffffe410 in __kernel_vsyscall () > 1 Thread -1210545984 (LWP 8343) 0xffffe410 in __kernel_vsyscall () > > Thread 3 (Thread -1222710384 (LWP 8344)): > #0 0xffffe410 in __kernel_vsyscall () > #1 0xb7f0d9f6 in ?? () from /lib/tls/i686/cmov/libpthread.so.0 > #2 0xb7bec7db in ?? () from /usr/lib/libmono.so.0 > #3 0xb71ee3cc in ?? () > #4 0x00000000 in ?? () > > Thread 2 (Thread -1222792304 (LWP 8345)): > #0 0xffffe410 in __kernel_vsyscall () > #1 0xb7f0a676 in pthread_cond_wait@@GLIBC_2.3.2 () > from /lib/tls/i686/cmov/libpthread.so.0 > #2 0xb7bf191e in ?? () from /usr/lib/libmono.so.0 > #3 0xb76c81dc in ?? () > #4 0xb76c81c4 in ?? () > #5 0xb7f08541 in pthread_mutex_lock () from /lib/tls/i686/cmov/ > libpthread.so.0 > #6 0xb7bf1c2b in ?? () from /usr/lib/libmono.so.0 > #7 0xb76c81dc in ?? () > #8 0xb76c81c4 in ?? () > #9 0x00000000 in ?? () > > Thread 1 (Thread -1210545984 (LWP 8343)): > #0 0xffffe410 in __kernel_vsyscall () > #1 0xb7e552a1 in select () from /lib/tls/i686/cmov/libc.so.6 > #2 0xb7a36780 in g_spawn_sync () from /usr/lib/libglib-2.0.so.0 > #3 0xb7a36b4c in g_spawn_command_line_sync () from /usr/lib/ > libglib-2.0.so.0 > #4 0xb7b097ad in ?? () from /usr/lib/libmono.so.0 > #5 0xb797f840 in ?? () > #6 0xb797f828 in ?? () > #7 0xb797f824 in ?? () > #8 0xb797f820 in ?? () > #9 0x00000000 in ?? () > #0 0xffffe410 in __kernel_vsyscall () > > > ================================================================= > Got a SIGSEGV while executing native code. This usually indicates > a fatal error in the mono runtime or one of the native libraries > used by your application. > ================================================================= > > 2008-04-01 15:10:11,740 cherrypy.msg INFO ENGINE: SystemExit raised: > shutting down autoreloader > 2008-04-01 15:10:11,741 cherrypy.msg INFO HTTP: HTTP Server shut down > 2008-04-01 15:10:11,746 cherrypy.msg INFO ENGINE: CherryPy shut down > ----------------- > > > Do i need to do special things (like pythoncom->CoInitialize) when > using pythonnet in a multithreaded environment ? > > thanks for all your hints - i'ld try to avoid using python and > ironpython together with pyro ;-) or worse, code the itext-stuff in c# > and > call it from the cmd-line ;-) > > cheers Ulrich > > > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet From deus.verus at gmail.com Tue Apr 1 22:22:36 2008 From: deus.verus at gmail.com (Serge R) Date: Wed, 2 Apr 2008 06:22:36 +1000 Subject: [Python.NET] Problem invoking a method Message-ID: <18c139230804011322r10ab5c4eh75303c93dcd6e15c@mail.gmail.com> Hello everyone. This is my first time using any mailing list, I hope I did everything right. My issue is that I can't call InvokeMethod on an imported module because it always claims the member does not exist. Further investigation suggests that my module isn't being imported correctly at all, but instead I'm getting some 'bank'. C# end: PyObject module = PythonEngine.ImportModule("test"); Console.WriteLine(module.Dir()); module.InvokeMethod("testFunction", new PyTuple()); test.py: def testFunction(): print "hello" when the Dir gets printed, I don't see any testFunction. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20080402/cb9ae601/attachment.htm From dwoogle at gmail.com Wed Apr 2 22:56:36 2008 From: dwoogle at gmail.com (David Welden) Date: Wed, 2 Apr 2008 15:56:36 -0500 Subject: [Python.NET] Dynamic Web Service Helpers Message-ID: Has anyone successfully used the IronPython Dynamic Web Service Helpers ( http://www.codeplex.com/IronPython/Release/ProjectReleases.aspx?ReleaseId=47) assembly with Python.Net? Here is what I get: >>> import clr >>> clr.FindAssembly("DynamicWebServiceHelpers") u'DynamicWebServiceHelpers.dll' >>> clr.AddReference("DynamicWebServiceHelpers") >>> from DynamicWebServiceHelpers import * Traceback (most recent call last): File "", line 1, in ImportError: No module named DynamicWebServiceHelpers -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20080402/dbde0769/attachment.htm From brian.lloyd at revolutionhealth.com Thu Apr 3 03:40:17 2008 From: brian.lloyd at revolutionhealth.com (Brian Lloyd) Date: Wed, 2 Apr 2008 21:40:17 -0400 Subject: [Python.NET] Dynamic Web Service Helpers References: Message-ID: <1CCEDFD0D1FF43419A44DA69B60B996056C1A6@MI8NYCMAIL17.Mi8.com> is DynamicWebServiceHelpers the right namespace? Sure its not IronPython.DynamicWebServiceHelpers or something? The assembly name (AddReference) doesn't necessarily correspond to the namespaces contained within... -Brian ________________________________ From: pythondotnet-bounces at python.org on behalf of David Welden Sent: Wed 4/2/2008 4:56 PM To: pythondotnet at python.org Subject: [Python.NET] Dynamic Web Service Helpers Has anyone successfully used the IronPython Dynamic Web Service Helpers (http://www.codeplex.com/IronPython/Release/ProjectReleases.aspx?ReleaseId=47) assembly with Python.Net? Here is what I get: >>> import clr >>> clr.FindAssembly("DynamicWebServiceHelpers") u'DynamicWebServiceHelpers.dll' >>> clr.AddReference("DynamicWebServiceHelpers") >>> from DynamicWebServiceHelpers import * Traceback (most recent call last): File "", line 1, in ImportError: No module named DynamicWebServiceHelpers -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20080402/b268c837/attachment.htm From dwoogle at gmail.com Thu Apr 3 16:51:47 2008 From: dwoogle at gmail.com (David Welden) Date: Thu, 3 Apr 2008 09:51:47 -0500 Subject: [Python.NET] PythonDotNet Digest, Vol 53, Issue 3 In-Reply-To: References: Message-ID: I picked this up from http://blog.jonudell.net/2007/09/04/sharepoint-ironpython-and-another-lesson-in-the-virtue-of-laziness/. I am trying to use the same code as in the example. Message: 2 > Date: Wed, 2 Apr 2008 21:40:17 -0400 > From: "Brian Lloyd" > Subject: Re: [Python.NET] Dynamic Web Service Helpers > To: "David Welden" , > Message-ID: > <1CCEDFD0D1FF43419A44DA69B60B996056C1A6 at MI8NYCMAIL17.Mi8.com> > Content-Type: text/plain; charset="iso-8859-1" > > is DynamicWebServiceHelpers the right namespace? Sure its not > IronPython.DynamicWebServiceHelpers or something? > > The assembly name (AddReference) doesn't necessarily correspond > to the namespaces contained within... > > -Brian > > ________________________________ > > From: pythondotnet-bounces at python.org on behalf of David Welden > Sent: Wed 4/2/2008 4:56 PM > To: pythondotnet at python.org > Subject: [Python.NET] Dynamic Web Service Helpers > > > Has anyone successfully used the IronPython Dynamic Web Service Helpers ( > http://www.codeplex.com/IronPython/Release/ProjectReleases.aspx?ReleaseId=47) > assembly with Python.Net? Here is what I get: > > >>> import clr > >>> clr.FindAssembly("DynamicWebServiceHelpers") > u'DynamicWebServiceHelpers.dll' > >>> clr.AddReference("DynamicWebServiceHelpers") > > >>> from DynamicWebServiceHelpers import * > Traceback (most recent call last): > File "", line 1, in > ImportError: No module named DynamicWebServiceHelpers -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20080403/894fc563/attachment.htm From Jfrayne at blizzard.com Thu Apr 17 03:29:36 2008 From: Jfrayne at blizzard.com (Joe Frayne) Date: Wed, 16 Apr 2008 18:29:36 -0700 Subject: [Python.NET] Update to SVN: Mono 1.9 on Mac OS X fixes In-Reply-To: <44055E60E3A2174080A3086D5CD4D039035FE2B4@BL-EXCHANGE.corp.blizzard.net> References: <1c0b4a390802021952u59b4771k985134fa1ad887e2@mail.gmail.com> <44055E60E3A2174080A3086D5CD4D039035FE2B4@BL-EXCHANGE.corp.blizzard.net> Message-ID: <07A480006269DF4CA5433912783454F704FFAB01@BL-EXCHANGE.corp.blizzard.net> I spent the last few days working with a few people to get Python.NET working under Mono 1.9 on Mac OS X. I just checked in all the changes: -Added workaround to clrmod.c for Mono error: "Symbol not found: _environ" (a fix has been added to Mono SVN, according to Geoff Norton at Novell.) -Changed ordering of mono_config_parse(NULL) call in pynetinit.c, to handle latest changes to Mono embedding interface (a fix has been added to Mono SVN, according to Geoff Norton.) -Fixed TypeManager static constructor to properly handle .NET exceptions (thanks to Geoff Norton.) -Added to pynetinit.c to make clr.so search the site-packages folder of the currently running python to find the Python.Runtime.dll, instead of just the cwd (thanks to Peter Shinners and Wei Qiao at Blizzard Entertainment.) -Updated one of the Python.Runtime.dll.config files to map to .dylib instead of .so (thanks to Wei Qiao.) This should be looked at further, as there are a few of these files floating around... -Changed the Makefile to be self-contained and create the clr.so (thanks to Wei Qiao.) This should be looked at further, as running setup.py currently builds the clr.so, but gives an error afterwards. -Updated README.txt a bit more. Joe -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20080416/e2cb5072/attachment.htm From mtigges at gmail.com Fri Apr 25 21:01:38 2008 From: mtigges at gmail.com (Mark Tigges) Date: Fri, 25 Apr 2008 12:01:38 -0700 Subject: [Python.NET] problem with manifests Message-ID: I'm evaluating pythonnet to see if I should switch from IronPython. So far I'm liking what I'm seeing. I have one question though. I have a managed c++ dll which uses a unmanaged dll which makes use of OpenMP. I have to embed a manifest in my managed c++ dll so that any .exe knows how to get vcomp.dll (the openmp implementation) from the SxS cache. (I really have no idea what all that bullcr*p means, just what I've gleaned from researching the issue - there's something special about OpenMP in this regard.) So the manifest in the managed c++ dll looks like this: The second dependency node tells any exe from where to load openmp. All except the python.exe in python.net, this is extraordinarily frustrating. Ultimately though I can work around it, I can embed the OpenMP dependency in python.exe myself, but I'd rather not have to do that. It should just work. Does anyone who understands all this bullcr*p have any insight into what more I need to do to my managed c++ dll to make it work? BTW: Fantastic work on this project, I'm very impressed. Thanks, Mark. From lesser.evil at gmail.com Tue Apr 29 03:24:56 2008 From: lesser.evil at gmail.com (Shawn Edwards) Date: Mon, 28 Apr 2008 20:24:56 -0500 Subject: [Python.NET] Unbound methods from a .net assembly Message-ID: <8e4e956d0804281824h5ddc56dge4af7eddee33bb56@mail.gmail.com> I am trying to use the QuickCamLib library with Python.net. I looks like I'm not getting the .net library loaded right, but I'm new to Python.net and to .net in general, so I'm not sure I'm doing everything right. The quickcamlib is here: http://grazz.com/projects/quickcamlib Here's what I get on the shell: Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. **************************************************************** Personal firewall software may warn about the connection IDLE makes to its subprocess using this computer's internal loopback interface. This connection is not visible on any external interface and no data is sent to or received from the Internet. **************************************************************** IDLE 1.2.2 >>> import clr >>> import QuickCamLib >>> from QuickCamLib import QuickCam >>> dir(QuickCam) ['Capture', 'Dispose', 'Equals', 'Finalize', 'Focus', 'GetAvailableDevices', 'GetAvailableResolutions', 'GetHashCode', 'GetType', 'MemberwiseClone', 'Pan', 'ReferenceEquals', 'ResetPTZ', 'Tilt', 'ToString', 'Zoom', '__call__', '__class__', '__cmp__', '__delattr__', '__delitem__', '__doc__', '__getattribute__', '__getitem__', '__hash__', '__init__', '__iter__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__str__'] >>> QuickCam.GetAvailableDevices >>> for r in QuickCam.GetAvailableDevices: print r Traceback (most recent call last): File "", line 1, in for r in QuickCam.GetAvailableDevices: print r TypeError: 'MethodBinding' object is not iterable >>> from System.Drawing import Point >>> p = Point(5,5) >>> print p {X=5,Y=5} >>> (the "Point" stuff is there to show that Python.net seems to work for some objects, just not others) The 'unbound method' message is worrisome. Seems to me it should have done something instead of just complain that it is unbound. Lazy binding isn't usually this lazy :) I don't know enough about .net to really test this library any other way, so it is also possible the library is dorked up somehow. If I need to send more/different data, please let me know. Like I said, I'm new at a lot of this, so I'm likely missing something simple. Thanks in advance. -- Beware programmers with screwdrivers. Or, for that matter, any other mixed drink. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lesser.evil at gmail.com Tue Apr 29 03:45:51 2008 From: lesser.evil at gmail.com (Shawn Edwards) Date: Mon, 28 Apr 2008 20:45:51 -0500 Subject: [Python.NET] Unbound methods from a .net assembly In-Reply-To: References: <8e4e956d0804281824h5ddc56dge4af7eddee33bb56@mail.gmail.com> Message-ID: <8e4e956d0804281845u3c13aa28ke52d171293b554a8@mail.gmail.com> D'oh! I told you it was something stupid I was doing. Thanks for the kick in the head. On Mon, Apr 28, 2008 at 8:41 PM, Maksim Kozyarchuk < mkozyarchuk at funddevelopmentservices.com> wrote: > Shawn, > GetAvailableDevices is a method, you should be calling it. > > I.e. > for r in QuickCam.GetAvailableDevices(): print r > > Maksim > > > On 4/28/08 9:24 PM, "Shawn Edwards" wrote: > > I am trying to use the QuickCamLib library with Python.net. I looks like > I'm not getting the .net library loaded right, but I'm new to Python.net and > to .net in general, so I'm not sure I'm doing everything right. > > The quickcamlib is here: http://grazz.com/projects/quickcamlib > > Here's what I get on the shell: > > Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit > (Intel)] on win32 > Type "copyright", "credits" or "license()" for more information. > > **************************************************************** > Personal firewall software may warn about the connection IDLE > makes to its subprocess using this computer's internal loopback > interface. This connection is not visible on any external > interface and no data is sent to or received from the Internet. > **************************************************************** > > IDLE 1.2.2 > >>> import clr > >>> import QuickCamLib > >>> from QuickCamLib import QuickCam > >>> dir(QuickCam) > ['Capture', 'Dispose', 'Equals', 'Finalize', 'Focus', > 'GetAvailableDevices', 'GetAvailableResolutions', 'GetHashCode', 'GetType', > 'MemberwiseClone', 'Pan', 'ReferenceEquals', 'ResetPTZ', 'Tilt', 'ToString', > 'Zoom', '__call__', '__class__', '__cmp__', '__delattr__', '__delitem__', > '__doc__', '__getattribute__', '__getitem__', '__hash__', '__init__', > '__iter__', '__module__', '__new__', '__reduce__', '__reduce_ex__', > '__repr__', '__setattr__', '__setitem__', '__str__'] > >>> QuickCam.GetAvailableDevices > > >>> for r in QuickCam.GetAvailableDevices: print r > > > Traceback (most recent call last): > File "", line 1, in > for r in QuickCam.GetAvailableDevices: print r > TypeError: 'MethodBinding' object is not iterable > >>> from System.Drawing import Point > >>> p = Point(5,5) > >>> print p > {X=5,Y=5} > >>> > > (the "Point" stuff is there to show that Python.net seems to work for some > objects, just not others) > > The 'unbound method' message is worrisome. Seems to me it should have > done something instead of just complain that it is unbound. Lazy binding > isn't usually this lazy :) > > I don't know enough about .net to really test this library any other way, > so it is also possible the library is dorked up somehow. > > If I need to send more/different data, please let me know. Like I said, > I'm new at a lot of this, so I'm likely missing something simple. > > Thanks in advance. > > > -- Shawn Edwards Beware programmers with screwdrivers. Or, for that matter, any other mixed drink. -------------- next part -------------- An HTML attachment was scrubbed... URL: