On 11/13/06, Michael Sorich <[EMAIL PROTECTED]> wrote:
Hi,

>From pydev I would like to run a python file in an external program
such as ipython or pythonwin. This is because these allow one to
interact with the final state of the program once the script is
finished or as a post-mortem of unhandled exceptions. Hopefully when
eclipse supports the interactive console better this will be possible
within pydev.

Actually, this can be achieved by importing the script below:

'''
Makes the applications start the python debugger when an unhandled exception
occurs, instead of exiting the application.

Usage: just import this module

Source: Python Cookbook, page 434.
'''
import sys
import traceback
import pdb

def info(type, value, tb):
    if hasattr(sys, 'ps1'):
        sys.__excepthook__(type, value, tb)
    else:
        traceback.print_exception(type, value, tb)
        print
        pdb.pm()

sys.excepthook = info
 

For example the command line version that I hope to configure pydev to
make and execute is

C:\Python24\Lib\site-packages\pythonwin\Pythonwin.exe /run scriptname

alternatively

C:\Python24\python.exe C:\Python24\Scripts\ipython scriptname

Can I set it up so that I can click a button or use a keyboard short
cut to get pydev to call this command with the appropriate path to the
python file?

You can do that in Eclipse by creating an external tool. Take a look at the faq: http://pydev.sourceforge.net/faq.html#ref_13 for a guide on how to configure an external tool (in this example it shows how you can create your own interactive shell).

Cheers,

Fabio
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Pydev-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pydev-users

Reply via email to