aa

I tried setting 'kLogFile' to a file, but nothing happens. If I look at
'wingdbstub.py' in never goes in using this variable. It fails when tying to
access 'WINGDB_ACTIVE' and it just bails.

I put the following line before including the wingdbstub.py:
print "has_key(os.environ, 'WINGDB_ACTIVE') = {0}".format(
has_key(os.environ, 'WINGDB_ACTIVE') )

and WINGDB_ACTIVE is always FALSE. If I run it from Wing IDE, it is still
false...

I've set my exe in Wing IDE, from the menu Project -> Project Properties ->
Environment -> Python Executable. I've also set up the 'Python Path' to the
folder where my executable is.

Note that I do not have python installed on this machine. It's just my
executable, and the python DLL, and the python 'libs' folder next to the
executable. (The executable works fine with this setup)

--
View this message in context: http://wingide.992054.n4.nabble.com/Debugging-an-Embedded-Python-Script-tp3725854p3725904.html
Sent from the WingIDE - User mailing list archive at Nabble.com.
Permalink | Reply | 
Wing IDE Support | 8 Aug 17:02
Favicon 
Gravatar 

Re: Re: Debugging an Embedded Python Script

On 8/7/11 9:07 PM, theDarkBrainer wrote:
>
> I've set my exe in Wing IDE, from the menu Project ->  Project Properties ->
> Environment ->  Python Executable. I've also set up the 'Python Path' to the
> folder where my executable is.

The python executable should be the name of the python interpreter .exe 
and not the .exe for your application.  You application should be 
launched from the command line.  You'll also probably want to have the 
python interpreter .exe installed on the machine because Wing uses it to 
determine where the standard library files are located among other things.

 > I tried setting 'kLogFile' to a file, but nothing happens. If I look at
 > 'wingdbstub.py' in never goes in using this variable. It fails when 
tying to
 > access 'WINGDB_ACTIVE' and it just bails.

When you launch from the command line, WINGDB_ACTIVE should not be set. 
  Is something failing when the code checks for the value?

Thanks,

John
Permalink | Reply | 
theDarkBrainer | 9 Aug 03:41
Picon 

Re: Debugging an Embedded Python Script

Wingware Support wrote:
> 
> The python executable should be the name of the python interpreter .exe 
> and not the .exe for your application.  You application should be 
> launched from the command line.
> 

all the time while doing these experiments, I have Wing IDE running
(temporary license), and in the project properties, the environment is set
to: Python Executable: use defaults. 

Also, I did install Python 2.7 x86 (since my app is not 64-bit). I'm on Win
7 86-bit though.

Ok, I did that. I focused on my application and i'm trying to run it from
the command line.

What i'm seeing is that exception: raise ValueError("No debugger")
from wingdbstub.py

I went it, and placed a bunch of 'print's, to see what's going, and tracked
down the problem to the call:
netserver = wingdb.FindNetServerModule(WINGHOME, kUserSettingsDir)

it never gets out of there (it never executes anything after that line). So
I went in and found that function defined in wingdb.py, and it turned out
that the line:
import netserver

(Continue reading)

Permalink | Reply | 
theDarkBrainer | 9 Aug 04:04
Picon 

Re: Debugging an Embedded Python Script

theDarkBrainer wrote:
> 
> May be I have something setup wrong in my embedded python? 
> 

