We have a module called "cart.items" and imported this in another PY code to use classes.
I did import classed under cart.items like ("from cart.ltems import Items") and used Items class in my code. When I run my PY code in UNIX box, I get that problem. What I ve missing to run this script in UNIX shell.

7 Years
Discussion Span
Last Post by richieking

It would be something like
from cart import items
if cart.py is the name of the file. But without knowing what type of object cart and items are, there is no real way to answer the question. Post a simplified example.

Edited by woooee: n/a


Thanks woooee for your reply.
Ok here is another point I missed and also I give example as you asked.
Earlier I used to run the script in eclipse which opens from UNIX environment but not in shell.

EX:- test_script.py

from cart.items import Items

obj = Items()
items_list = obj.getAllItems()


There are 2 things here that you must check up.

1. If the module exists in the same project in IDE(eclipse) it should call that for you. But i have a problem with eclipse as it default to jython and custom modules are not that consistant.

You can change the default jython anyway.

2. to be on the safe side, you can append your module to the python module path and python will include that in its module search.

import sys


very simple ;)

Edited by richieking: n/a


Uh.. I did that too, but the same problem



move you module to your home dir and try appending again
maybe it might be permission stuff

Edited by richieking: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.