Archaeopteryx Software, Inc.
Take Flight!Search

Home
Wing IDE
News
Support
About Us
Python
Open Source
Store

 Search:
 
 Advanced Search




[wingide-users] Problems with wingdbstub.SuspendDebug

Peter.Frey@haufe.de Peter.Frey at haufe.de
Thu, 3 Apr 2003 18:05:45 +0200


Hi,

I am using WingIDE 1.1.9-1 with Python 2.2.2 (with largefile support
compiled in) and Zope 2.6.1 for debugging on a Suse Linux 8.1 desktop
system.
My problem is with startup performance when debugging my scripts that
interface to the Zope runtime.
It looks like it is caused by over 600 modules loaded at startup time of my
script. The script runs as a batch process, i.e. not inside a Zope http
request.

To speed up this process I tried to implement the tip found in the Wing IDE
manual (HTML)
in section 6.15.7 "Full Control via Debug API" as follows:


global DEBUG
DEBUG = 1

if DEBUG:
    import wingdbstub
    wingdbstub.debugger.SuspendDebug()
    # suspend debugger to speed up startup time for Zope environment

import sys, traceback
import os, os.path
import re
import time
import getopt, glob
import Zope
try:
    print "% starting up Zope environment ..."
    Zope.startup() # added for Zope 2.6
except:
    etype, value, tb = sys.exc_info()
    print "*** failed to do Zope 2.6 style initialisation"
    print "Exception %s: %s" % (etype, value)
    traceback.print_tb(tb)
    sys.exit(1)

import Acquisition
...

if DEBUG:
    wingdbstub.debugger.ResumeDebug()


The problem now is, when started from inside WingIDE 1.1.9-1, I get the
following exception when starting the script from inside the IDE:

Attribute not found: 'module' object has no attribute 'debugger'

Traceback (innermost last):
File "<string>", line 1, in ?
File "/home/freyp/EPcvs/HRS/Prod/HaufeCMSScripts/QueryTest.py", line 11, in
?
      wingdbstub.debugger.SuspendDebug()

when stepping through wingdbstub.py (that I just copied from
/usr/lib/wingide/wingdbstub.py
over to the directory where my python script is, I am unable to step over
the line 136:

if not kWingDebugDisabled and not os.environ.has_key('WINGDB_DISABLED') and
\
   not os.environ.has_key('WINGDB_ACTIVE'):

(looks like an exception that is not caught/handled by the Wing IDE
debugger)

and in the interactive debug probe, I also see no member debugger with the
wingdbstub module:

>>> dir (wingdbstub)
['WINGHOME', '__builtins__', '__doc__', '__file__', '__name__', 'imp',
'kAttachPort', 'kEmbedded', 'kExitOnFailure', 'kLogFile', 'kPWFileName',
'kPWFilePath', 'kSilent', 'kWingDebugDisabled', 'kWingHostPort', 'os',
'string', 'sys']
>>>

(so probably it is kind of python magic?)



Next try was to run the script from a bash shell:


freyp@linux-frpkoend:~/EPcvs/HRS/Prod/HaufeCMSScripts> sh start_query.sh
Traceback (most recent call last):
  File "QueryTest.py", line 11, in ?
    wingdbstub.debugger.SuspendDebug()
  File "2.2.0/src/debug/server/netserver.pyc", line 758, in SuspendDebug
TypeError: tracer_stop_trace() takes exactly 0 arguments (1 given)


the script used was was:

freyp@linux-frpkoend:~/EPcvs/HRS/Prod/HaufeCMSScripts> more start_query.sh
#!/bin/sh
export PYTHONPATH=/home/freyp/Zope/Server/lib/python/
export INSTANCE_HOME=/windows/Work/Zope/HaufeCMSTest
exec /usr/local/bin/python QueryTest.py /HaufeCMSTest/ImportTest
/windows/Work/Zope/daten/import /windows/Work/Zope/test/export



Does this mean I am no longer possible to use SuspendDebug/ResumeDebug from
WingIDE 1.1.9? 

debug.passive-listen is set to true (as I need this for other Zope debugging
sessions, too)
but I could not find the .wingdebugpwd file. Probably I do not need it as I
run both the ZEO Server and my script 
from within the same user account.

Any help? Or, is there an other - better - way to speed up load time?

regards
Peter





Run by Mailman v 2.0.8


Copyright (c) 2000-2002, Archaeopteryx Software, Inc.
Legal Statements