mirror of
				https://github.com/python-escpos/python-escpos
				synced 2025-10-23 09:30:00 +00:00 
			
		
		
		
	fix inconsistent behaviour of argparse-code
this affected certain versions of argparse in python3
This commit is contained in:
		| @@ -456,7 +456,10 @@ def main(): | ||||
|     # cli [subparser] -args | ||||
|     command_subparsers = parser.add_subparsers( | ||||
|         title='ESCPOS Command', | ||||
|         dest='parser', | ||||
|     ) | ||||
|     # fix inconsistencies in the behaviour of some versions of argparse | ||||
|     command_subparsers.required = False   # force 'required' testing | ||||
|  | ||||
|     # Build the ESCPOS command arguments | ||||
|     for command in ESCPOS_COMMANDS: | ||||
| @@ -522,6 +525,9 @@ def main(): | ||||
|  | ||||
|     target_command = command_arguments.pop('func') | ||||
|  | ||||
|     # remove helper-argument 'parser' from dict | ||||
|     command_arguments.pop('parser', None) | ||||
|  | ||||
|     if hasattr(printer, target_command): | ||||
|         # print command with args | ||||
|         getattr(printer, target_command)(**command_arguments) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Patrick Kanzler
					Patrick Kanzler