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.

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.

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

sys.path.append("/path/to/custom/module")

very simple ;)

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

sys.path.append('/var/users/shop-II/kuch/Shop-II/src/cart/items')

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.