Search code examples
pythoncommand-line-interfaceexecpyinstaller

How can I run an exec file that ouputs a csv without using `--user` in Mac?


I created an executable on my Mac that runs Python code. It creates a csv file.

When I run the file on its own without freezing it using Pyinstaller, it works fine on both Windows and Mac. Then, when I do freeze it, it works fine, but it won't output the csv file on Mac (it does on Windows).

It will only work if I run the exec file in the CLI with --user.

I've already tried giving it permissions in the System Preferences, and in the Sharing & Permissions section of the info window. To no avail.

Is there anything I may have overlooked that others may know about?

Thanks, in advance!


Solution

  • It turns out that the file was being output in the user folder and not in the same folder as the exec file.

    For those of you working on Python scripts and freeze them using Pyinstaller, remember that files that you output are placed in your user folder on Mac.