may
may

Reputation: 1185

Running my file from the terminal Pycharm

I am trying to do something that I am following in a tutorial. The code is for testing a dictionary and it is as it follows:

cd = ConfigDict('config_file.txt')


if len(sys.argv) == 3:

    key = sys.argv[1]
    value = sys.argv[2]
    print('writing data:  {}, {}'.format(key, value))

    cd[key] = value

else:

    print('reading data')
    for key in cd.keys():
        print('   {} = {}'.format(key, cd[key]))

To test one can enter the name of the file alone or with the testing cases direct to the terminal as you can see below:

here I am using Pycharm and I did not find a way to do the same as it is done on this tutorial. I tried to Open on Terminal and to change

*Run->Edit Configurations -> Run with python console

or

Run->Edit Configurations -> Emulate terminal in output console*

enter image description here

I did not figure how to run it with the python file and the inputs to tests. Any hints are highly appreciated!

Upvotes: 0

Views: 1368

Answers (1)

Reblochon Masque
Reblochon Masque

Reputation: 36652

You can go to run/debug configurations, then enter the command line settings/parameters in the appropriate field:

enter image description here

You have a similar option in the tests settings to add parameters to test runs.

Upvotes: 2

Related Questions