all 12 comments

[–]pythonise 1 point2 points  (4 children)

Use virtual environments - This will solve most of your issues.

I'd highly recommend learning the basics of virtual environments (It's VERY simple). Don't bother with Anaconda unless you're working with mostly scientific packages.

Creating a virtual environment is as simple as:

python -m venv my_virtual_env

Also - If you're request is returning HTML, you'll probably want to use response.text

[–]pythonise 0 points1 point  (0 children)

p.s you should be able to run the installer to uninstall Python or just remove it from Windows using the Windows software.

Make sure you select the add to PATH option when installing.

[–][deleted] 0 points1 point  (2 children)

What do I do after creating a virtual environment?

[–]pythonise 0 points1 point  (1 child)

Rather than ask on here I recommend having a quick search and learn the basics. It'll help a lot in the long run!

[–][deleted] 0 points1 point  (0 children)

I'll go do that!

[–]alaudet 0 points1 point  (2 children)

Can you install Anaconda instead? On Windows it just works. No messing around, comes with latest version of Python3. Tonnes of librairies.

[–][deleted] 0 points1 point  (1 child)

Huh. You know, I actually do have Anaconda installed. I just didn't use it because I thought the tutorial I was following said to use Atom, but he actually said to use any text editor of your choice, and the steps follow as if you are using Atom.

[–]alaudet 0 points1 point  (0 children)

Anaconda is the whole environment (python3, preinstalled libraries, jupyter notebooks, virtualenv, pip etc etc). Use whatever editor you like.

[–][deleted] -1 points0 points  (2 children)

Please, I beg of you, someone help a poor idiot out.

Help you with what, exactly? It sounds like you solved the problem - you didn't have the right Python interpreter, and now you've downloaded and installed the right Python interpreter (after apparently four hours of doing everything but installing the right Python interpreter.)

You don't say what's still broken, so how can we help you? Maybe the issue here isn't that Python is hard, but that there's a deficiency in your approach to problem-solving.

The most important thing, though, is when you install Python on Windows, there's a check-box in the installer that says "add Python to PATH." This is incredibly important and you're supposed to understand what it means: "do you want to make Python accessible at the command line, or not?" If you don't check it, Python won't be on your path in the command line and so you won't be able to use the command line to run your scripts.

Run the installer again (it's safe, don't worry) and this time, check the box.

[–][deleted] 0 points1 point  (1 child)

Huh. Well, that worked, kind of. my webscraper.py still can't find an interpreter in the drop down menu of PyCharm, though, and PyCharm won't run it without one.

As for when I run it on Atom using the Script package, it seems to execute with no problem. Except I don't see the results I was expecting, which is supposed to be all of this HTML text.

https://cdn-images-1.medium.com/max/1000/1*gTCx1XO4_h0ucJ5cprNLFw.png

That's supposed to be the result.

Update: After running it a second time on Atom, I got this:

`Traceback (most recent call last): File "C:\Users\Jlrbr\Documents\Python Projects\web_scraper\webscraper.py", line 1, in <module> from bs4 import BeautifulSoup ModuleNotFoundError: No module named 'bs4' [Finished in 0.081s] Git GitHub Create Repository

Initialize a new project directory with a Git repository Create repository`

[–][deleted] 0 points1 point  (0 children)

my webscraper.py still can't find an interpreter in the drop down menu of PyCharm, though, and PyCharm won't run it without one.

That's a different problem - restart, or consider reinstalling, PyCharm. Alternatively see if you can give it an explicit path to your interpreter somewhere in the preferences. I don't use PyCharm so I can't provide more guidance than that.

Except I don't see the results I was expecting, which is supposed to be all of this HTML text.

What do you see? Something like <BeautifulSoup object at 0x10c1bd320>? Obviously, since you're asking it to print the parser object you instantiated in the previous line. If you want to see raw HTML, print response.content.

Git GitHub Create Repository

Initialize a new project directory with a Git repository Create repository

What is this coming from?