Is it possible to pass arguments to a python made exe at runtime?
<p>I'm experimenting with file I/O. I have a small practice program that creates a text file when run. I packaged it with pyinstaller so that double clicking on the exe creates a new folder and places a text file with "hello world" inside of it. Easy peasy. </p>

<p>Then I started wondering about <code>main()</code>. This is just a function like any other, right? So does that mean I can pass arguments to it at runtime? </p>

<p>I was thinking about the Steam client and how you can put stuff like '-dev' and '-console' in the shortcut. Is there a way to do this to a python exe that I have made? </p>

<p>I may be explaining terribly, so here's an example: </p>

<pre><code>def makeFile(string):
    if string:
        f = open('mytext.txt', 'w') #create text file in local dir
        print &gt;&gt; f, 'hello, ' + string + '! \nHow are ya?'
        f.close()
    else:
        f = open('mytext.txt', 'w') #create text file in local dir
        print &gt;&gt; f, 'hello, person! \nHow are ya?'
        f.close()

def main(string = None):
    makeFile(string)     
</code></pre>

<p>So if I take this code and make it an exe, would I be able to add my optional arguments somehow.  </p>

<p>I tried the above code, and the running <code>test.exe --"myname"</code> but that didn't work. </p>

<p>Is there a way to do this? </p>
