Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>According to <a href="http://www.samlogic.net/articles/32-64-bit-windows-folder-x86-syswow64.htm" rel="nofollow">this note</a>, the Program Files (x86) folder is specifically intended for 32-bit program files, as opposed to the Program Files folder, which is intended for 64-bit programs.</p> <p>But in order for a 32-bit program to pretend that it's on a 32-bit machine, the name of the working directory has to be returned as 'Program Files,' because that's what it would be on a 32-bit machine. This is what you're seeing when you ask Windows for the working directory with getcwd(). Since your program is trying to use that directory name in a path, and that's not actually the path to the file on the real, 64-bit machine, it breaks.</p> <p>Looking at the <a href="http://msdn.microsoft.com/en-us/library/aa384274.aspx" rel="nofollow">WOW64 docs</a>, I suspect the reason it only breaks when launched from the start menu is, that's an instance of a 64-bit process creating a 32-bit process, which causes the system to change the ProgramFiles environment variable. In the case where you double-click to launch it, it's a 32-bit process from the beginning.</p> <p>It seems you're not the only one to encounter this; <a href="http://msdn.microsoft.com/en-us/library/aa365744%28v=vs.85%29.aspx" rel="nofollow">this Windows API</a> seems designed specifically to work around the problem you're describing. If nothing else it suggests the behavior you're seeing is by design.</p> <p>But this is academic. To insulate yourself from this sort of thing, I would get the absolute path to your exe, using something like <code>os.path.realpath(__file__)</code>, and go from there.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload