1

i have been using imdbpy for some time. I was interested in making a very basic webservice to return json data.

I have a basic system working earlier today however after a reboot i now get the following error AssertionError: Import cycle in /home/prog/www/imdb/imdb.py.

the code is being ran using mod_python. which 100% works. the following lines seem to be the problem

#!/usr/bin/env python
import imdb
from mod_python import apache

def handler(req):
        req.content_type = "text/plain"
        req.write("test")
        return apache.OK

if i comment the import imdb test is printed.

Any help would be great

1 Answer 1

2

I guess this could be the problem: You named your file "imdb.py". Rename it and the problem could be solved.

Explication: When importing imdb, python finds your module before finding the imdb-package that you initially wanted to import (because current folder is listed in PYTHONPATH before the the standard python library). So basically you import yourself.

2
  • thanks for your reply. I have pulled my hair out trying to get that to work. It is such an obvious mistake that i was blinded. Many thanks. Commented Nov 15, 2011 at 22:42
  • 1
    Don't blame yourself. This is the most frequent cause of errors reported by python developers on SO... Commented Nov 15, 2011 at 23:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.