Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python 3 - "ImportError: No module named …"

I'm getting an error ImportError: No module named core.text
I'm using 'ActivePython-3.2.2.3-win64-x64' Actually, it was working fine in 32-bit win7. But recently, I have installed 64-bit win7. And now when I'm trying to run the same file again, it gives me an error. My directory structure:

my_SQLi.py
core
   text.py

So, I am clueless at this moment. Why it's throwing an error!!! Where and what changes I should make?

like image 662
magneto Avatar asked Dec 12 '25 14:12

magneto


1 Answers

You need to have a __init__.py file inside the core directory: this makes it a package, meaning you can access sub-modules with the "dotted" syntax core.text. The __init__.py file can be empty.

Reference: http://docs.python.org/3.3/tutorial/modules.html#packages

like image 186
Eric O Lebigot Avatar answered Dec 14 '25 14:12

Eric O Lebigot



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!