user3483711
user3483711

Reputation: 31

ImportError: No module named None

*** Test cases ***
TestDB
    Connect To Database Using Custom Params    None    database='TestDB', user='system', password='system', host='10.91.41.101', port=1521

Please help - the error is:

ImportError: No module named None

Upvotes: 2

Views: 1447

Answers (3)

Benjamin Andoh
Benjamin Andoh

Reputation: 345

I had a similar error and read on it for hours not knowing I hadn't created a .env file yet. credit to a friend who brought me to this page. (which gave me the hint on what I was missing). I created a .env file in my root folder where the manage.py file is and configured my database settings and voila. Thanks Suraj

Upvotes: 0

Todor Minakov
Todor Minakov

Reputation: 20077

The error most probably comes from the way you call Connect To Database Using Custom Params - the first argument you're passing, which should be the value for the dbapiModuleName, is passed as a string object, with the value "None".

If you wanted to call it with the value None object (as it's written in the library's help), that should have been ${None} in robotframework format.
I doubt that's going to work though - the DatabaseLibrary probably needs some DB type identifier. So if you are using postgres for example, you'd call it with "psycopg2":

Connect To Database Using Custom Params    psycopg2    database='TestDB', user='username', password='mypass', host='10.1.1.2', port=1521

Have in mind you'd need the DB driver already installed through pip, psycopg2 in the case of the example here.

P.S. please don't paste actual credentials in SO.

Upvotes: 2

Greg M
Greg M

Reputation: 326

I assume your question should have been posted something like this...


Issue

When attempting to execute the following test case in Robot Framework, I receive the following error: ImportError: No module named None

Here is the test case in question:

*** Test Cases ***
TestDB
    Connect To Database Using Custom Params None database='TestDB', user='system', password='system', host='10.91.41.101', port=1521

If so, your issue may be as simple as spacing. Robot Framework can accept pipes as delimiters, but if you choose to use spaces, you must use 2 or more.

Based on your copy/paste, it looks like you have only one space between Connect To Database Using Custom Params and None (which, I'm assuming you're specifying as the DB API Python module the system default - not sure if that's recommended or supported). Make sure you have at least two spaces (I generally try for 4 unless I have a lot of parameters) between keywords and their parameters.

So:

Upvotes: 0

Related Questions