简体   繁体   中英

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?

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.

EXE中的options参数仅适用于python解释器( ref

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM