ageitgey / medium_to_ghost

Instantly move all your Medium.com content (formatted posts + images) to an open source Ghost blog!
MIT License
121 stars 13 forks source link

Import error on Windows Subsystem for Linux and Windows #4

Closed bee-san closed 5 years ago

bee-san commented 5 years ago

Hi!

When I try to run your program, I get this error:

brandon@DESKTOP-KSVAT30:/mnt/c/Users/Brandon/Desktop/med/medium_to_ghost-master/medium_to_ghost$ python3 medium_to_ghost.py medium-export.zip
Traceback (most recent call last):
  File "medium_to_ghost.py", line 3, in <module>
    from medium_to_ghost.medium_post_parser import convert_medium_post_to_ghost_json
  File "/mnt/c/Users/Brandon/Desktop/med/medium_to_ghost-master/medium_to_ghost/medium_to_ghost.py", line 3, in <module>
    from medium_to_ghost.medium_post_parser import convert_medium_post_to_ghost_json
ModuleNotFoundError: No module named 'medium_to_ghost.medium_post_parser'; 'medium_to_ghost' is not a package

Even though it is installed:

brandon@DESKTOP-KSVAT30:/mnt/c/Users/Brandon/Desktop/med/medium_to_ghost-master/medium_to_ghost$ pip3 install medium_to_ghost
Collecting medium_to_ghost
  Using cached https://files.pythonhosted.org/packages/27/20/37193588e828fc6afdf8bcdae124af39091ed71b831e4a81eabdf4ab8e2e/medium_to_ghost-0.0.2-py3-none-any.whl
Collecting Click>=6.0 (from medium_to_ghost)
  Using cached https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl
Collecting beautifulsoup4 (from medium_to_ghost)
  Using cached https://files.pythonhosted.org/packages/3f/ef/40271f62429deec36f2d040283e722856abcfd34bac063435a2213b77bef/beautifulsoup4-4.7.0-py3-none-any.whl
Collecting soupsieve>=1.2 (from beautifulsoup4->medium_to_ghost)
  Using cached https://files.pythonhosted.org/packages/ef/06/53edcae4edea76b38a325980dd35aed3b39f9bd0ef27b9d33f2e6dc4c7f6/soupsieve-1.6.2-py2.py3-none-any.whl
Installing collected packages: Click, soupsieve, beautifulsoup4, medium-to-ghost
Successfully installed Click-7.0 beautifulsoup4-4.7.0 medium-to-ghost-0.0.2 soupsieve-1.6.2

Switching to windows:

brandon@DESKTOP-KSVAT30:/mnt/c/Users/Brandon/Desktop/med/medium_to_ghost-master/medium_to_ghost$ logout

C:\Users\Brandon\Desktop\med\medium_to_ghost-master\medium_to_ghost>pip install medium_to_ghost
Requirement already satisfied: medium_to_ghost in c:\users\brandon\appdata\local\programs\python\python35\lib\site-packages (0.0.2)
Requirement already satisfied: Click>=6.0 in c:\users\brandon\appdata\local\programs\python\python35\lib\site-packages (from medium_to_ghost) (7.0)
Requirement already satisfied: beautifulsoup4 in c:\users\brandon\appdata\local\programs\python\python35\lib\site-packages (from medium_to_ghost) (4.7.0)
Requirement already satisfied: soupsieve>=1.2 in c:\users\brandon\appdata\local\programs\python\python35\lib\site-packages (from beautifulsoup4->medium_to_ghost) (1.6.2)
C:\Users\Brandon\Desktop\med\medium_to_ghost-master\medium_to_ghost>python medium_to_ghost.py medium-export.zip
Traceback (most recent call last):
  File "medium_to_ghost.py", line 3, in <module>
    from medium_to_ghost.medium_post_parser import convert_medium_post_to_ghost_json
  File "C:\Users\Brandon\Desktop\med\medium_to_ghost-master\medium_to_ghost\medium_to_ghost.py", line 3, in <module>
    from medium_to_ghost.medium_post_parser import convert_medium_post_to_ghost_json
ImportError: No module named 'medium_to_ghost.medium_post_parser'; 'medium_to_ghost' is not a package
Python 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:27:37) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import medium_to_ghost
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Brandon\Desktop\med\medium_to_ghost-master\medium_to_ghost\medium_to_ghost.py", line 3, in <module>
    from medium_to_ghost.medium_post_parser import convert_medium_post_to_ghost_json
ImportError: No module named 'medium_to_ghost.medium_post_parser'; 'medium_to_ghost' is not a package

I've tried to google around and I couldn't fix this :(

bee-san commented 5 years ago

Just realised - Windows is Python 3.5, Linux is Python 3.6.7 πŸ˜… Doesn't fix the problem, was just adding more information πŸ˜„

Update: I asked my friend on Mac to try this out, he's having "no module named click" despite click being installed 😞

fmahnketenx commented 5 years ago

I've got the same issue on Mac. Running Python 3.7.2

.../medium_to_ghost-master/medium_to_ghost/medium_to_ghost.py", line 3, in from medium_to_ghost.medium_post_parser import convert_medium_post_to_ghost_json ModuleNotFoundError: No module named 'medium_to_ghost.medium_post_parser'; 'medium_to_ghost' is not a package

fmahnketenx commented 5 years ago

I've fond the solution here:

https://github.com/ageitgey/medium_to_ghost/issues/5

ageitgey commented 5 years ago

I've updated the instructions to say python3 -m medium_to_ghost.medium_to_ghost medium-export.zip which should work for everyone.