Automation for Digital Archives 2022, written in python. Interprets data from text files and writes to Excel file for easy copy and paste into master google sheet.
- In Python 3.10, the match syntax similar switch was introduced. A module in this program uses match
- pandas
- openpyxl
- youtube-dl
- pafy
- pytube
I'm using the Jetbrains PyCharm IDE. Installed dependencies in the project folder's venv folder.
Since YouTube removed dislikes being shown, I edited the youtube-dl, backend_youtube_dl.py and commented out:
self._likes = self._ydl_info['like_count']
self._dislikes = self._ydl_info['dislike_count']
self._rating = self._ydl_info['average_rating']
- PEP8 Style Guide
- Python Regex Library
- Python Dictionary Update
- Python Typing Example
- Python Typing Documentation
- Python String Formatting Best Practices
- Python Typing Tutorial
- Python Decorators
- Class vs Static Method Tutorial
- Python venv tutorial
- Switching Terminal Between i386 and ARM
- Using Pip to Install to Anaconda Environment
- Setting up Python on an M1 Mac
- Pafy Documentation
- Pandas DataFrame to Excel File
- Pandas Remove/Drop Columns
- Pandas DataFrame Tutorial
Support for intel and arm is weird. To get this to work in pycharm or even run this with the needed dependencies for this project, one must first open terminal, go to the venv bin directory of this project then type:
env /usr/bin/arch -x86_64 /bin/zsh/
conda deactivate
source $(pwd)/activate
python3 (path to main.py)
I used anaconda package manager to solve the issue of M1 problems regarding the system architecture, x86_64 and arm64. I installed Anaconda and miniforge. I first installed anaconda-navigator, then installed miniforge via brew install miniforge. I then ran the command:
conda create --name (name of environment) python=3.10
conda activate (name of environment)
Now that the conda venv is activated, you can then use pip3 to install pip3 packages like pafy, youtube_dl, or pytube.
conda install (package name)
I used this new environment for the Python project.
To add the Anaconda environment, I went to my project interpreter settings at the bottom right, and clicked add interpreter. I added a new conda environment, selected existing environment, and set the interpreter path to:
/Users/(username)/opt/anaconda3/envs/(environment name)/bin/python
The environment name is the one created in the previous section, using the conda create --name command. I set the conda executable path to:
/Users/(username)/opt/anaconda3/bin/conda
After adding, PyCharm should run the main.py flawlessly.