0

I am using VS2013 with PTVS.

I can see the module datasets with dir():

>>> dir()
['__builtins__', '__doc__', '__name__', '__package__', 'datasets', 'pprint']

And datasets is a module:

>>> type(datasets)
<type 'module'>

But I cannot import the datasets module:

>>> import datasets
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named datasets

>>> from datasets import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named datasets

I did this because I don't want to save some typing of "datasets". Why this error?

smwikipedia
  • 61,609
  • 92
  • 309
  • 482

1 Answers1

0

dir() shows you the local variables. What this output means is that 1) you have a global variable named datasets, and 2) it references a module. This would normally indicate that someone has imported it already in your scope. But import itself does not operate on variables, it operates on modules directly.

If I had to guess, the module is probably not actually named datasets, it's just that someone did from .. import or import .. as. You need to find out what the actual name of the module is.

Pavel Minaev
  • 99,783
  • 25
  • 219
  • 289