Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyInstaller 3.2, how to "bundle" arguments?

I'm using PyInstaller 3.2 to package a Web.py app. Typically, with Web.py and the built-in WSGI server, you specify the port on the command line, like

$ python main.py 8091

Would run the Web.py app on port 8091 (default is 8080). I'm bundling the app with PyInstaller via a spec file, but I can't figure out how to specify the port number with that -- passing in Options only seems to work for the 3 given ones in the docs. I'm tried:

exe = EXE(pyz,
          a.scripts,
          [('8091', None, 'OPTION')],
          a.binaries,
          a.zipfiles,
          a.datas,
          name='main',
          debug=False,
          strip=False,
          upx=True,
          console=False )

But that doesn't seem to do anything. I didn't see anything else in the docs -- is there another way to bundle / specify / include command-line arguments to the PyInstaller spec file?

like image 233
user Avatar asked Nov 20 '22 01:11

user


1 Answers

So very hacky, but what I wound up doing was to just append an argument in sys.argv in my web.py app...

sys.argv.append('8888')
app.run()

I also thought in my spec file I could just do:

a = Analysis(['main.py 8888'],

But that didn't work at all.

like image 68
user Avatar answered Dec 15 '22 13:12

user