importing scripts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Patrick C
    New Member
    • Apr 2007
    • 54

    importing scripts

    When I'm testing a script in PythonWin after I import it once, it won't recognize some changes i've made sometimes. Like if its a script to do a web scrape...
    the 1st time i try import testscript, it'll take the couple of seconds that is needed to do the scrape. thats good.

    Then lets say i change a part of the scrape. For example one thing i often do is have a text file where i have names. My script will take a name out of the text file hten use it in a web address in order to do a scrape. for example
    i'll have this pageroot "http://finance.google. com/finance?fstype= ii&q="
    then i'll take a name "ge" from a text file and use it to find this web page to go to ... "http://finance.google. com/finance?fstype= ii&q=ge".

    if i just import testscript again, then it won't recognize that i've changed the web address that i'm going to.

    Does that make sense, should that happen? if so, how cna i get around it w/o closing and reopening PythonWin.

    thanks
  • elcron
    New Member
    • Sep 2007
    • 43

    #2
    Import only works the first time its called for a module use reload instead.
    [code=python]
    import someScript # imports the script
    #...
    import someScript # does nothing
    #...
    reload(someScri pt) # reloads the script
    [/code]

    Comment

    Working...