1

I want to import a color module but I am getting the error:

ImportError: No module named 'scripts.UltraColor'

Import code:

from scripts.UltraColor import *

The import code is in pygameTest.py

skrx
  • 19,980
  • 5
  • 34
  • 48
Tjtorin
  • 99
  • 1
  • 1
  • 10
  • Maybe try `import UltraColor` or `from UltraColor import *` (or the name of the module within that you might want). This would need your `scripts` folder to be an import location. Alternatively, move `UltraColor.py` to your `venv` folder and try again. – Chris May 31 '18 at 21:47
  • What Python version, and what platform? And can you `import sys, os; print(sys.path); print(sys.argv[0]); print(os.getcwd())` at the top of your program? – abarnert May 31 '18 at 21:48
  • Please add to your question the sys.path before calling to import scripts.UltraColor – baruchl May 31 '18 at 21:48

1 Answers1

2

The problem here, as far as I can see on that screenshot is UltraColor file doesn't have the .py extension, for import to work properly you'll need to rename it from UltraColor to UltraColor.py, otherwise will raise an ImportError exception.

For more information, take a look to this one. Import a python module without the .py extension

BPL
  • 9,632
  • 9
  • 59
  • 117