Commit b7ad9692 authored by Christian Rohlfing's avatar Christian Rohlfing
Browse files

Added requirements.txt and Dockerfile and adapted manuals accordingly

parent 54ff5e30
# Dependencies
### `watermark.py`
Note that all Python packages are listed in the file `requirements.txt`.
## `watermark.py`
* ImageMagick 7.0.10-33
* Ghostscript 9.53.3
* Pillow 8.1.0
* Wand 0.6.5
* PyPDF2 1.26.0
### `encrypt.py`:
## `encrypt.py`
* PyPDF2 1.26.0
* pwgen 0.8.2.post0
* pikepdf 2.5.0
### `preparemoodle.py`:
## `preparemoodle.py`
* zip
# Ubuntu 20.04 (focal)
# https://hub.docker.com/_/ubuntu/?tab=tags&name=focal
# OS/ARCH: linux/amd64
ARG ROOT_CONTAINER=ubuntu:focal-20210401
ARG BASE_CONTAINER=$ROOT_CONTAINER
FROM $BASE_CONTAINER
LABEL maintainer="Christian Rohlfing <rohlfing@ient.rwth-aachen.de>"
# Install Ubuntu packages
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update \
&& apt-get install -yq --no-install-recommends \
wget \
libmagickwand-dev \
ghostscript \
python3-pip \
python3-setuptools \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Install Python packages
COPY requirements.txt /tmp/requirements.txt
RUN pip3 install setuptools
RUN pip3 install -r /tmp/requirements.txt
# ImageMagick hack
# taken from https://stackoverflow.com/questions/53377176/change-imagemagick-policy-on-a-dockerfile
# Add PDF read|write rights
ARG imagemagic_policy=/etc/ImageMagick-6/policy.xml
RUN sed -i 's/<policy domain="coder" rights="none" pattern="PDF" \/>/<policy domain="coder" rights="read|write" pattern="PDF" \/>/g' $imagemagic_policy
# Create non-root user
RUN useradd -m friendlyscanner
USER friendlyscanner
# Copy all files
COPY . /app
WORKDIR /app
# Entrypoint is python
ENTRYPOINT ["python3"]
# Standard command is batch.py
CMD ["./batch.py", "--help"]
\ No newline at end of file
# FAQs
Here we discuss the common problems and their corresponding solutions:
# Policy Error: attempt to perform an operation not allowed by the security policy 'PDF'
## Policy Error: attempt to perform an operation not allowed by the security policy 'PDF'
<img src="/images/policyissue.png" height="100" width ="600"/>
Solution:
This occurs in Linux. This occurs if the policy.xml correction referred in [Step6] of swdependencies_linux.md is not done correctly.
* Navigate to /etc/ImageMagick-6/policy.xml
* Find `<policy domain="coder" rights="none" pattern="PDF" />` and replace "none" by "read|write"
This occurs in Linux. This occurs if the policy.xml correction referred in [Step6] of the installation guide is not done correctly.
* Navigate to /etc/ImageMagick-6/policy.xml
* Find `<policy domain="coder" rights="none" pattern="PDF" />` and replace `"none"` by `"read|write"`
[Step6]: https://git.rwth-aachen.de/rwthmoodle/exam-scan/-/blob/platform-independant/swdependencies_linux.md
# PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
## PermissionError: [WinError 32] The process cannot access the file because it is being used by another process
This occurs in Windows. The reason is the program is trying to work with a file that is open. The error is generally followed by a filename which is open and therefore the error occurs. User must close that file
# Not all files are watermarked/encrypted or not all files are included in the final ZIP archive
## Not all files are watermarked/encrypted or not all files are included in the final ZIP archive
This happens if the filename is not given according to the naming scheme i.e `<matriculation number>_<Nachname>`. The program will not pickup a file whose name doesn't follow this scheme.
This happens if the filename is not given according to the naming scheme i.e *<matriculation number>_<Nachname>*. The program will not pickup a file whose name doesn't follow this scheme.
## "Command 'python'/'python3' not found" or "'python'/'python3' is not recognized as an internal or external command, operable program or batch file."
# "Command 'python'/'python3' not found" or "'python'/'python3' is not recognized as an internal or external command, operable program or batch file."
This can happen because:
This can happen because:
* Python is not installed
* Environmental variables for Python is not set. This issue mostly happens in Windows if one forgets to check 'Add Python to Path' [checkbox](./images/pythoninstallation.png) during installation
* You are usaing the wrong command variation. Try running the program with the other command variation.
# "Invalid Syntax"
## "Invalid Syntax"
This can be because you are running a Python version that is incompatible to the version of Python this was developed in.Check if the python version is higher than 3.0 preferrably 3.8 or 3.9.
This can be because you are running a Python version that is incompatible to the version of Python this was developed in.Check if the python version is higher than 3.0 preferrably 3.8 or 3.9.
# python: can't open file *<current directory>*/watermark.py: [Errno 2] No such file or directory
## python: can't open file `<current directory>/watermark.py`: [Errno 2] No such file or directory
You are not in the correct folder to run the scripts. You must run the program from inside the extracted folder of the Git repository
# The ZIP archive has locked PDFs. Where can I find passwords?
## The ZIP archive has locked PDFs. Where can I find passwords?
If you are running individual scripts, the passwords are saved in passwords.csv under pdfs_encrypted folder.
if you are running the batch job script, the passwords are saved in out > password.csv
\ No newline at end of file
if you are running the batch job script, the passwords are saved in `out/password.csv`.
# exam-scan
Preparing exam scans for ship out: Adding watermarks, encryption and preparing upload to Moodle.
Preparing exam scans for ship out: Adding watermarks, encryption and preparing upload to Moodle.
## Contents
* `preparepdf.py` unzips files from submission zip file downloadable from Moodle(in case there are no scans) and renames it accordingly in the format (<Matriculation number>_<Lastname>)
* `preparepdf.py` unzips files from submission zip file downloadable from Moodle(in case there are no scans) and renames it accordingly in the format (`<Matriculation number>_<Lastname>`)
* `supplements.py` renames and create copies of sample solutions(if any) for every student
* `watermark.py` watermarks each page of PDFs containing exam scans with matriculation number of the respective student
* `encrypt.py` encrypts PDF with password either with a common password(passed as an argument) or a randomly generated password(when there is no argument)
* `preparemoodle.py` prepares for uploading PDFs to moodle via assign module as feedback file for each student
* `batch.py` executes all three programs as a singular batch job
Please note that the three scripts `watermark.py`, `encrypt.py`, and `preparemoodle.py`do not depend on each other.
Please note that the three scripts `watermark.py`, `encrypt.py`, and `preparemoodle.py`do not depend on each other.
If you want to use only a subset (or one) of the scripts, you can find it [here](Dependancies.md).
Exemplary outputs can be downloaded:
* [moodle_feedbacks.zip](https://git.rwth-aachen.de/IENT/exam-scan/-/jobs/artifacts/master/raw/out/moodle_feedbacks.zip?job=test): The zip-Archive to be uploaded to Moodle containing the watermarked and encrypted PDFs for each student.
* [passwords.csv](https://git.rwth-aachen.de/IENT/exam-scan/-/jobs/artifacts/master/raw/out/passwords.csv?job=test): CSV file containing passwords for each PDF.
* [moodle_feedbacks.zip](https://git.rwth-aachen.de/IENT/exam-scan/-/jobs/artifacts/master/raw/out/moodle_feedbacks.zip?job=test): The zip-Archive to be uploaded to Moodle containing the watermarked and encrypted PDFs for each student.
* [passwords.csv](https://git.rwth-aachen.de/IENT/exam-scan/-/jobs/artifacts/master/raw/out/passwords.csv?job=test): CSV file containing passwords for each PDF.
## Instructions
......@@ -26,160 +27,142 @@ Exemplary outputs can be downloaded:
* In your Moodle course room, create an `assign` module following this [guideline](https://help.itc.rwth-aachen.de/service/8d9eb2f36eea4fcaa9abd0e1ca008b22/article/0cfca4212fef4712ad2d432ac83eaf3e)
* Download the grading table `Bewertungen.csv` from Moodle via: `Alle Angaben anzeigen` &#8594; `Bewertungsvorgang` &#8594; `Bewertungstabelle herunterladen`
* **Create PDFs corresponding to each exam**
* Scan the exams and save the scans as PDFs (each page should be A4). For most copy machines, you can save an A3 scan (double page of an exam) as two A4 pages.
* The filename of each PDF should start with the student's matriculation number (e.g. `123456_Nachname.pdf`).
* Place all PDFs in a folder, e.g. `pdfs`.
** OR: Download submission zip file**
**OR: Download submission zip file**
* Download the submission zip file from (Assignment Main Page->View all submissions->Download all submissions)
* **OR: Download submission zip file**
* Download the submission zip file from (Assignment Main Page->View all submissions->Download all submissions)
* **Optional: Create Sample Solutions (Refer [here](https://git.rwth-aachen.de/rwthmoodle/exam-scan/-/issues/3))**
* Scan the sample solutions and save the scans as PDFs (each page should be A4). For most copy machines, you can save an A3 scan (double page of an exam) as two A4 pages.
* Place all PDFs in a folder, e.g. `supplements`.
* **Install the software dependancies**
The current version of code was tested on Windows10, Ubuntu 20.04.1 LTS and macOS 10.14 Mojave to ensure platform independance.The code has the following software dependencies which needs to installed before the programs can be run successfully. Specific version numbers along with categorisation based on script requirement is available [here](Dependancies.md):
* Imagemagick
* Ghostscript
* Python 3.8/3.9
* PIP
* Additional Python modules:
* wand
* pillow
* PyPDF2
* pwgen
* pikepdf
If you are an experienced user and familiar with the python `venv` (virtual environments) module and after having installed both ImageMagick (beware the `Policy Error` fix in [FAQs])and Ghostscript you can install the python dependencies in the virtual environment via pip with
```bash
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python ./watermark.sh --help
```
The current version of code was tested on Windows10, Ubuntu 20.04.1 LTS and macOS 10.14 Mojave to ensure platform independance.The code has the following software dependencies which needs to installed before the programs can be run successfully. Specific version numbers along with categorisation based on script requirement is available [here](Dependancies.md):
* Imagemagick
* Ghostscript
* Python 3.8/3.9
* PIP
* Additional Python modules:
* wand
* pillow
* PyPDF2
* pwgen
* pikepdf
Instructions to install software dependencies based on your operating system:
* Windows 10 : [Installation of Software Dependencies](swdependencies_win.md)
* MacOS : [Installation of Software Dependencies](swdependencies_mac.md)
* Linux : [Installation of Software Dependencies](swdependencies_linux.md)
* Windows 10 : [Installation of Software Dependencies](swdependencies_win.md)
* MacOS : [Installation of Software Dependencies](swdependencies_mac.md)
* Linux : [Installation of Software Dependencies](swdependencies_linux.md)
### Docker
If you are an experienced user familiar with Docker, you can use the provided `Dockerfile` to easily run the scripts.
```bash
docker build -t examscan:latest .
docker run --name examscan --rm -v $(pwd):$(pwd) -w $(pwd) examscan:latest
```
## Scripts and how to run them
### Process
Run `preparepdf.py` (if you have submissions in a zip and not as scans) `supplements.py`(if you want to add watermarked sample solutions as well),`watermark.py`, `encrypt.py`, and `preparemoodle.py` (or run `batch.py` which runs all) as described in the sections below. In summary, these steps will
1. unzip all PDF files from the zip and rename them according to the schema <Matriculationnumber>_<Lastname>
1. prepare sample solution for each students
1. watermark each page of each PDF with the corresponding matriculation number,
1. encrypt each PDF with a password (global or per-student) and
1. construct a zip-archive enabling batch upload and assignment of each PDF to each student in Moodle.
Run `preparepdf.py` (if you have submissions in a zip and not as scans), `supplements.py` (if you want to add watermarked sample solutions as well), `watermark.py`, `encrypt.py`, and `preparemoodle.py` (or run `batch.py` which runs all) as described in the sections below. In summary, these steps will
1. unzip all PDF files from the zip and rename them according to the schema `<Matriculationnumber>_<Lastname>`
1. prepare sample solution for each students
1. watermark each page of each PDF with the corresponding matriculation number,
1. encrypt each PDF with a password (global or per-student) and
1. construct a zip-archive enabling batch upload and assignment of each PDF to each student in Moodle.
Upload `moodle_feedbacks.zip` to Moodle
* `Alle Angaben anzeigen` &#8594; `Bewertungsvorgang` &#8594; `Mehrere Feedbackdateien in einer Zip-Datei hochladen`
* Moodle will check for consistency and prompt errors.
* `Alle Angaben anzeigen` &#8594; `Bewertungsvorgang` &#8594; `Mehrere Feedbackdateien in einer Zip-Datei hochladen`
* Moodle will check for consistency and prompt errors.
### Commands
### Unzip submission files from and rename them
Please note that the following commands may only work for you with either `python` or `python3`.
#### Unzip submission files from and rename them
Assuming that ./submissions.zip is the zip file containing all submissions and ./Bewertungen.csv is the grading worksheet
```
```bash
python preparepdf.py --inzip ./submissions.zip --outfolder ./pdfs --csv ./Bewertungen.csv
```
or
```
python3 preparepdf.py --inzip ./submissions.zip --outfolder ./pdfs --csv ./Bewertungen.csv
```
### Prepare copies of Sample Solutions for each student (Optional)
#### Prepare copies of Sample Solutions for each student (Optional)
We assume that the folder `./supplements` holds the scans of the sample solution.
We assume that the folder `./supplements` holds the scans of the sample solution.
```
```bash
python supplements.py
```
or
```
python3 supplements.py
```
Folder `supplements_out` contains copies of the sample solutions for each student.
#### Watermark the submissions
We assume that the folder `./pdfs` holds the scans of the exams and .
We assume that the folder `./pdfs` holds the scans of the exams and .
The filename of each PDF should start with the matriculation number of the student, e.g. `./pdfs/123456_Lastname.pdf`.
```
```bash
python watermark.py --in ./pdfs --out ./pdfs_watermarked --cores 2
```
or
```
python3 watermark.py --in ./pdfs --out ./pdfs_watermarked --cores 2
```
Folder `pdfs_watermarked` contains watermarked PDFs, with each page watermarked with the matriculation number of the student.
#### Watermark Sample solution copies
We assume that the folder `./supplements_out` holds the copies for every students
```
```bash
python watermark.py --in ./supplements_out --out ./pdfs_watermarked --cores 2
```
or
```
python3 watermark.py --in ./supplements_out --out ./pdfs_watermarked --cores 2
```
#### Encrypt the files
Use either a global password by specifying it with the `--password` option or per-student passwords by ommiting `--password`.
```
```bash
python encrypt.py --in ./pdfs_watermarked --out ./pdfs_encrypted --password ganzgeheim
```
or
```
python3 encrypt.py --in ./pdfs_watermarked --out ./pdfs_encrypted --password ganzgeheim
```
Folder `./pdfs_encrypted` contains all encrypted PDFs as well as `passwords.csv`, mapping the password of each PDF to the matriculation number.
#### Prepare for Moodle batch upload
This step prepares the PDFs for upload to Moodle. First, the grading table `Bewertungen.csv` has to be downloaded from Moodle via:
`Alle Angaben anzeigen` &#8594; `Bewertungsvorgang` &#8594; `Bewertungstabelle herunterladen`.
`Alle Angaben anzeigen` &#8594; `Bewertungsvorgang` &#8594; `Bewertungstabelle herunterladen`.
This step is needed since Moodle does not only need matriculation number, but also last and first name as well as an internal user id, which is stored in `Bewertungen.csv`.
This step is needed since Moodle does not only need matriculation number, but also last and first name as well as an internal user id, which is stored in `Bewertungen.csv`.
```
```bash
python preparemoodle.py --in ./pdfs_encrypted --csv ./Bewertungen.csv --out ./moodle_feedbacks.zip
```
or
```
python3 preparemoodle.py --in ./pdfs_encrypted --csv ./Bewertungen.csv --out ./moodle_feedbacks.zip
```
Then, you can upload `moodle_feedbacks.zip` in Moodle:
Then, you can upload `moodle_feedbacks.zip` in Moodle:
`Alle Angaben anzeigen` &#8594; `Bewertungsvorgang` &#8594; `Mehrere Feedbackdateien in einer Zip-Datei hochladen`
Further remarks:
* Exemplary zip archive `moodle_feedbacks.zip` can be downloaded [here](https://git.rwth-aachen.de/IENT/exam-scan/-/jobs/artifacts/master/download?job=test).
* You can also conduct a dry run (neither folders nor zip file are created) via `./preparemoodle.sh --dry [...]`
......@@ -187,24 +170,16 @@ Further remarks:
Or do everything in one step
```
```bash
python batch.py --in ./pdfs --out ./out --cores 2 --password ganzgeheim --csv ./Bewertungen.csv --supinfolder ./supplements --sup 1 --zip ./submissions.zip
```
or
```
python3 batch.py --in ./pdfs --out ./out --cores 2 --password ganzgeheim --csv ./Bewertungen.csv --supinfolder ./supplements --sup 1 --zip ./submissions.zip
```
with folder `out` containing `passwords.csv` and `moodle_feedbacks.zip`.
## Original Authors
Helmut Flasche, Jens Schneider, Christian Rohlfing, IENT RWTH Aachen<br />
Dietmar Kahlen, ITHE RWTH Aachen<br />
Helmut Flasche, Jens Schneider, Christian Rohlfing, IENT RWTH Aachen\
Dietmar Kahlen, ITHE RWTH Aachen\
Amrita Deb, IT Center, RWTH Aachen University
## Who do I talk to?
......@@ -213,5 +188,4 @@ Servicedesk IT-Center RWTH Aachen <[servicedesk@itc.rwth-aachen.de](mailto:servi
If you have any errors or problems while running the programs, make sure to first check if your error is listed in [FAQs]
[FAQs]: https://git.rwth-aachen.de/rwthmoodle/exam-scan/-/blob/master/FAQs.md
Wand==0.6.5
Pillow==8.1.0
PyPDF2==1.26.0
pwgen==0.8.2.post0
pikepdf==2.5.0
\ No newline at end of file
......@@ -2,60 +2,61 @@
This is a step-by-step guide to download and install the various software dependencies of the exam scan program for Linux. This version of code was tested on Ubuntu 20.04.1 LTS.
**Step 1: Check Python**
1. Check Python
Python 3 comes already installed since Ubuntu 18.04. You can check if your system is equipped with python by opening the terminal and typing `python3 --version` to check the python version
Python 3 comes already installed since Ubuntu 18.04. You can check if your system is equipped with python by opening the terminal and typing `python3 --version` to check the python version
In case Python is not installed please install it following this documentation: https://docs.python-guide.org/starting/install3/linux/
In case Python is not installed please install it following this documentation: [https://docs.python-guide.org/starting/install3/linux/]
**Step 2: Install Imagemagick**
2. Install Imagemagick
Open the terminal and type the below command to install Imagemagick:
Open the terminal and type the below command to install Imagemagick:
`sudo apt-get install libmagickwand-dev`
`sudo apt-get install libmagickwand-dev`
*Hint:* You may have to give your system password to initiate the installation and press `Y` whenever asked `Do you want to continue? [Y/n]` in the installation
*Hint:* You may have to give your system password to initiate the installation and press `Y` whenever asked `Do you want to continue? [Y/n]` in the installation
<img src="/images/linux1.png" height="500" width ="500"/>
<img src="/images/linux1.png" height="500" width ="500"/>
For more details refer to this documentation: https://docs.wand-py.org/en/latest/guide/install.html
For more details refer to this documentation: [https://docs.wand-py.org/en/latest/guide/install.html]
**Step 3: Install Ghostscript**
3. Install Ghostscript
Open the terminal and type the below command to install Ghostscript:
Open the terminal and type the below command to install Ghostscript:
`sudo apt-get install ghostscript`
`sudo apt-get install ghostscript`
*Hint:* Press `Y` whenever asked `Do you want to continue? [Y/n]` in the installation
*Hint:* Press `Y` whenever asked `Do you want to continue? [Y/n]` in the installation
**Step 4: Check or install PIP**
4. Check or install PIP
Type `pip3 -V` in terminal to check if PIP is installed in your system. In case it is not install it with the below command:
Type `pip3 -V` in terminal to check if PIP is installed in your system. In case it is not install it with the below command:
`sudo apt install python3-pip`
`sudo apt install python3-pip`
*Hint:* Press `Y` whenever asked `Do you want to continue? [Y/n]` in the installation
*Hint:* Press `Y` whenever asked `Do you want to continue? [Y/n]` in the installation
**Step 5: Install additional Python modules with PIP**
5. Install additional Python modules with pip
Type the below command to install additional Python modules with PIP:
Type the below command to install additional Python modules with pip:
`pip3 install wand pillow PyPDF2 pwgen pikepdf`
`pip install -r requirements.txt`
**Step 6: Fix Imagemagick Security bug**
The above command works similarly if you substituted `pip` with `pip3`.
* Navigate to the policy.xml file of ImageMagick at /etc/ImageMagick-6/policy.xml (`cd /etc/ImageMagick-6/`)
* Open the file and find `<policy domain="coder" rights="none" pattern="PDF" />`
* `sudo vi policy.xml` (*Hint:* You may have to give your system password )
* Type `/` followed by `<policy domain="coder" rights="none" pattern="PDF" />`
* Replace it with `<policy domain="coder" rights="read|write" pattern="PDF" />` (Press `i` to go to insert mode and then do the required editing)
* Save the file
* To save: Press Esc followed by `:wq`.
* To exit without saving: Incase you are not happy with the edit press Esc followed by `:q!`
6. Fix Imagemagick Security bug
* Navigate to the policy.xml file of ImageMagick at /etc/ImageMagick-6/policy.xml (`cd /etc/ImageMagick-6/`)
* Open the file and find `<policy domain="coder" rights="none" pattern="PDF" />`
* `sudo vi policy.xml` (*Hint:* You may have to give your system password )
* Type `/` followed by `<policy domain="coder" rights="none" pattern="PDF" />`
* Replace it with `<policy domain="coder" rights="read|write" pattern="PDF" />` (Press `i` to go to insert mode and then do the required editing)
* Save the file
* To save: Press Esc followed by `:wq`.
* To exit without saving: Incase you are not happy with the edit press Esc followed by `:q!`
Now everything should be set up.
Now everything should be set up.
**Note**
## Note
<ins>To run the programs of exam scan use the `python3` command variations</ins>
To run the programs of exam scan use the `python3` command variations.
......@@ -2,74 +2,68 @@
This is a step-by-step guide to download and install the various software dependencies of the exam scan program for macOS. This version of code was tested on macOS 10.14 Mojave
**Step 1: Install Homebrew**
1. Install Homebrew
Type the following command in Terminal:
Type the following command in Terminal:
`/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"`
`/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"`
Once you have installed Homebrew, insert the Homebrew directory at the top of your PATH environment variable. You can do this by adding the following line at the bottom of your ~/.profile file
Once you have installed Homebrew, insert the Homebrew directory at the top of your PATH environment variable. You can do this by adding the following line at the bottom of your ~/.profile file
`export PATH="/usr/local/opt/python/libexec/bin:$PATH"`
`export PATH="/usr/local/opt/python/libexec/bin:$PATH"`
If you have OS X 10.12 (Sierra) or older use this line instead
If you have OS X 10.12 (Sierra) or older use this line instead
`export PATH=/usr/local/bin:/usr/local/sbin:$PATH`
`export PATH=/usr/local/bin:/usr/local/sbin:$PATH`
For more details refer to: https://brew.sh/#install
For more details refer to: [https://brew.sh/#install]
**Step 2: Install Python**
2. Install Python
MacOS X comes with pre-installed Python. However its' version is lower (most likely Python 2.x). The code for exam-scan requires Python 3.8/3.9, therefore one has to upgrade.
MacOS X comes with pre-installed Python. However its' version is lower (most likely Python 2.x). The code for exam-scan requires Python 3.8/3.9, therefore one has to upgrade.
Python can be upgraded easily with Homebrew. Type this below command to install Python:
Python can be upgraded easily with Homebrew. Type this below command to install Python:
`brew install python`
`brew install python`
After the installation type `python --version` and `python3 --version`. Both commands launch the Homebrew-installed Python 3 interpreter and should return the same python version (see below image).
After the installation type `python --version` and `python3 --version`. Both commands launch the Homebrew-installed Python 3 interpreter and should return the same python version (see below image).
<img src="/images/macpython.png" height="75" width ="500"/>
<img src="/images/macpython.png" height="75" width ="500"/>
For more details refer to this documentation: [https://docs.python-guide.org/starting/install3/osx/]
3. Install Imagemagick
For more details refer to this documentation: https://docs.python-guide.org/starting/install3/osx/
Type the following command in Terminal:
**Step 3: Install Imagemagick**
`brew install imagemagick`
Type the following command in Terminal:
For more details refer to this documentation: [https://docs.wand-py.org/en/latest/guide/install.html]
`brew install imagemagick`
4. Install Ghostscripts
For more details refer to this documentation: https://docs.wand-py.org/en/latest/guide/install.html
Type the following command in Terminal:
**Step 4: Install Ghostscripts**
`brew install ghostscript`
Type the following command in Terminal:
5. Check pip
`brew install ghostscript`
The Python installation with Homebrew installs PIP as well. You can check if PIP is installed with the below command:
**Step 5: Check PIP**
`pip -V`
The Python installation with Homebrew installs PIP as well. You can check if PIP is installed with the below command:
The command returns the current version of pip installed in your system along with it's location. The above command works similarly if you substituted `pip` with `pip3`
`pip -V`
<img src="/images/macpip.png" height="75" width ="500"/>
The command returns the current version of pip installed in your system along with it's location. The above command works similarly if you substituted `pip` with `pip3`
6. Install additional Python modules with pip
Install additional python modules by typing the below command in command prompt:
<img src="/images/macpip.png" height="75" width ="500"/>
`pip install -r requirements.txt`
The above command works similarly if you substituted `pip` with `pip3`.
**Step 6: Install additional Python modules with PIP**
Install additional python modules by typing the below command in command prompt:
`pip install wand pillow PyPDF2 pwgen pikepdf`
The above command works similarly if you substituted `pip` with `pip3`.
**Note**
<ins>To run the programs of exam scan you can use both `python3` and `python`command variations</ins>
## Note
To run the programs of exam scan you can use both `python3` and `python`command variations.
......@@ -2,98 +2,82 @@
This is a step-by-step guide to download and install the various software dependencies of the exam scan program for Windows 10
1. Install Chocolatey
**Step 1: Install Chocolatey**
Chocolatey is a package manager for Windows. It will help to install the different softwares the exam scan is dependant on.
Chocolatey is a package manager for Windows. It will help to install the different softwares the exam scan is dependant on.
Please note: If you already have Python3, ImageMagick and Ghostscript installed, you do not need Chocolatey to run the exam scan scripts. Please continue reading at Step 6.
Open the command prompt as Administrator and run the below command to install Chocolatey:
Open the command prompt as Administrator and run the below command to install Chocolatey:
```
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command " [System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
```bash
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command " [System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
```