0

I'm getting 'module' object has no attribute error whenever I am trying to run my Python scripts on Notepad++, I've tried using just Run command and I got the same error.

I've followed a reductionist approach and written two line code to narrow down the problem. I've tested the code on native IDLE and Notepad++. IDLE runs the script perfectly where as Notepad++ throws an error.

I've checked pathways, installations, even UTF encodings and there is not a single problem. Code is given below, and in order not to have a problem it is taken from Python.org itself.

I've searched the web but I could not find an answer, those who had problems generally had typos in their code however I've tested my code for typos and reduced it to a state just to show error and cross validated using native IDLE.

import random
A = random.randint(1, 10)
Jean-Francois T.
  • 11,549
  • 7
  • 68
  • 107
Salih F. Canpolat
  • 204
  • 2
  • 3
  • 14
  • In short: you probably have another file named either `random.py` or `random.pyc`. – zondo Jun 20 '16 at 00:12
  • **Alternative**: using NppExec plugin with command `python "$(FULL_CURRENT_PATH)"` and be sure to check the option `Follow $(CURRENT_DIRECTORY)` in *Plugins > NppExec*. – Jean-Francois T. Jun 20 '16 at 11:23

0 Answers0