Mailing List Archive

Newbie: How do you "clear" PythonWin between runs?
I've just started playing with python, so all of this is very new to me.
I have been writing some scripts, saving them to *.py files, and running
them under PythonWin 1.5.2 . The process is iterative; I code, save,
run, code, save, run, etc.

What I have noticed is that python doesn't "reset" between runs.
Sometimes error messages reappear even though I have fixed the problem,
because some artifact of a previous run lingers.

So, my question is this: How can I "flush" or "clear" the python
interpreter between successive runs? Is there a command I can add to my
script to initialize python before running the script?

Thanks,

Pete
hpeter.friedrichs@alliedsignal.com

--

-----------------------------------------------
| The opinions expressed here are my own, |
| and not necessarily those of my employer. |
-----------------------------------------------
Newbie: How do you "clear" PythonWin between runs? [ In reply to ]
http://grail.cnri.reston.va.us/cgi-bin/faqw.py?query=reload&querytype=simple
&casefold=yes&req=search


--
--Darrell
H. P. Friedrichs <" HPeter.Friedrichs"@alliedsignal.com> wrote in message
news:37700E61.5388E101@alliedsignal.com...
> I've just started playing with python, so all of this is very new to me.
> I have been writing some scripts, saving them to *.py files, and running
> them under PythonWin 1.5.2 . The process is iterative; I code, save,
> run, code, save, run, etc.
>
> What I have noticed is that python doesn't "reset" between runs.
> Sometimes error messages reappear even though I have fixed the problem,
> because some artifact of a previous run lingers.
>
> So, my question is this: How can I "flush" or "clear" the python
> interpreter between successive runs? Is there a command I can add to my
> script to initialize python before running the script?
>
> Thanks,
>
> Pete
> hpeter.friedrichs@alliedsignal.com
>
> --
>
> -----------------------------------------------
> | The opinions expressed here are my own, |
> | and not necessarily those of my employer. |
> -----------------------------------------------
>
>
Newbie: How do you "clear" PythonWin between runs? [ In reply to ]
Darrell:

What exactly is this URL? What document were you referencing? Is there another
way to get it?

I can't seem to connect to this URL...I keep getting "server busy or offline"
type errors.

Thanks,
Pete


Darrell wrote:

> http://grail.cnri.reston.va.us/cgi-bin/faqw.py?query=reload&querytype=simple
> &casefold=yes&req=search
>
> --
> --Darrell
> H. P. Friedrichs <" HPeter.Friedrichs"@alliedsignal.com> wrote in message
> news:37700E61.5388E101@alliedsignal.com...
> > I've just started playing with python, so all of this is very new to me.
> > I have been writing some scripts, saving them to *.py files, and running
> > them under PythonWin 1.5.2 . The process is iterative; I code, save,
> > run, code, save, run, etc.
> >
> > What I have noticed is that python doesn't "reset" between runs.
> > Sometimes error messages reappear even though I have fixed the problem,
> > because some artifact of a previous run lingers.
> >
> > So, my question is this: How can I "flush" or "clear" the python
> > interpreter between successive runs? Is there a command I can add to my
> > script to initialize python before running the script?
> >
> > Thanks,
> >
> > Pete
> > hpeter.friedrichs@alliedsignal.com
> >

-----------------------------------------------
| The opinions expressed here are my own, |
| and not necessarily those of my employer. |
-----------------------------------------------
Newbie: How do you "clear" PythonWin between runs? [ In reply to ]
I went to the python faq and used the "Python FAQ Wizard" and searched on
"reload"
http://grail.cnri.reston.va.us/cgi-bin/faqw.py


--
--Darrell
H. P. Friedrichs <" HPeter.Friedrichs"@alliedsignal.com> wrote in message
news:3771006D.22A9EC2D@alliedsignal.com...
> Darrell:
>
> What exactly is this URL? What document were you referencing? Is there
another
> way to get it?
>
> I can't seem to connect to this URL...I keep getting "server busy or
offline"
> type errors.
>
> Thanks,
> Pete
>
>
> Darrell wrote:
>
> >
http://grail.cnri.reston.va.us/cgi-bin/faqw.py?query=reload&querytype=simple
> > &casefold=yes&req=search
> >
> > --
> > --Darrell
> > H. P. Friedrichs <" HPeter.Friedrichs"@alliedsignal.com> wrote in
message
> > news:37700E61.5388E101@alliedsignal.com...
> > > I've just started playing with python, so all of this is very new to
me.
> > > I have been writing some scripts, saving them to *.py files, and
running
> > > them under PythonWin 1.5.2 . The process is iterative; I code, save,
> > > run, code, save, run, etc.
> > >
> > > What I have noticed is that python doesn't "reset" between runs.
> > > Sometimes error messages reappear even though I have fixed the
problem,
> > > because some artifact of a previous run lingers.
> > >
> > > So, my question is this: How can I "flush" or "clear" the python
> > > interpreter between successive runs? Is there a command I can add to
my
> > > script to initialize python before running the script?
> > >
> > > Thanks,
> > >
> > > Pete
> > > hpeter.friedrichs@alliedsignal.com
> > >
>
> -----------------------------------------------
> | The opinions expressed here are my own, |
> | and not necessarily those of my employer. |
> -----------------------------------------------
>
>
Newbie: How do you "clear" PythonWin between runs? [ In reply to ]
In article <37700E61.5388E101@alliedsignal.com> , "H. P. Friedrichs" <"
HPeter.Friedrichs"@alliedsignal.com> wrote:

> So, my question is this: How can I "flush" or "clear" the python
> interpreter between successive runs? Is there a command I can add to my
> script to initialize python before running the script?

I haven't tried it yet, but I've been thinking:

# when you start up the IDE
import sys
modules = sys.modules.copy()

# To "clear" the python interpreter
sys.modules = modules.copy()


Just might work,
Dave