Calling Script from Command line not working

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri Sep 2 04:26:54 CEST 2011


En Mon, 29 Aug 2011 07:40:06 -0300, Sathish S <sathish at solitontech.com>  
escribió:

> We created a DLL using cygwin and have written a class based python  
> module
> for the same. We have created a sample script for the class based python
> module, that creates an object of the class and calls various methods in  
> the
> class. This Test script works fine while I run it from IDLE. However  
> when I
> run it from command prompt it either hangs or just returns without  
> executing
> the functions. When it returns I do not get a error trace.
>
> When I tried to findout where exactly the issue is happening. the issue
> occurs when I try to call the *cygwin_dll_init* method of the  
> cygwin1.dll .
> This cygwin1.dll is actualy a dependency to the DLL we have built. So we
> have to load this DLL and call this *cygwin_dll_init* method before  
> loading
> my DLL.
>
>
> cyg = cdll.LoadLibrary("cygwin1.dll")
> cyg.cygwin_dll_init() #hangs or returns here
> mydll=cdll.LoadLibrary("my.dll")
>mydll.func1()
>I'm trying to understand what exactly is the difference, when we call it
> IDLE and when we call it from command prompt using the python command. I
> will have to get the script working from command prompt as well.

A few comments:

* why do you initialize cygwin1.dll in Python? If it's a dependency of  
my.dll, it might be better to load and initialize it there.

* for this function prototype: void cygwin_dll_init(void);
you should declare it using:

cyg = cdll.LoadLibrary("cygwin1.dll")
cyg.restype = None
cyg.cygwin_dll_init() #hangs or returns here
...

Anyway, I don't see why a console application would fail but not inside  
IDLE.

-- 
Gabriel Genellina




More information about the Python-list mailing list