[Python] Adding arguments to python file using .replit file dose not work

Problem description:
If you have a python program that uses the argparse module to parse arguments, and you want the run button to run the program /w those arguments, it won’t work no matter how hard you try.

Expected behavior:
When I change the run command to run a python file /w arguments, for it to not error when I click run.

Actual behavior:

usage: main.py [-h] foo
main.py: error: the following arguments are required: foo
repl process died unexpectedly: exit status 2

Steps to reproduce:

 1. Create a new python repl
 2. Open main.py and import argparse
 3. Now create an argument (preferably a positional one) /w any name
 4. Finally add `[parser].parseargs()` for the last line
 4. Click the 3 dots and press 'show hidden files`
 5. Next find the ".replit"  file and click it
 6. Go to the run line and edit the command to run use argument
 7. RUN

PART 1

Part 1

PART 2

Part 2

PART 3

Part 3

PART 3

Part 4

Bug appears at this link:

https://replit.com/@ErrorbotTHE2nd/argpaser-glich#main.py

Browser/OS/Device:

Browser: Chrome
OS: Chrome OS (Build 107.0.5304.110)
Device: Acer C871 Chromebook

Hey @ErrorbotTHE2nd!

Thank you for reporting this issue. I have sent this to the team and will let you know as soon as I have an update!

If you remove or comment out the “[interpreter]” section, that will let the console act like a shell and allow you to give it arguments via the run command, as shown in this screenshot:

Please let me know if that works!

1 Like

Altho this is a solution, it is still a bug!

tnx :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.