sys module giving different output when running Python script through IDLE and by double-clicking the script -


i trying python directory executing scripts there. found odd behavior.

this sample code pointing out specific problem. place path variable further use.

i placed code in script

import sys print sys.executable[: - len('pythonw.exe')] raw_input() 

the output when run through idle

c:\python27\ 

the output when run double clicking script

c:\python27 

i don't understand going on here. why different formats? should consistent or missing something?

print os.path.dirname(sys.executable) 

is should use.

when click it running through python.exe removing char w.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -