seomoz / shovel

Rake, for Python
MIT License
660 stars 49 forks source link

"shovel help" fails with "ImportError: cannot import name task" (filename conflict) #7

Open npinto opened 12 years ago

npinto commented 12 years ago

Steps to reproduce:

virtualenv shovel-test
cd shovel-test
source bin/activate
git clone https://github.com/seomoz/shovel.git
cd shovel
python setup.py install
cd ../
mkdir sandbox
cd sandbox
ln -sf ../shovel/shovel.py .
shovel help

Output:

Traceback (most recent call last):
  File "/home/npinto/.local/bin/shovel", line 41, in <module>
    import shovel
  File "/home/npinto/tmp/shovel-test/sandbox/shovel.py", line 1, in <module>
    from shovel import task
ImportError: cannot import name task
[1]    31729 exit 1     shovel help
harobed commented 11 years ago

Same issue here :+1:

cory-klein commented 6 years ago

Just saw this myself. In some cases the python interpreter appears to be looking for task from within your shovel.py itself, rather than looking for the global shovel module.

You can resolve this by creating a shovel directory and moving your shovel.py into it:

mkdir shovel
mv shovel.py
shovel <your_task> # should work now
dlecocq commented 6 years ago

In hindsight, it was probably not a good idea to have the module named the same as where it tries to load tasks, but @cory-klein -- that is the best work-around.

FilBot3 commented 5 years ago

could it be renamed to something like shovellib/?