1

I use Windows. Somehow I fail to import my own module.

I prepared:

import sys
sys.path.append(r'C:\Users\Michael\PycharmProjects\timer')
#import timer
print(sys.path)

An extract of what was printed:

site-packages', 'C:\\Users\\Michael\\PycharmProjects\\timer']

In C:\Users\Michael\PycharmProjects\timer I have a file named timer.py

Why is my command import timer incorrect?

Axel Isouard
  • 1,498
  • 1
  • 24
  • 38
Kifsif
  • 3,477
  • 10
  • 36
  • 45
  • 1
    in general put you custom paths at the front: `sys.path.insert(0, custom_path)`. There could be multiple modules with the same name in path. What is the traceback? – jfs Sep 28 '12 at 13:14

2 Answers2

4

Your import statement is commented out, in python you import by just doing import timer without the # in front as used by many compiled languages and their include statements.

Wessie
  • 3,460
  • 2
  • 13
  • 17
1

The import command is flagged as a comment. Remove the hash tag and it should be fine.

Chimp
  • 661
  • 2
  • 6
  • 10