Quantcast
Viewing all articles
Browse latest Browse all 4448

Can we send config file as parameter to python

@sachin123456 wrote:

Hi,
I have a requirement that need to run the 10 configurations file by single script
Currently my approach is the same code is reading the single config file, so I am copy paste the code and making the config file entry in the python code and run. – this runs

Now I am thinking to make this config file as parameter.

Example: python script.py configfile.py

this works but i am using the code like to import the config file.as showed below.
config=sys.argv[1]
import config as cfg

this fails as –
import config as cfg
ImportError: No module named ‘config’

Any help is much appreciated.

Thanks,
Sachin

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4448

Trending Articles