S
S
semolex2014-09-11 12:31:00
Python
semolex, 2014-09-11 12:31:00

How to properly pass arguments to CLI using Argh (Python)?

Hello!
There is the following problem:
There is a file with a class.
There is a file run.py
There is a file with a class instance.
So, with the help of run.py, I have to run a file with a class instance, passing its name as a command line argument and passing some parameter (validation code) for the method of this class.
That is, python run.py -d my_module, -v 777
you need to use the argh library.
So far, there is no way to do it in such a way as to import the necessary file with the instance, and even pass the value to the method of this instance.
Hope you can help, thanks!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
s1dney, 2014-09-11
@s1dney

Where is the code exactly?

Y
yttrium, 2014-09-11
@yttrium

Use the standard optparse from the standard library. This is the standard approach.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question