FAQ
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

Search Discussions

  • Colin J. Williams at May 12, 2005 at 6:39 pm

    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.


    From http Thu May 12 20:57:00 2005
    From: http (Paul Rubin)
    Date: 12 May 2005 11:57:00 -0700
    Subject: urllib download insanity
    References: <4282EE0E.1080100@open-networks.net>
    <mailman.467.1115909041.29826.python-list@python.org>
    Message-ID: <7xsm0s8e83.fsf@ruckus.brouhaha.com>

    Skip Montanaro <skip at pobox.com> writes:
    Timothy> downloading the OLD file i've deleted! if i download it via IE,
    Timothy> i get the new file. SO, my only conculsion is that urllib is
    Timothy> caching it some where. BUT i'm already calling urlcleanup(), so
    Timothy> what else can i do? here is the code

    Is there a proxy between you and the web server?
    IE also caches extremely aggressively itself. There are a lot of
    different HTTP headers that affect caching. You have to set ALL of
    them to not cache. You have to set the cache control header AND set
    an expiration date in the past, and maybe a couple other things like
    that too.
  • Thomas Pfaff at May 13, 2005 at 10:46 am

    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
  • Roger Upole at May 13, 2005 at 11:18 am
    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" <yael at gmx.net> wrote in message
    news:3ejeq4F3di4bU1 at 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 =----
  • Thomas Pfaff at May 13, 2005 at 12:32 pm

    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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedMay 11, '05 at 3:18p
activeMay 13, '05 at 12:32p
posts5
users3
websitepython.org

People

Translate

site design / logo © 2022 Grokbase