1

I've installed and loaded the module "windrose" to Python2.7 in the path "/home/user/.local/lib/python2.7/site-packages/windrose/windrose.py". When I run a program including

from windrose import WindroseAxes
from matplotlib import pyplot as plt
import matplotlib.cm as cm
import numpy as np

I get the Error Message:

Traceback (most recent call last):
  File "/home/user/Documents/evaluation/my_windrose.py", line 1, in <module>
   from windrose import WindroseAxes
  File "/home/user/Documents/evaluation/windrose.py", line 1, in <module>
ImportError: cannot import name WindroseAxes

I guess the list sys.path contains a false entry for this module, because Python searches for windrose.py in my folder "evaluation". Thus I loaded the module directly from the correct path and my program worked fine:

from matplotlib import pyplot as plt
import matplotlib.cm as cm
import numpy as np
import imp
foo = imp.load_source('windrose', '/home/user/.local/lib/python2.7/site-packages/windrose/windrose.py')
from windrose import WindroseAxes

But this should operate easier! What I want to know is how can I replace the wrong path to the right path for this module permanently? I found some Answers for inserting new directories to sys.path, but I don't want to have two windrose-directories either. Any ideas? Thanks!

elly
  • 166
  • 1
  • 2
  • 15

0 Answers0