#๐Ÿ”’ Docopt not playing nicely with pyinstaller packaging?

14 messages ยท Page 1 of 1 (latest)

remote questBOT
#

@tidal leaf

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

tidal leaf
#

Uh...

#

Did my original message get deleted?

#

<@&831776746206265384>

feral minnow
# tidal leaf Did my original message get deleted?

I have a main.py script defined as such:

def main():
    args = docopt(__doc__, version=f'ZephIR {__version__}')

    dataset = Path(args['--dataset']).parent
    filename = Path(args['--dataset']).name

    if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
        print('Running deployed...')
        # freeze_support()
        # manager = Manager()
    else:
        print('Running in a normal Python process...')

    run_zephir(
        dataset=dataset,
        filename=filename,
        args=args
    )


if __name__ == '__main__':
    main()

Which I package using pyinstaller as such:

pyinstaller main.py --hidden-import=xml.etree --hidden-import=xml.etree.ElementTree --hidden-import=scikit-image --onedir

However, when I actually run the app, I get a usage message print, suggesting a failure in argument parsing:

main.exe --dataset "D:\venkatachalam\20220327_h2.h5" --load_checkpoint=False --load_args=True --allow_rotation=False --clip_grad=-1 --cuda=False --dimmer_ratio=0 --exclude_self=True --fovea_sigma=2.5 --gamma=2 --grid_shape=25 --include_all=True --lambda_d=-1 --lambda_n=5 --lambda_n_mode="disp" --lambda_t=-1 --load_nn=True --lr_ceiling=0.2 --lr_coef=2 --lr_floor=0.02 --motion_predict=False --n_chunks=10 --n_epoch=40 --n_epoch_d=10 --n_frame=1 --nn_max=0 --save_mode="o" --sort_mode="similarity" --z_compensator=-1

I've attached the file's doc string to this post, and far as I can tell, everything should work just fine. Am I missing something?

#

(the bot deletes messages with attachments)

#

If you want to paste a lot of text:

#

!paste

remote questBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

remote questBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.