469,951 Members | 2,340 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,951 developers. It's quick & easy.

working directory for debugging in pythonwin

Hello all,

I started using the nice Pythonwin IDE together with Python 2.3 (I have
come to prefer its editor to IDLE).
My problem is, that when I want to run a script in the debugger, I can
give the script name and arguments, but I can't tell it in which
directory it should run.

I googled this group but didn't find anything helpful so far.

I could use some os.chdir in my code, but that's ugly and I neither want
to copy the script around to the places where I would like to test it.

Any suggestions?

Thanks in advance
Thomas
Jul 19 '05 #1
4 2332
Thomas Pfaff wrote:
Hello all,

I started using the nice Pythonwin IDE together with Python 2.3 (I have
come to prefer its editor to IDLE).
My problem is, that when I want to run a script in the debugger, I can
give the script name and arguments, but I can't tell it in which
directory it should run.

I googled this group but didn't find anything helpful so far.

I could use some os.chdir in my code, but that's ugly and I neither want
to copy the script around to the places where I would like to test it.

Any suggestions?

Thanks in advance
Thomas

Thomas,

When you have initiated PythonWin, try opening (^O) the file you wish to
debug. By selecting the file directory and file you have chosen the
current working directory for the file.

Alternatively, in the Windows Explorer, try right clicking on the py
file you wish to debug. One of the options given is likely to be PythonWin.

Colin W.
Jul 19 '05 #2
Colin J. Williams schrieb:
Thomas Pfaff wrote:
Hello all,

I started using the nice Pythonwin IDE together with Python 2.3 (I have
come to prefer its editor to IDLE).
My problem is, that when I want to run a script in the debugger, I can
give the script name and arguments, but I can't tell it in which
directory it should run.

I googled this group but didn't find anything helpful so far.

I could use some os.chdir in my code, but that's ugly and I neither want
to copy the script around to the places where I would like to test it.

Any suggestions?

Thanks in advance
Thomas


Thomas,

When you have initiated PythonWin, try opening (^O) the file you wish to
debug. By selecting the file directory and file you have chosen the
current working directory for the file.

Alternatively, in the Windows Explorer, try right clicking on the py
file you wish to debug. One of the options given is likely to be
PythonWin.

Colin W.


Well this is what I do not want to do.
I want to have the script in some folder /source/myscript.py but run it
on data in e.g. /path/to/data/ like I would do on the commandline with

$ cd /path/to/data
$ pypthon /source/myscript.py local-file.dat
Cheers,
Thomas
Jul 19 '05 #3
You could pass the directory in as an optional extra argument
to the script. Alternately, you might accept either a bare file name
or a full path.

Roger
--
This signature was intentionally left blank.
(except it's not, wtf ??????)

"Thomas Pfaff" <ya**@gmx.net> wrote in message
news:3e************@individual.net...
Colin J. Williams schrieb:
Thomas Pfaff wrote:
Hello all,

I started using the nice Pythonwin IDE together with Python 2.3 (I have
come to prefer its editor to IDLE).
My problem is, that when I want to run a script in the debugger, I can
give the script name and arguments, but I can't tell it in which
directory it should run.

I googled this group but didn't find anything helpful so far.

I could use some os.chdir in my code, but that's ugly and I neither want
to copy the script around to the places where I would like to test it.

Any suggestions?

Thanks in advance
Thomas


Thomas,

When you have initiated PythonWin, try opening (^O) the file you wish to
debug. By selecting the file directory and file you have chosen the
current working directory for the file.

Alternatively, in the Windows Explorer, try right clicking on the py
file you wish to debug. One of the options given is likely to be
PythonWin.

Colin W.


Well this is what I do not want to do.
I want to have the script in some folder /source/myscript.py but run it
on data in e.g. /path/to/data/ like I would do on the commandline with

$ cd /path/to/data
$ pypthon /source/myscript.py local-file.dat
Cheers,
Thomas


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Jul 19 '05 #4
Roger Upole schrieb:
You could pass the directory in as an optional extra argument
to the script. Alternately, you might accept either a bare file name
or a full path.

Roger


Yes, that's true, and I suppose it's good programming style not to
depend on a special working directory. On the other hand I'd like to
reduce the amount of command line parameters passed into the script, and
I definitely dislike the thought of havin a 'standard' working_dir=
keyword in all my scripts just because my debugger needs it.

Basically I'm used to being able to set an arbitrary working directory
from MS Developer Studio, and I wanted to know before I would contact
Mark Hammond directly, if there is anything else than workarounds for
this problem.

Cheers,
Thomas
Jul 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Rami A. Kishek | last post: by
4 posts views Thread by Glenn Reed | last post: by
5 posts views Thread by Will McGugan | last post: by
reply views Thread by PaulG | last post: by
14 posts views Thread by Jive | last post: by
10 posts views Thread by rbt | last post: by
4 posts views Thread by qbproger | last post: by
20 posts views Thread by krypto.wizard | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.