0

I am trying to run my Python code as Cython. I have successfully gotten the simple hello world examples working and imported.

When I try to import my new file, Traffic_Data2 I receive an error:

import Traffic_Data2

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "cbTraffic/Traffic_Data2.pyx", line 1, in init cbTraffic.Traffic_Data2 (Traffic_Data2.c:4255)
import requests
SystemError: Parent module '' not loaded, cannot perform relative import

I was not sure if there is something I need to add to my setup.py file to have it import the requests module.

Any help will be appreciated.

Chad Crowe
  • 1,260
  • 1
  • 16
  • 21
  • Can you show the content of that file? – OneCricketeer Dec 05 '16 at 21:24
  • Without seeing a full example it's impossible to say, but I'd guess this is a duplicate of http://stackoverflow.com/questions/35040754/cython-relative-import-error-even-when-doing-absolute-import – DavidW Dec 05 '16 at 22:48
  • 1
    I realize this is really old question but it's telling you the parent module hasn't been loaded, so I assume you probably need to import `cbTraffic` first, either with `import cbTraffic.Traffic_Data2` or something like `from cbTraffic import Traffic_Data2` – rydrman Oct 13 '17 at 23:25

0 Answers0