New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 651565 link

Starred by 1 user

Issue metadata

Status: Verified
Owner: ----
Closed: Oct 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

[autotest]Not able to import module from newly created directory

Project Member Reported by bmahadev@chromium.org, Sep 29 2016

Issue description

I have a tarball and some python files that the server side tests would need. I tried to create directory under cros/network/packet_gen and put my files there. But the test failed to import module from this directory.
Also tried creating a parallel dir under cros itself that also failed to import. All goes well if i put my files without creating a dir. But i would like to put them under one dir because the are conceptually related. Is there a reason why i can't create new directory under these existing autotest directors ?
 

Comment 1 by dshi@chromium.org, Sep 29 2016

How do you import the module? If you do it through autotest_lib, you need to create a common.py file in that new directory for autotest to be able to locate the module.
Cc: harpreet@chromium.org
Yes, i import through autotest_lib.

I created a common.py in the new dir, but still throws module error.

16:26:56 INFO | autoserv| from autotest_lib.server.cros.packet_generation import IP_utils
16:26:56 INFO | autoserv| ImportError: No module named packet_generation

Comment 4 by dshi@chromium.org, Sep 29 2016

Seems there is a mismatch:
cros/network/packet_gen
autotest_lib.server.cros.packet_generation import IP_utils

What's the new directory exactly?
The new dir is server/cros/packet_generation, imported as 
"from autotest_lib.server.cros.packet_generation import IP_utils". It contains a file with helper methods and files that will be copied over to the router.


Comment 6 by dshi@chromium.org, Sep 29 2016

check if there is any pyc files in server/cros/packet_generation, delete them.

Upload the cl so one can try to reproduce it.

Comment 8 by autumn@chromium.org, Oct 12 2016

Is this issue still outstanding?
Status: Verified (was: Untriaged)
The issue is resolved. Was able to import after creating the common.py and __init__.py files in that dir.

Sign in to add a comment