ImportError: No module named

Asked by Felipe on 2014-02-12

Hi,

I'm building a webservice with ladon that returns a list of objects.

Under the code of ladon:

#coding: utf-8

from ladon.ladonizer import ladonize
from ladon.types.ladontype import LadonType
from ladon.compat import PORTABLE_STRING
from DAO.ScheduleDAO import ScheduleDAO

class Schedule(LadonType):
    id = int
    propertiesId = int
    realtorId = int
    customerId = int
    comments = unicode

class UserService(object):

    @ladonize(PORTABLE_STRING,rtype=[Schedule])
    def sendShedule(self,realtorId):
        try:
            scheduleList = []
            schedules = ScheduleDAO().selectScheduleRealtor(realtorId)
            for schedule in schedules:
                scheduleUnit = Schedule()
                scheduleUnit.id = schedule.id
                scheduleUnit.propertiesId = schedule.propertiesId
                scheduleUnit.realtorId = schedule.realtorId
                scheduleUnit.customerId = schedule.customerId
                scheduleUnit.comments = schedule.comments
                scheduleList.append(scheduleUnit)
                del scheduleUnit
            return scheduleList
        except:
            print 'Erro ScheduleWs '

The extrutura my program will the following:

www
├── Business
│   └── Schedule.pyc
├── DAO
│ ├── __init__.py
│   └── ScheduleDAO.py
└── WS
    ├── handler.py
    ├── __init__.py
    └── ScheduleWS.py

When running the WS (http://54.207.37.29/ws) the following error appears:

ImportError: No module named DAO.ScheduleDAO

The DAO.ScheduleDAO module, as the name implies, is part of a package in which I perform the query on the database and return the arraylist of objects.

Have recreated several times a DAO class as well as the WS itself but nothing worked.

I would like your help for my case.

I looked on the internet, the scarce listed here and nothing is like mine!

Thank you!

Question information

Language:
English Edit question
Status:
Solved
For:
ladon Edit question
Assignee:
No assignee Edit question
Solved by:
Felipe
Solved:
2014-02-13
Last query:
2014-02-13
Last reply:
Felipe (felipescabral) said : #1

I add in ScheduleWS.py

import sys
sys.path.append('ROOT_DIRECTORY')

Thanks everybody.