rajatomar788 / pywebcopy

Locally saves webpages to your hard disk with images, css, js & links as is.
https://rajatomar788.github.io/pywebcopy/
Other
527 stars 106 forks source link

Cannot import name 'save_webpage' from 'pywebcopy' #50

Closed slavakurilyak closed 4 years ago

slavakurilyak commented 4 years ago

I'm trying to replicate the basic example and running into an error.

# pywebcopy.py
from pywebcopy import save_webpage

kwargs = {'project_name': 'some-fancy-name'}

save_webpage(
    url='http://example-site.com/index.html',
    project_folder='path/to/downloads',
    **kwargs
)

Running $ python pywebcopy.py gives me:

Traceback (most recent call last):
  File "pywebcopy.py", line 1, in <module>
    from pywebcopy import save_webpage
  File "/pywebcopy.py", line 1, in <module>
    from pywebcopy import save_webpage
ImportError: cannot import name 'save_webpage' from 'pywebcopy' (/pywebcopy.py)

I already installed pywebcopy using $ pip install pywebcopy

Please advise.

rajatomar788 commented 4 years ago

You should rename your file from pywebcopy.py to something else. That's basic python ethics to not name your script after a library.

slavakurilyak commented 4 years ago

@rajatomar788 Thanks!