3

I had everything installed good on my laptop. Everything was working. Today when i wanted to work with my projects again just everything suddenly gives an error on imports. It's not just one package, but multiple. The only thing I could think of is Windows Update, but actually I doubt this would be the cause of the problem.

I have everything installed in 32-bit since some packages were only 32-bit. I already reinstalled everything and restarted several times. I'm not very experienced with Python, so thats why I'm wondering if anybody with more knowledge could help me with this.

The packages installed are: CherryPy, Cython, Oursql, PIL, pywin32, setuptools

Thanks in advance!!

ProCx
  • 199
  • 5
  • 18
  • You'll have to include much more information in your question; traceback, layout, etc.? – Martijn Pieters Feb 16 '13 at 13:51
  • @Joe: since he's talking about Windows Update, I would hope it's Windows ;) – Wolph Feb 16 '13 at 14:01
  • Perhaps you somehow switched to a different Python version (if you have multiple installed that is). If you search your drive for `cherrypy` and open the `python.exe` in the parent directories, does that still not work? – Wolph Feb 16 '13 at 14:03
  • @WoLpH I would have hoped too, if I'd seen it. Fingers crossed, otherwise SanderK has bigger issues. – Joe Feb 16 '13 at 15:48

2 Answers2

5

I just ran into a similar problem. Everything was working fine for a week, but today suddenly an import failed.

I found that in the directory of the module I was trying to import, there was a corrupt .pyc file. I deleted that file, then everything worked again.

Maigo
  • 106
  • 1
  • 5
  • 1
    I had this same problem but it was a rogue .pyc file in a different directory on my path. – John Jan 22 '19 at 17:16
  • I have the same issue, how do you mean a rogue .pyc file and where was this file please ? – D.L Jun 17 '21 at 17:31
  • @D.L. Sorry, this was too long ago and I don't remember the details. – Maigo Jun 19 '21 at 07:23
  • I created a solution here (to a similar issue with `vscode` and `windows10` which works. https://stackoverflow.com/questions/68024747/exception-has-occurred-modulenotfounderror-in-vscode-but-no-other-editors – D.L Jun 21 '21 at 15:00
  • you should mark this as an accepted answer. On Ubuntu 20.04 I faced the same problem and it was solved by removing a folder named ".venv" in that directory. I didn't know when and how I had created that virtual environment and even why it was a hidden directory! – PouJa Jul 13 '22 at 17:37
0

Are you sure they are installed?

In your python shell, run

help('modules')

Then you can also check your PYTHONPATH with

import sys
print sys.path

Hope it helps.

danielcorreia
  • 2,108
  • 2
  • 24
  • 36