debugging a script (print out except cause)

3 Messages Forum Options Options
Permalink
e deleflie
debugging a script (print out except cause)
Reply Threaded More
Print post
Permalink
Hi,

I know that Python Scripts dont have access to importing sys ..
because of security issues. My question is how can I, then, debug a
script?

I've got an exception being thrown ... but no way to find out why.

Etienne

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Plone-Users mailing list
Plone-Users@...
https://lists.sourceforge.net/lists/listinfo/plone-users
Ross Patterson-2
Re: debugging a script (print out except cause)
Reply Threaded More
Print post
Permalink
"e deleflie" <edeleflie@...> writes:

> I know that Python Scripts dont have access to importing sys ..
> because of security issues. My question is how can I, then, debug a
> script?
>
> I've got an exception being thrown ... but no way to find out why.

You can use Products.PDBDebugMode or another product that allows the pdb
module to be imported from restricted code.  :)

Ross


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Plone-Users mailing list
Plone-Users@...
https://lists.sourceforge.net/lists/listinfo/plone-users
eleddy
Re: debugging a script (print out except cause)
Reply Threaded More
Print post
Permalink
you can always use the classic printf way of debugging by sending
stuff to the log in your script.  An easy place to start is to wrap
everything in a generic exception wrapper and then send the exception
to the log:

try:
   ... my code ...
except Exception, e:
   context.plone_log(e)

You can also add a product that modifies what you are allowed to
import like the "GlobalModules" example (i.e.
http://osdir.com/ml/user-groups.zope.trizpug/2006-11/msg00017.html)
but going all this length seems like a lot of trouble when chances are
you have an easy exception to catch.

hth,
eleddy

On Jul 22, 9:46 pm, "e deleflie" <edelef...@...> wrote:

> Hi,
>
> I know that Python Scripts dont have access to importing sys ..
> because of security issues. My question is how can I, then, debug a
> script?
>
> I've got an exception being thrown ... but no way to find out why.
>
> Etienne
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the worldhttp://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Plone-Users mailing list
> Plone-Us...@...://lists.sourceforge.net/lists/listinfo/plone-users

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Plone-Users mailing list
Plone-Users@...
https://lists.sourceforge.net/lists/listinfo/plone-users