python - pyinstaller causing weird issues -


i trying use pyinstaller create standalone exe of script wrote, have done in past -f flag. time around, having issue.

the exe builds fine , can run, when run cmdline arguments besides -h (help), program repeatedly prints "argument -f/--file required" (which is). happens if put -f 'filename', , program supposed exit on error, hangs , repeatedly prints error.

has seen similar issue this? .py file runs expected build exe starts exhibiting weird behavior.

edit:

okay, have done little more research , thinking issue weirder... have argparse stuff separated own function, such:

def parseargs(): ''' parse command line arguments ''' parser = argparse.argumentparser(description="desc") parser.add_argument('-f', '--file', required=true, dest='input_file', help='text file containing list of hosts') parser.add_argument('-p', '--processors', required=false, dest='processors', help='specify number of processors use. if omitted \                         default use many processors available')   parser.add_argument('-v', '--verbose', required=false, action='store_true', help='print additional output console', default=false) parser.add_argument('-u', '--unc', required=false, dest='unc_path', help='unc path copy results to. if omitted, results need copied \                         off later. format unc path normal, trailing backslash, i.e. \\\\server\path\share\\', default='')  args = parser.parse_args()  # check unc path , fix issues trailing slashes, etc. if args.unc_path != '':     args.unc_path = args.unc_path.replace('\\', '\\\\')  return args 

this called in main function. have found portion of program works fine. have stdout output @ point in main function after parseargs() called , see on screen normal.

what's strange after 1 of (completely unrelated parseargs()) functions called, getting output if there error arguments gave (which there not, keep in mind works .py file, not after packaging exe).

if makes difference, function calling used copy files number of remote hosts (using xcopy) using pool.map() split work among subprocesses.

does have idea why seeing output related argparse after portion of program has finished executing?

another edit: seem has multiprocessing because argparse errors come overlap (as said same error telling me -f required repeatedly prints screen).

thanks in advance!


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -