Skip to main content
-1 votes
0 answers
42 views

I work on a script Python and I try to send args and use PyInstaller at same time. This is an example: #!/usr/bin/env python3 import argparse import sys print(sys.argv) parser = argparse....
Chlamy's user avatar
  • 35
1 vote
1 answer
83 views

I have a Python project that uses argparse. I noticed an unwanted behavior of argparse when parsing some unknown arguments. I use both known and unknown arguments. I have a parameter --list-installed. ...
Ashark's user avatar
  • 859
2 votes
1 answer
78 views

I am having trouble using add_argument's dest parameter with positional arguments. The reason I want this is that I use nargs='*' and it makes sense to me to have the argument name be singular so that ...
Dominik Kaszewski's user avatar
0 votes
2 answers
99 views

The following code from argparse import ArgumentParser parser = ArgumentParser() parser.add_argument('--foo', nargs='?') parsed_args = parser.parse_args() creates an optional argument with an ...
Jeyekomon's user avatar
  • 3,556
0 votes
1 answer
52 views

I derive some settings from my parser that I latter store on disk to be reloaded again, during the reload I want to overwrite some values but keep the first ones, similar to new default values. I want ...
Daraan's user avatar
  • 5,166
0 votes
1 answer
98 views

I have a custom Django management job created using django_extensions that deletes old database records. To avoid unintended deletions, I want to add a --dry-run argument to simulate deletions without ...
Raul Chiarella's user avatar
1 vote
2 answers
84 views

When I run my FastAPI app with the Uvicorn command, the command line args are not recognized: (env) mydir$ uvicorn main:app --port 8000 --host 0.0.0.0 --reload ... uvicorn: error: unrecognized ...
engineer-x's user avatar
  • 3,405
0 votes
1 answer
53 views

I got a script with a list of arguments defined with argparse. Because I want to have bullet points and line breaks in the help text, I added a custom formatter. That works like a charm but the ...
stefanos's user avatar
  • 105
0 votes
0 answers
56 views

I can run a script on the command line with an argument either as the bare "script.py arg1" or I can run it as "python script.py arg1". Both work until I use argparse for command ...
wgw's user avatar
  • 601
1 vote
0 answers
41 views

I'm writing a Flask app and I would like to automatically pass debug into app.run() when clicking the Pycharm 'Debug' button (instead of Run). I have argparse setup so that if --debug gets passed in ...
Serpent10i's user avatar
1 vote
3 answers
139 views

First of all, I cannot share the original code so I apologize in advance if the example used does not make sense. I also know the code I present has some issues and will not run as it is, but it is ...
Jaime 's user avatar
  • 143
0 votes
2 answers
98 views

I want to create a CLI using Python and argparse. The CLI should have options to specify a list of values, and also to dynamically specify the type of the values (str, int, float, etc.) in that list (...
Jake Levi's user avatar
  • 1,960
1 vote
1 answer
105 views

I have a CLI tool for managing Docker containers. Here's my current parser setup: def create_parser(): parser = argparse.ArgumentParser(description="Docker container manager") ...
Izaan's user avatar
  • 145
1 vote
2 answers
209 views

I've written some command-line tools that have certain options having both single-dash-one-letter-abbreviations (short-options), as well as more verbosely named double-dash options (long-options) - as ...
James Rowell's user avatar
0 votes
1 answer
81 views

I need to process command-line options from my Python script that correspond to the syntax tesy.py [-h] [-a [-b]] (This is just a simplistic example illustrating the problem; in reality my script has ...
bontchev's user avatar
  • 578

15 30 50 per page
1
2 3 4 5
243