Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   newbie - script works in PythonWin - fails from Python (http://www.velocityreviews.com/forums/t354043-newbie-script-works-in-pythonwin-fails-from-python.html)

marcus.tettmar@gmail.com 02-03-2006 09:58 AM

newbie - script works in PythonWin - fails from Python
 
Hi,

I have a script that runs fine when I run it from within PythonWin but
causes a WindowsError: Exception when I try to run it from the command
line using python.exe. What is PythonWin doing differently?


Fredrik Lundh 02-03-2006 10:14 AM

Re: newbie - script works in PythonWin - fails from Python
 
marcus.tettmar@gmail.com wrote:

> I have a script that runs fine when I run it from within PythonWin but
> causes a WindowsError: Exception when I try to run it from the command
> line using python.exe. What is PythonWin doing differently?


is that the entire traceback ?

what is the script doing when you get that error message ?

</F>




Fuzzyman 02-03-2006 10:14 AM

Re: newbie - script works in PythonWin - fails from Python
 

marcus.tettmar@gmail.com wrote:
> Hi,
>
> I have a script that runs fine when I run it from within PythonWin but
> causes a WindowsError: Exception when I try to run it from the command
> line using python.exe. What is PythonWin doing differently?


Hello Marcus,

Can you post the full exception, and preferably the snippet of code
(with relevant context) that caused it. This will give people a better
chance of being able to help you.

All the best,


Fuzzyman
http://www.voidspace.org.uk/python/index.shtml


marcus.tettmar@gmail.com 02-03-2006 10:29 AM

Re: newbie - script works in PythonWin - fails from Python
 
I'm using ctypes and loading a DLL and running a DLL function. As I
say it works perfectly with no errors when I run from PythonWin but
gives the following exception when run from command line.

WindowsError: exception code 0xeedfade

I can use the DLL with no issues in other languages too. It works fine
in VB, C++ and in Python when run from PythonWin but gets an exception
when run from python.exe

PythonWin must be doing something different, but I can't find anything
in the documentation.


Steven D'Aprano 02-03-2006 11:04 AM

Re: newbie - script works in PythonWin - fails from Python
 
On Fri, 03 Feb 2006 02:29:03 -0800, marcus.tettmar wrote:

> I'm using ctypes and loading a DLL and running a DLL function. As I
> say it works perfectly with no errors when I run from PythonWin but
> gives the following exception when run from command line.
>
> WindowsError: exception code 0xeedfade


I find it hard to believe that this is the entire exception traceback.
This is what a traceback looks like:


>>> dosomething wrong(20) # oops, space in the function name

File "<stdin>", line 1
dosomething wrong(20)
^
SyntaxError: invalid syntax

See how much information is given by the traceback? If I just posted
"SyntaxError: invalid syntax" to the newsgroup with no further
information, what do you think the chances are anyone would guess the
cause of the problem?

So, how about trying again with the complete traceback?


--
Steven.


marcus.tettmar@gmail.com 02-03-2006 03:00 PM

Re: newbie - script works in PythonWin - fails from Python
 
Hi,

This is all I get:

error 250477278
Traceback (most recent call last):
File "script1.py", line 5, in ?
Inst = lib.Initialize(0)
WindowsError: exception code 0xeedfade

I get this when running python.exe script1.py

** When run from inside PythonWin it runs beautifully and returns with
no errors **

Regardless of what the error actually is it *works* when run from
PythonWin. It fails only when run from the command line. I'm trying
to find out why there is a difference. Clearly both either run a
different interpreter or with different switches. I was hoping someone
knows what the difference is.


Thomas Heller 02-03-2006 03:26 PM

Re: newbie - script works in PythonWin - fails from Python
 
marcus.tettmar@gmail.com writes:

> Hi,
>
> This is all I get:
>
> error 250477278
> Traceback (most recent call last):
> File "script1.py", line 5, in ?
> Inst = lib.Initialize(0)
> WindowsError: exception code 0xeedfade
>
> I get this when running python.exe script1.py
>
> ** When run from inside PythonWin it runs beautifully and returns with
> no errors **
>
> Regardless of what the error actually is it *works* when run from
> PythonWin. It fails only when run from the command line. I'm trying
> to find out why there is a difference. Clearly both either run a
> different interpreter or with different switches. I was hoping someone
> knows what the difference is.


One difference is that PythonWin runs a messageloop. Does the
documentation of the library you call say something about the error code
you get?

Thomas

marcus.tettmar@gmail.com 02-03-2006 04:19 PM

Re: newbie - script works in PythonWin - fails from Python
 
Unfortunately not. Is there any doc anywhere that shows how to make
the script run from the command line the same way it does within
PythonWin?


Steven D'Aprano 02-03-2006 05:00 PM

Re: newbie - script works in PythonWin - fails from Python
 
On Fri, 03 Feb 2006 07:00:37 -0800, marcus.tettmar wrote:

> Hi,
>
> This is all I get:
>
> error 250477278


What is this line? That doesn't look like part of a Python traceback. I
suppose it is possible that the DLL is printing it before the exception is
raised. Or did you type it yourself?


> Traceback (most recent call last):
> File "script1.py", line 5, in ?
> Inst = lib.Initialize(0)
> WindowsError: exception code 0xeedfade
>
> I get this when running python.exe script1.py


You're still making it as hard as possible for anyone to help you. Is it a
secret what DLL you are trying to call? What is "lib"?

Googling on 0xeedfade suggests that it is an internal Delphi error,
possibly an out-of-memory error. Are you calling a Delphi DLL? What does
that exception mean?


--
Steven.


Fredrik Lundh 02-03-2006 05:11 PM

Re: newbie - script works in PythonWin - fails from Python
 
Thomas Heller wrote:

> > This is all I get:
> >
> > error 250477278
> > Traceback (most recent call last):
> > File "script1.py", line 5, in ?
> > Inst = lib.Initialize(0)
> > WindowsError: exception code 0xeedfade
> >
> > I get this when running python.exe script1.py
> >
> > ** When run from inside PythonWin it runs beautifully and returns with
> > no errors **
> >
> > Regardless of what the error actually is it *works* when run from
> > PythonWin. It fails only when run from the command line. I'm trying
> > to find out why there is a difference. Clearly both either run a
> > different interpreter or with different switches. I was hoping someone
> > knows what the difference is.

>
> One difference is that PythonWin runs a messageloop. Does the
> documentation of the library you call say something about the error code
> you get?


a quick googling indicates that 0xEEDFADE is usually caused by an
internal unhandled exception in Delphi. maybe there's some Borland-
specific DLL that's not found when the code is running from the con-
sole ?

I suppose you could use process explorer to see if you can figure out
what Borland DLL:s the program is using:

http://www.sysinternals.com/Processe...Utilities.html

</F>





All times are GMT. The time now is 04:31 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.