Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here is your problem:</p> <pre><code>sys.path.append('F:\Program Files\Python26\Lib\site-packages\py2exe') </code></pre> <p>A backslash (<code>\</code>) is an <a href="http://en.wikipedia.org/wiki/Escape_character" rel="nofollow noreferrer" title="escape character">escape character</a> and interperted in a special way by almost all programming languages, including Python.</p> <p>It's unfortunate that DOS (And by extension Windows) also uses the backslash as a directory separator instead of a a slash. <a href="https://superuser.com/questions/176388/why-does-windows-use-backslashes-for-paths-and-unix-forward-slashes" title="there is a bit of history behind this">There is a bit of history behind this</a>...</p> <p>In any case, you have a few options:</p> <p>Use slashes. Python will convert them to backslashes internally.</p> <pre><code>d = 'C:/Program Files/' </code></pre> <p>Use two backslahes, this will escape the backslashes and insert a single backslashes.</p> <pre><code>d = 'C:\\Program Files\\' </code></pre> <p>Use a "raw" string which doesn't interpret escape character. Do this by adding a <code>r</code> before the string.</p> <pre><code>d = r'C:\Program Files\' </code></pre> <p>I personally prefer the first solution. But I've seen the other two being used quite a bit too. Note that this also works the other way around, so if you use backslashes Python will convert it to slashes on UNIX and Linux systems.</p> <p>As a free bonus hint, this may also be a good place to point out the <a href="http://docs.python.org/library/os.path.html#os.path.join" rel="nofollow noreferrer" title="os.path.join&#40;&#41;">os.path.join()</a> function :)</p>
 

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