title: Setting working direction to direction of the script in Python (pyinstaller)
body: <p>I have a pretty simple script that takes data from some .csv or .db files, performs manipulations and saves output in the similar files. I am working from Spyder with the parameter &quot;Run in the directory of the file&quot;, so when I run the file my wd is set to file's directory automatically. SO that I put all files in one folder and do not mess with paths (e.g. using always <code>open(&quot;data.csv&quot;)</code>). And my files are stored like:</p>
  <pre><code>/Users/username/docs/script.py
  /Users/username/docs/data.cv
  /Users/username/docs/database.db
  </code></pre>
  <p>I've tried to use <code>pyinstaller</code> to that colleagues could you the script easily as well, but any time they would run it, it would set the working directory to <code>/Users/username/</code> and all relative paths are getting broken.</p>
  <p>How could I preserve this issue, so that the script (pyinstaller shell script) would be taking as working directory the folder with its location, like Spyder is doing?</p>