Further note: widen the window, this has long strings in it ... and is PURELY for edification.
To work around a problem between my ISP and my router, I have to make my router RELogin the PPPoE every time the wan ip changes. Which is not hard, it's a http string in a browser to log in, followed by a pause and a second http string to make the magic internet return, and my DDNS client is very good at telling when the internet ceases to work. While I am a relative code noob, this with a sleep.py was hacked out in 30 minutes (after some testing). But being a perfectionist, I wanted to do it entirely in python. <psudocode> import os,time os.spawn(os.P_NOWAIT,browser,[logincommand]) time.sleep(20) os.spawn(os.P_NOWAIT,browser,[relogcommand]) exit </psudocode> I have been hacking at getting os.spawnv to do what I want it to, with no luck. The 'want' is a simple one, open a browser (in this case IE) to a given URL. Like; YOUR PROMPT HERE> "C:/Program Files/Internet Explorer/Iexplore.exe" http://www.yahoo.com Which functions as expected. Even os.system('"C:\Program Files\Internet Explorer\Iexplore.exe" http://www.yahoo.com') Works, but waits for the browser to close to return, and I need an immediate return. Here are some things I've tried ... # Yields: Just Opens IE Successfully As expected! # os.spawnv(os.P_NOWAIT,"C:/Program Files/Internet Explorer/Iexplore.exe", []) # os.spawnv(os.P_NOWAIT,'C:/Program Files/Internet Explorer/Iexplore.exe', []) # Yields: Invalid Argument - forward slash, full command string # os.spawnv(os.P_NOWAIT,'"C:/Program Files/Internet Explorer/Iexplore.exe" www.yahoo.com',[]) # os.spawnv(os.P_NOWAIT,'C:/Program Files/Internet Explorer/Iexplore.exe http://www.yahoo.com',[]) # os.spawnv(os.P_NOWAIT,'"C:/Program Files/Internet Explorer/Iexplore.exe" http://www.yahoo.com',[]) # os.spawnv(os.P_NOWAIT,'"C:/Program Files/Internet Explorer/Iexplore.exe" http:////www.yahoo.com',[]) # os.spawnv(os.P_NOWAIT,r'C:/Program Files/Internet Explorer/Iexplore.exe http://www.yahoo.com',[]) # os.spawnv(os.P_NOWAIT,r'"C:/Program Files/Internet Explorer/Iexplore.exe" http://www.yahoo.com',[]) # Yields: No such file or directory # os.spawnv(os.P_NOWAIT,'C:/Program Files/Internet Explorer/Iexplore.exe www.yahoo.com',[]) # Yields: Opens IE Successfully - Yet No ARG Passed to browser # os.spawnv(os.P_NOWAIT,"C:/Program Files/Internet Explorer/Iexplore.exe", ['www.yahoo.com']) # os.spawnv(os.P_NOWAIT,"C:/Program Files/Internet Explorer/Iexplore.exe", ["www.yahoo.com"]) # os.spawnv(os.P_NOWAIT,"C:/Program Files/Internet Explorer/Iexplore.exe", ['"www.yahoo.com"']) # os.spawnv(os.P_NOWAIT,"C:/Program Files/Internet Explorer/Iexplore.exe", [r'www.yahoo.com']) # os.spawnv(os.P_NOWAIT,"C:/Program Files/Internet Explorer/Iexplore.exe", [r"www.yahoo.com"]) # os.spawnv(os.P_NOWAIT,"C:/Program Files/Internet Explorer/Iexplore.exe", [r'"www.yahoo.com"']) # os.spawnv(os.P_NOWAIT,"C:/Program Files/Internet Explorer/Iexplore.exe", ['"http://www.yahoo.com"']) # os.spawnv(os.P_NOWAIT,"C:/Program Files/Internet Explorer/Iexplore.exe", ["http://www.yahoo.com"]) # os.spawnv(os.P_NOWAIT,"C:/Program Files/Internet Explorer/Iexplore.exe", ['http://www.yahoo.com']) # os.spawnv(os.P_NOWAIT,"C:/Program Files/Internet Explorer/Iexplore.exe", ['"http:////www.yahoo.com"']) # os.spawnv(os.P_NOWAIT,"C:/Program Files/Internet Explorer/Iexplore.exe", ["http:////www.yahoo.com"]) # os.spawnv(os.P_NOWAIT,"C:/Program Files/Internet Explorer/Iexplore.exe", ['http:////www.yahoo.com']) # os.spawnv(os.P_NOWAIT,"C:/Program Files/Internet Explorer/Iexplore.exe", [r'"http://www.yahoo.com"']) # os.spawnv(os.P_NOWAIT,"C:/Program Files/Internet Explorer/Iexplore.exe", [r"http://www.yahoo.com"]) # os.spawnv(os.P_NOWAIT,"C:/Program Files/Internet Explorer/Iexplore.exe", [r'http://www.yahoo.com']) # os.spawnv(os.P_NOWAIT,'C:/Program Files/Internet Explorer/Iexplore.exe', ['www.yahoo.com']) # os.spawnv(os.P_NOWAIT,'C:/Program Files/Internet Explorer/Iexplore.exe', ["www.yahoo.com"]) # os.spawnv(os.P_NOWAIT,'C:/Program Files/Internet Explorer/Iexplore.exe', ['"www.yahoo.com"']) # os.spawnv(os.P_NOWAIT,'C:/Program Files/Internet Explorer/Iexplore.exe', [r'www.yahoo.com']) # os.spawnv(os.P_NOWAIT,'C:/Program Files/Internet Explorer/Iexplore.exe', [r"www.yahoo.com"]) # os.spawnv(os.P_NOWAIT,'C:/Program Files/Internet Explorer/Iexplore.exe', [r'"www.yahoo.com"']) # os.spawnv(os.P_NOWAIT,'C:/Program Files/Internet Explorer/Iexplore.exe', ['"http://www.yahoo.com"']) # os.spawnv(os.P_NOWAIT,'C:/Program Files/Internet Explorer/Iexplore.exe', ["http://www.yahoo.com"]) # os.spawnv(os.P_NOWAIT,'C:/Program Files/Internet Explorer/Iexplore.exe', ['http://www.yahoo.com']) # os.spawnv(os.P_NOWAIT,'C:/Program Files/Internet Explorer/Iexplore.exe', ['"http:////www.yahoo.com"']) # os.spawnv(os.P_NOWAIT,'C:/Program Files/Internet Explorer/Iexplore.exe', ["http:////www.yahoo.com"]) # os.spawnv(os.P_NOWAIT,'C:/Program Files/Internet Explorer/Iexplore.exe', ['http:////www.yahoo.com']) # os.spawnv(os.P_NOWAIT,'C:/Program Files/Internet Explorer/Iexplore.exe', [r'"http://www.yahoo.com"']) # os.spawnv(os.P_NOWAIT,'C:/Program Files/Internet Explorer/Iexplore.exe', [r"http://www.yahoo.com"]) # os.spawnv(os.P_NOWAIT,'C:/Program Files/Internet Explorer/Iexplore.exe', [r'http://www.yahoo.com']) The issue seems to be passing the [argument] to the program .. Even example source I've found on the net has Sorry about the widthspam, any suggestions? -- AND as I always search after I've completely written my message, I found a tip from Richard Chamberlain in July of 2000 http://mail.python.org/pipermail/tutor/2000-July/001759.html. Says the path/file has to be in the list. # Yields Browser with 'http://files/Internet%20Explorer/Iexplore.exe%20www.yahoo.com' string in it. # os.spawnv(os.P_NOWAIT,"C:/Program Files/Internet Explorer/Iexplore.exe", ["C:/Program Files/Internet Explorer/Iexplore.exe", 'www.yahoo.com']) # same as above, But WHY can't it take long file names? # os.spawnv(os.P_NOWAIT,"C:/Program Files/Internet Explorer/Iexplore.exe", [r"C:/Program Files/Internet Explorer/Iexplore.exe", 'www.yahoo.com']) # Yields Browser with 'http://explorer/Iexplore.exe%20www.yahoo.com' # os.spawnv(os.P_NOWAIT,"C:/Program Files/Internet Explorer/Iexplore.exe", ["C:/Progra~1/Internet Explorer/Iexplore.exe", 'www.yahoo.com']) # Finally! Yields browser with www.yahoo.com in it, but took 8.3 format in the list. os.spawnv(os.P_NOWAIT,"C:/Program Files/Internet Explorer/Iexplore.exe", ["C:/Progra~1/Intern~1/Iexplore.exe", 'www.yahoo.com']) Man was this the most unpythonesque oddity I've seen in python. Why in the world doesn't the http://www.python.org/doc/2.4/lib/os-process.html state that the program name is required twice? Ok, the example DOES show it, but that is it ... it's left unsaid. AND it functions with an empty list if there are no arguments ... # Interesting guess it's just a syntaxism of os.spawnv os.spawnv(os.P_NOWAIT,'C:/Program Files/Internet Explorer/Iexplore.exe',['foob',r'http://www.yahoo.com']) -- To sum it up; <psudocode> import os,time os.spawn(os.P_NOWAIT,browser,["ignorethis",logincommand]) time.sleep(20) os.spawn(os.P_NOWAIT,browser,["ignorethis",relogcommand]) </psudocode> -- OT: Fun with spellchecker in this message; RELogin = Religion PPPoE = Pope IP = imp psucodoce = pseudopodia sleep.py = sloppy os,time = costume -- Programmer's mantra; Observe, Brainstorm, Prototype, Repeat David Broadwell _______________________________________________ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor