BlueVoodoo BlueVoodoo - 3 months ago 41
Python Question

NameError: name 'N_TOKENS' is not defined

I am new on Python and just got around to install PyCharm for Windows. Downloaded some sample code from Skype for testing their SkypeKit API. But... As soon as I hit the debug button, I get this: (I have Python 2.7 and Django 1.4 installed)

Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm 2.0.2\helpers\pydev\", line 2, in <module>
from django_debug import DjangoLineBreakpoint
File "C:\Program Files (x86)\JetBrains\PyCharm 2.0.2\helpers\pydev\", line 1, in <module>
import inspect
File "C:\Program Files (x86)\Python27\lib\", line 39, in <module>
import tokenize
File "C:\Program Files (x86)\Python27\lib\", line 38, in <module>
NameError: name 'N_TOKENS' is not defined

Process finished with exit code 1

What does this mean and what can I do to fix it?


The module is probably loading the wrong module. See error importing numpy. Solution 1) rename the new ( and update references to it in etc. Solution 2) if the new is in a python package you can disambiguate the import statement:

import CorrectPythonPackage.token as token2


from CorrectPythonPackage.token import *

Where CorrectPythonPackage is the folder name containing the file.