question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Arguments are not working with 'textual run'

See original GitHub issue

Per textual run --help:

  If you are running a file and want to pass command line arguments, wrap the
  filename and arguments in quotes:

      textual run "foo.py arg --option"

This is not working. Using the following sample.py:

from textual.app import App, ComposeResult
from textual.widgets import Static
from sys import argv

class MyApp(App):
    def __init__(self, greeting: str="default") -> None:
        self.greeting = greeting
        super().__init__()

    def compose(self) -> ComposeResult:
        yield Static(f"{self.greeting}")

if __name__ == "__main__":
    if len(argv) > 1:
        app = MyApp(argv[1])
    else:
        app = MyApp()
    app.run()

When run via: python ./sample.py foo it returns a textual window with foo

When run via: textual run "./sample.py foo" it returns a textual window with default

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
davepcommented, Oct 31, 2022

@jspv Yup, as Will mentions, about 90 minutes before you mentioned it, we did https://github.com/Textualize/textual/pull/1070 which should address this. 😃

1reaction
willmcgugancommented, Oct 31, 2022

There’s a fix for this in master.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Eclipse: Running with argument and not finding text file
But Eclipse is telling me this error message. I am not sure why Eclipse cannot open the file.
Read more >
Adding arguments and options to your Bash scripts - Red Hat
Look at your $PATH variable, which contains /home/username/bin as one component. If the ~/bin directory does not exist, you can create it. Or ......
Read more >
Python Command Line Arguments
A command line interface (CLI) provides a way for a user to interact with a program running in a text-based shell interpreter.
Read more >
Command Line Arguments for Your Python Script
This tutorial is in three parts; they are: Running a Python script in command line; Working on the command line; Alternative to command...
Read more >
Sending arguments to LAStools function from Python script not ...
I suppose this has to do with the '' around the string, but every other executable file I have called from python in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found