Re: Why my modification of source file doesn't take effect when debugging?

2005-12-05 Thread Christophe
Dave Hansen a écrit :
> On Fri, 02 Dec 2005 18:04:15 +0100 in comp.lang.python, Christophe
> <[EMAIL PROTECTED]> wrote:
> 
> 
>>infidel a écrit :
>>
I'm using the Windows version of Python and IDLE. When I debug my .py
file, my modification to the .py file does not seem to take effect
unless I restart IDLE. Saving the file and re-importing it doesn't help
either. Where's the problem?
>>>
>>>
>>>"import" only reads the file the first time it's called.  Every import
>>>call after that looks up the module in memory.  This is to prevent
>>>circular dependencies between modules from creating infinite loops.
>>>You need to use the reload() function:
>>
>>As a matter of fact, it would help a lot if that stupid behaviour of 
>>Idle was dropped. I'm sure I'm not the only one who lost lots of time 
>>because of that bug. Yes I call it a bug.
> 
> 
> But, if you are editing a Python Module in Idle, and press F5 to run
> the module, the interpreter is restarted for you.  So what's the
> problem?
> 
> I would consider it a far greater problem if Idle _didn't_ do that --
> it could mean you module worked when you were debuggining it because
> of some initialization that doesn't get performed in a clean start.
> 
> Regards,
> -=Dave
> 

Well, I'm happy to see that Idle now restarts the interpreter by default 
when you press F5. I guess I might consider using it again after all 
that time :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why my modification of source file doesn't take effect when debugging?

2005-12-05 Thread Dave Hansen
On Fri, 02 Dec 2005 18:04:15 +0100 in comp.lang.python, Christophe
<[EMAIL PROTECTED]> wrote:

>infidel a écrit :
>>>I'm using the Windows version of Python and IDLE. When I debug my .py
>>>file, my modification to the .py file does not seem to take effect
>>>unless I restart IDLE. Saving the file and re-importing it doesn't help
>>>either. Where's the problem?
>> 
>> 
>> "import" only reads the file the first time it's called.  Every import
>> call after that looks up the module in memory.  This is to prevent
>> circular dependencies between modules from creating infinite loops.
>> You need to use the reload() function:
>
>As a matter of fact, it would help a lot if that stupid behaviour of 
>Idle was dropped. I'm sure I'm not the only one who lost lots of time 
>because of that bug. Yes I call it a bug.

But, if you are editing a Python Module in Idle, and press F5 to run
the module, the interpreter is restarted for you.  So what's the
problem?

I would consider it a far greater problem if Idle _didn't_ do that --
it could mean you module worked when you were debuggining it because
of some initialization that doesn't get performed in a clean start.

Regards,
-=Dave

-- 
Change is inevitable, progress is not.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why my modification of source file doesn't take effect when debugging?

2005-12-02 Thread Scott David Daniels
Christophe wrote:
> infidel a écrit :
>>> I'm using the Windows version of Python and IDLE. When I debug my .py
>>> file, my modification to the .py file does not seem to take effect
>>> unless I restart IDLE. Saving the file and re-importing it doesn't help
>>> either. Where's the problem?
>>
>> "import" only reads the file the first time it's called.  Every import
>> call after that looks up the module in memory.  This is to prevent
>> circular dependencies between modules from creating infinite loops.
>> You need to use the reload() function:
> 
> As a matter of fact, it would help a lot if that stupid behaviour of 
> Idle was dropped. I'm sure I'm not the only one who lost lots of time 
> because of that bug. Yes I call it a bug.
You are mistaken if you think this is an Idle behavior; it is a Python
behavior that speeds the execution of large systems.

--Scott David Daniels
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why my modification of source file doesn't take effect when debugging?

2005-12-02 Thread Christophe
infidel a écrit :
>>I'm using the Windows version of Python and IDLE. When I debug my .py
>>file, my modification to the .py file does not seem to take effect
>>unless I restart IDLE. Saving the file and re-importing it doesn't help
>>either. Where's the problem?
> 
> 
> "import" only reads the file the first time it's called.  Every import
> call after that looks up the module in memory.  This is to prevent
> circular dependencies between modules from creating infinite loops.
> You need to use the reload() function:

As a matter of fact, it would help a lot if that stupid behaviour of 
Idle was dropped. I'm sure I'm not the only one who lost lots of time 
because of that bug. Yes I call it a bug.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why my modification of source file doesn't take effect when debugging?

2005-12-02 Thread infidel
> I'm using the Windows version of Python and IDLE. When I debug my .py
> file, my modification to the .py file does not seem to take effect
> unless I restart IDLE. Saving the file and re-importing it doesn't help
> either. Where's the problem?

"import" only reads the file the first time it's called.  Every import
call after that looks up the module in memory.  This is to prevent
circular dependencies between modules from creating infinite loops.
You need to use the reload() function:

>>> import foo

#change the contents of foo

>>> foo = reload(foo)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why my modification of source file doesn't take effect when debugging?

2005-12-02 Thread Jeremy Jones
sandorf wrote:

>I'm using the Windows version of Python and IDLE. When I debug my .py
>file, my modification to the .py file does not seem to take effect
>unless I restart IDLE. Saving the file and re-importing it doesn't help
>
>either. Where's the problem? 
>
>Thanks.
>
>  
>
No problem.  Just reload() it.


- jmj
-- 
http://mail.python.org/mailman/listinfo/python-list


Why my modification of source file doesn't take effect when debugging?

2005-12-02 Thread sandorf
I'm using the Windows version of Python and IDLE. When I debug my .py
file, my modification to the .py file does not seem to take effect
unless I restart IDLE. Saving the file and re-importing it doesn't help

either. Where's the problem? 

Thanks.

-- 
http://mail.python.org/mailman/listinfo/python-list