Starting new project in a child folder


#1

I am of course a total NOB learning python with atom. I have several projects that are starting to clutter up the project pane and I decided I probably need to get organized by making a sub folder (child?) for each project. So in my new project I started a sub folder and put my python script there. I go to that folder and run the script through the windows cmd line (in the same sub directory) but I am getting errors that it can’t find some of my common dependencies such as Selenium and BeutifulSoup. I know I probably need to add this PATH somehow but I need a good description on how to do this (if that is in fact the problem).

Also, am I correct that this is how I should organize my projects or am I missing the boat?

Thanks in advance!


#2

You are thinking about projects differently from how Atom thinks about projects. In Atom’s mind, the list of folders in the tree view is not a group of projects, it is one project. This is important because Atom remembers the state of your open files based on the collection of directory paths that make up the project folders. If you have a code folder at D:/projects/soup-can/ and you open it in Atom, every time you right-click on or in the soup-can/ folder and select Open in Atom, you’ll see the same set of files pop up. However, if you have soup-can/ as one of several project folders, then Open in Atom will destructively override your whole setup and Atom will have no idea what files should be open. If you can’t remember the exact list of folders you had open, you could permanently lose any unsaved files. If you want to have all of your projects visually listed for you inside Atom, it’s much better to use a package like project-viewer or project-manager than to collect them all in the tree view.

I go to that folder and run the script through the windows cmd line (in the same sub directory) but I am getting errors that it can’t find some of my common dependencies such as Selenium and BeutifulSoup.

How many versions of Python do you have installed on your computer? Have you used IDLE previously? Anaconda? Jupyter? Every one of those will install its own Python interpreter, with its own site-packages/, and you probably just need to install those packages for whatever is behind the command python. Check out python --version to verify that it’s the right version for the dependencies you need.


#3

Thanks for the input. I figured that I might be thinking of it wrong. As I am new to this my projects are small and simple. Everything is in one folder (py4e). So I have about 10 projects in that one folder. That makes it awfully cluttered when I am looking for something.

Besides using the cmd prompt to run the program I do all of my work inside Atom so yes, I would like to be able to see all of my projects in Atom. Otherwise I would not know how to switch projects. I will look into the packages you mentioned today.

I have only one version of python. Right from their website. I have never used anything besides that and Atom.


#4

You just open a new folder in Atom. The typical ways are to right-click, use atom . from the command line, or open a new window and Add Project Folder.

I use project-viewer, myself. You can customize grouping, icons, and colors, and then you can choose whether you want to open a project in a new window or in the current window. It’s very useful.

I have only one version of python. Right from their website. I have never used anything besides that and Atom.

Wait. You said, “it can’t find some of my common dependencies such as Selenium and BeutifulSoup”. If you have never used anything besides Python and Atom, and your Python doesn’t have those dependencies installed, have you ever used those dependencies on that computer? Because if not, you need to do that with pip install selenium beautifulsoup4.


#5

My bad. I meant that I had not installed any other versions of python. Yes, I do have those dependencies.


#6

Then I’m not sure what the problem is.


#7

Sorry again for a poorly formed question. Sometimes being new it is hard to figure out the right questions. Now that I have the folder project figured out, I re-ordered my folders to have a main one called python and child folders with the name of each project. I now just open up atom and to to the appropriate child folder that I am working on. The problem is that now that I have moved some of my folders around some of my dependencies are not working… I think. Here is an error message I am getting on a script that was working yesterday. I am currently trying to decipher it.

#---------------------------------------------------------------------------------------------

Traceback (most recent call last):
File “C:\Users\Study-PC\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\firefox\webdriver.py”, line 20, in
import http.client as http_client
File “C:\Users\Study-PC\AppData\Local\Programs\Python\Python36-32\lib\http\client.py”, line 71, in
import email.parser
File “C:\Users\Study-PC\Google Drive\python\py4e\email.py”, line 1, in
import smtplib
File “C:\Users\Study-PC\AppData\Local\Programs\Python\Python36-32\lib\smtplib.py”, line 47, in
import email.utils
ModuleNotFoundError: No module named ‘email.utils’; ‘email’ is not a package

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:\Users\Study-PC\Google Drive\python\py4e\disfood.py”, line 3, in
from selenium.webdriver.common.keys import Keys
File “C:\Users\Study-PC\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver_init_.py”, line 18, in
from .firefox.webdriver import WebDriver as Firefox # noqa
File “C:\Users\Study-PC\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\firefox\webdriver.py”, line 22, in
import httplib as http_client
ModuleNotFoundError: No module named ‘httplib’
[Finished in 0.389s]


#8

Look at the first lines of each error. You can see that there’s a folder called selenium in those paths, so it’s definitely not an issue of finding the package.

Have you added C:\Users\Study-PC\Google Drive\python\py4e\ to your PATH? Because, according to the stack trace, the file C:\Users\Study-PC\AppData\Local\Programs\Python\Python36-32\lib\http\client.py is calling for email.parser and locating the file C:\Users\Study-PC\Google Drive\python\py4e\email.py, which doesn’t contain the parser and utils attributes required. If you want to have your code folder on your PATH (which you probably shouldn’t), then you should put it lower (in terms of position, which translates into priority) in the PATH than the folder where your Python packages are.