Now that I have Pyhton installed, I run the Program.py directly from the
command line, and it stopped at: debugger = netserver.CNetworkServer(host,
port, attachport, err, 

and since I had Wing IDE running, it immediately stopped at my break point
there (sweet)

So, definitely, something is wrong with my app.

Any ideas? What are the most common mistakes?

My app does run ok, i can use python libraries and so on. It does run up to
that 'import netserver' line.

Regards,
Vlad

--
View this message in context: http://wingide.992054.n4.nabble.com/Debugging-an-Embedded-Python-Script-tp3725854p3728810.html
Sent from the WingIDE - User mailing list archive at Nabble.com.
Permalink | Reply | 
Wing IDE Support | 9 Aug 16:43
Favicon 
Gravatar 

Re: Re: Debugging an Embedded Python Script

On 8/8/11 10:04 PM, theDarkBrainer wrote:
> Now that I have Pyhton installed, I run the Program.py directly from the
> command line, and it stopped at: debugger = netserver.CNetworkServer(host,
> port, attachport, err,
>
> and since I had Wing IDE running, it immediately stopped at my break point
> there (sweet)
>
> So, definitely, something is wrong with my app.

Could you try defining WINGDB_PRINT_ALL_TRACEBACKS in your environment 
before running your app with "set WINGDB_PRINT_ALL_TRACEBACKS=1" at the 
cmd line (or the equivalent)?  Then send us the output printed to stdout 
when wingdbstub is imported.

Thanks,

John
Permalink | Reply | 
theDarkBrainer | 10 Aug 00:47
Picon 

Re: Debugging an Embedded Python Script

I'm having problems defining this variable in the context of the app. I did
it 100 different ways, but it sill doesn't want to show the extensive
reports. (I managed to show them if I just run the python script from the
console)

Anyway, I managed to see what the error is:

Trying to import netserver from C:\Program Files (x86)\Wing IDE
4.0\bin\2.7\src\debug\tserver
Traceback (most recent call last):
  File "C:\Program Files (x86)\Wing IDE 4.0\bin\wingdb.py", line 356, in
FindNet
ServerModule
    import netserver
  File "C:\src\ide\bin\2.7\src/debug/tserver\netserver.pyc", line 184, in
<module>
  File "<string>", line 1, in <module>
  File "C:\src\ide\bin\2.7\src/debug/tserver\_wxhooks.pyc", line 15, in
<module>

ImportError: No module named new
Trying to import netserver from C:\Program Files (x86)\Wing IDE
4.0\src\debug\tserver
Traceback (most recent call last):
  File "C:\Program Files (x86)\Wing IDE 4.0\bin\wingdb.py", line 356, in
FindNet
ServerModule
    import netserver
  File "C:\src\ide\bin\2.7\src/debug/tserver\netserver.pyc", line 184, in
<module>
(Continue reading)

Permalink | Reply | 
theDarkBrainer | 10 Aug 00:55
Picon 

Re: Debugging an Embedded Python Script

ok, so, I managed to make it find the 'new' module by adding the path
'C:\Python27\Lib' to the python search path of my app (doh)

But, then I got:

Trying to import netserver from C:\Program Files (x86)\Wing IDE
4.0\bin\2.7\src\debug\tserver
Traceback (most recent call last):
  File "C:\Program Files (x86)\Wing IDE 4.0\bin\wingdb.py", line 356, in
FindNetServerModule
    import netserver
  File "C:\src\ide\bin\2.7\src/debug/tserver\netserver.pyc", line 194, in
<module>
  File "C:\Python27\Lib\socket.py", line 47, in <module>
    import _socket
ImportError: No module named _socket
Trying to import netserver from C:\Program Files (x86)\Wing IDE
4.0\src\debug\tserver
Traceback (most recent call last):
  File "C:\Program Files (x86)\Wing IDE 4.0\bin\wingdb.py", line 356, in
FindNetServerModule
    import netserver
  File "C:\src\ide\bin\2.7\src/debug/tserver\netserver.pyc", line 194, in
<module>
  File "C:\Python27\Lib\socket.py", line 47, in <module>
    import _socket
ImportError: No module named _socket

--
View this message in context: http://wingide.992054.n4.nabble.com/Debugging-an-Embedded-Python-Script-tp3725854p3731537.html
(Continue reading)

Permalink | Reply | 
theDarkBrainer | 10 Aug 01:18
Picon 

Re: Debugging an Embedded Python Script

Then I added "C:\Python27\DLLs"

and now i'm stuck at:

Trying to import netserver from C:\Program Files (x86)\Wing IDE
4.0\bin\2.7\src\debug\tserver
Traceback (most recent call last):
  File "C:\Program Files (x86)\Wing IDE 4.0\bin\wingdb.py", line 356, in
FindNetServerModule
    import netserver
  File "C:\src\ide\bin\2.7\src/debug/tserver\netserver.pyc", line 209, in
<module>
  File "C:\src\ide\bin\2.7\src/debug/tserver\abstract.pyc", line 20, in
<module>

  File "C:\src\ide\bin\2.7\src/debug/tserver\findmodules.pyc", line 123, in
<module>
  File "C:\src\ide\bin\2.7\src/debug/tserver\findmodules.pyc", line 109, in
_FindTracer
ImportError: DLL load failed: %1 is not a valid Win32 application.
Trying to import netserver from C:\Program Files (x86)\Wing IDE
4.0\src\debug\tserver
Traceback (most recent call last):
  File "C:\Program Files (x86)\Wing IDE 4.0\bin\wingdb.py", line 356, in
FindNetServerModule
    import netserver
  File "C:\src\ide\bin\2.7\src/debug/tserver\netserver.pyc", line 209, in
<module>
  File "C:\src\ide\bin\2.7\src/debug/tserver\abstract.pyc", line 20, in
<module>
(Continue reading)

Permalink | Reply | 
Wing IDE Support | 10 Aug 02:58
Favicon 
Gravatar 

Re: Re: Debugging an Embedded Python Script

On 8/9/11 7:18 PM, theDarkBrainer wrote:
> Then I added "C:\Python27\DLLs"
>
> and now i'm stuck at:
>
>    File "C:\src\ide\bin\2.7\src/debug/tserver\findmodules.pyc", line 109, in
> _FindTracer
> ImportError: DLL load failed: %1 is not a valid Win32 application.

Could it be a 32-bit v 64-bit issue?

Thanks,

John
Permalink | Reply | 
theDarkBrainer | 10 Aug 04:01
Picon 

Re: Debugging an Embedded Python Script

Wingware Support wrote:
> 
> Could it be a 32-bit v 64-bit issue?
> 

I tried installing Python x64, but then my app wont link since it is 32-bit
for sure. So, I installed the 32-bit Python again.

Also, i found that it could be because C++ re-distributables for VS2008 were
not installed (I do have VS2005 and VS2010 installed on this machine), but
thought I would try installing them ... no luck ... same thing

and remember, I do get it working if I run the script from the console. It
also works ok if run from the VS2010 as well (using Python Tools for
VisualStudio)

All that leads me to think that I haven't set up something in my app. But
what would that be?

--
View this message in context: http://wingide.992054.n4.nabble.com/Debugging-an-Embedded-Python-Script-tp3725854p3731823.html
Sent from the WingIDE - User mailing list archive at Nabble.com.
Permalink | Reply | 
theDarkBrainer | 13 Aug 04:51
Picon 

Re: Debugging an Embedded Python Script

theDarkBrainer wrote:
> 
> But what would that be?
> 

Ok, for the sake of completeness i'll post that i've found the issue.

It seems that Python 2.7, the one I was using, depends on the VC90 C Runtime
(VisualStudio 2008). That is to say it depended on 'msvcr90.dll'

The way I solved it is to make my app dependent on "Microsoft.VC90.CRT"
using manifests. I've added the following dependency:

<dependency>
    <dependentAssembly>
        <assemblyIdentity
            type="win32"
            name="Microsoft.VC90.CRT"
            version="9.0.30729.4918"
            processorArchitecture="X86"
            publicKeyToken="1fc8b3b9a1e18e3b"
            language="*"
        />
    </dependentAssembly>
</dependency>

--
View this message in context: http://wingide.992054.n4.nabble.com/Debugging-an-Embedded-Python-Script-tp3725854p3740810.html
Sent from the WingIDE - User mailing list archive at Nabble.com.
原文地址:https://www.cnblogs.com/dengyigod/p/2613736.html