Python run.py Error during Executing

I also Rename the dotini (windows) to dotini.ini
But Still, this error comes:

Traceback (most recent call last):
File “run.py”, line 13, in
app.config[‘MFLIX_DB_URI’] = config[‘PROD’][‘MFLIX_DB_URI’]
File “C:\Users\Lenovo\Anaconda3\lib\configparser.py”, line 958, in getitem
raise KeyError(key)
KeyError: ‘PROD’

1 Like

I am receiving the exact same error.

Please make sure your .ini file is renamed and you are running the tests from directory mflix-python and not tests.

Kanika

Already, I am using this directory for
running the tests from directory mflix-python and not tests

Please share the contents of .ini file here.

Kanika

1 Like

@Kanika, I’m receiving the same error. Thanks in advance! Here is the contents of my .ini file:

# Ticket: Connection

# Rename this file to .ini after filling in your MFLIX_DB_URI and your SECRET_KEY

# Do not surround the URI with quotes

[PROD]

SECRET_KEY = super_secret_key_you_should_change

MFLIX_DB_URI = mongodb+srv://m220student:m220password@mongodb-courses-1n3ap.azure.mongodb.net/test?retryWrites=true&w=majority

MFLIX_NS = sample_mflix

[TEST]

SECRET_KEY = super_secret_testing_key

MFLIX_DB_URI = mongodb+srv://m220student:m220password@mongodb-courses-1n3ap.azure.mongodb.net/test?retryWrites=true&w=majority

MFLIX_NS = sample_mflix

@dexter9, were you able to find a solution? I’m receiving the same error.

1 Like

Hi @Kanika,

I am having trouble with this issue as well. The error message is as below. I have saved the file as .ini and also have changed the MFLIX_DB_URI accordingly. Any suggestions? Thanks

Traceback (most recent call last):
File “run.py”, line 13, in
app.config[‘MFLIX_DB_URI’] = config[‘PROD’][‘MFLIX_DB_URI’]
File “C:\Users\YUIB\Anaconda3\lib\configparser.py”, line 958, in getitem
raise KeyError(key)
KeyError: ‘PROD’

1 Like

Hi,

I edited the file run.py in the mflix-python folder.

app.config[‘MFLIX_DB_URI’] = “mongodb+srv://m220student:@mflix-duixg.mongodb.net/test?retryWrites=true&w=majority#config[‘PROD’][‘MFLIX_DB_URI’]
app.config[‘MFLIX_NS’] = “sample_mflix”#config[‘PROD’][‘MFLIX_NS’]
app.config[‘SECRET_KEY’] = “super_secret_key_you_should_change”#config[‘PROD’][‘SECRET_KEY’]

Now , it reads the values directly from this file. This worked for me. (PS- It’s a kind of work around)

Dexter

1 Like

@dexter9, Thanks! I’ll give this a try as soon as I get a chance.

The .ini file looks great. Make sure you are running the tests from mflix-python directory and not mflix one.

Kanika

It is a simple issue just rename the .ini file…
For example dotini is changes into only .ini dont use prefix for the filename


kanikasingla

      Curriculum Support Engineer




    August 26

paragonss:

Ticket: Connection # Rename this file to .ini after filling in your MFLIX_DB_URI and your SECRET_KEY # Do not surround the URI with quotes [PROD] SECRET_KEY = super_secret_key_you_should_change MFLIX_DB_URI = mongodb+srv://m220student:m220password@mongodb-courses-1n3ap.azure.mongodb.net/test?retryWrites=true&w=majority MFLIX_NS = sample_mflix [TEST] SECRET_KEY = super_secret_testing_key MFLIX_DB_URI = mongodb+srv://m220student:m220password@mongodb-courses-1n3ap.azure.mongodb.net/test?retryWrites=true&w=majority MFLIX_NS = sample_mflix

The .ini file looks great. Make sure you are running the tests from mflix-python directory and not mflix one.

Kanika


Visit Topic or reply to this email to respond.


In Reply To


paragonss

    August 25

@kanikasingla
, I’m receiving the same error. Thanks in advance! Here is the contents of my .ini file: # Ticket: Connection

Rename this file to .ini after filling in your MFLIX_DB_URI and your SECRET_KEY

Do not surround the URI with quotes

[PROD]
SECRET_KEY = super_secret_key_you_should_chan…


Visit Topic or reply to this email to respond.

To unsubscribe from these emails, click here.

Please consider the environment before
printing this mail

The
information contained in this e-mail is private & confidential and may also
be legally privileged. If you are not the intended recipient of this mail,
please notify us, preferably by e-mail; and do not read, copy or disclose the
contents of this message to anyone. Whilst we have taken reasonable precautions
to ensure that any attachment to this e-mail has been swept for viruses, e-mail
communications cannot be guaranteed to be secure or error free, as information
can be corrupted, intercepted, lost or contain viruses. We do not accept
liability for such matter or their consequences

Vinay is correct. in the run.py file it look for .ini and on my computer I had rename the dotini_win to dotini_win.ini per instruction and run.py was not able to find that. I could not rename the file to .ini on my computer so I modify “.ini” in run.py to dotini_win.ini and was able to get pass the error.

config = configparser.ConfigParser()
config.read(os.path.abspath(os.path.join(".ini")))ni

1 Like

lol yes, this fixed it. Thanks everyone!