|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
saving changes to scripts
I've noticed this right from day three of learning Python..but didn't take it much seriously. When the length of the scripts grew bigger, it was hard to make changes.
When we make changes to the Python script...how to retain the changes w/o changing the name of the file. 1> Write the script 2> Save it as myFile.py 3> If suppose there are some errors or changes, make changes and again save it.... but this doesn't work...again when I import the file and run it ...it continues to display the same error I was getting before making the changes. How do I save my changes in python file????? Subha ![]() |
|
#2
|
||||
|
||||
|
I suspect that you are doing this using IDLE (or similar) and the file you are editing is actually a module you import into another module.
If the python interpreter is still running the old copy of the module stays in memory even if you modify the py file. The cleanest way to test it is close down python and re-run it. This is a consequence of the import optimisation - it only really imports a module once. You can use the reload(module) at the command prompt if you prefer. There are other work arounds involving modifying the module lists but frankly it is easier to restart the interpreter IMO. grim ![]()
__________________
*** Experimental Python Markup CGI V2 *** |
|
#3
|
|||
|
|||
|
Hey thanks so much Grimey!
Used the reload thingy.... PHP Code:
This solved the my great problem...I used to actually save the changes as a different file...which was a mess. Thanks so much...I'm very happy now! Subha ![]() |
|
#4
|
|||
|
|||
|
PythonWin has a "reload module" button, in case you're interested.
|
|
#5
|
|||
|
|||
|
Quote:
Hey thanks .... I got that button! Good...thanks sfb! Subha ![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > saving changes to scripts |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|