Skip to content

Script runs infinitly

Hi @Thi26 , thanks for your work

I try to run your script on my machine, but nothing happends and I had to kill it.

Here's my context:

(tl-p02) 18:55 user@machine ~/git/tl-p02 % pip install -r requirements.txt 
Collecting requests
  Using cached requests-2.32.3-py3-none-any.whl (64 kB)
Collecting beautifulsoup4
  Using cached beautifulsoup4-4.13.3-py3-none-any.whl (186 kB)
Collecting charset-normalizer<4,>=2
  Using cached charset_normalizer-3.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (143 kB)
Collecting idna<4,>=2.5
  Using cached idna-3.10-py3-none-any.whl (70 kB)
Collecting urllib3<3,>=1.21.1
  Using cached urllib3-2.3.0-py3-none-any.whl (128 kB)
Collecting certifi>=2017.4.17
  Using cached certifi-2025.1.31-py3-none-any.whl (166 kB)
Collecting soupsieve>1.2
  Using cached soupsieve-2.6-py3-none-any.whl (36 kB)
Collecting typing-extensions>=4.0.0
  Using cached typing_extensions-4.12.2-py3-none-any.whl (37 kB)
Installing collected packages: urllib3, typing-extensions, soupsieve, idna, charset-normalizer, certifi, requests, beautifulsoup4
Successfully installed beautifulsoup4-4.13.3 certifi-2025.1.31 charset-normalizer-3.4.1 idna-3.10 requests-2.32.3 soupsieve-2.6 typing-extensions-4.12.2 urllib3-2.3.0


(tl-p02) 18:56 user@machine ~/git/tl-p02 % ./bookScraper.py https://books.toscrape.com/catalogue/the-story-of-art_500/index.html --output book_data.csv 
zsh: permission non accordée: ./bookScraper.py
zsh: exit 126   ./bookScraper.py  --output book_data.csv
(tl-p02) 18:57 user@machine ~/git/tl-p02 % chmod u+x bookScraper.py 
(tl-p02) 18:57 user@machine ~/git/tl-p02 % ./bookScraper.py https://books.toscrape.com/catalogue/the-story-of-art_500/index.html --output book_data.csv
^C
zsh: interrupt  ./bookScraper.py  --output book_data.csv
(tl-p02) 19:00 user@machine ~/git/tl-p02 % 
(tl-p02) 19:00 user@machine ~/git/tl-p02 % ll
total 42K
drwxr-xr-x  3 user user    6 25 mars  18:46 .
drwxr-x--- 41 user user   41 25 mars  18:46 ..
-rwxr--r--  1 user user 4,4K 25 mars  18:46 bookScraper.py
drwxr-xr-x  8 user user   14 25 mars  18:47 .git
-rw-r--r--  1 user user 1,6K 25 mars  18:46 README.md
-rw-r--r--  1 user user   25 25 mars  18:46 requirements.txt
(tl-p02) 19:00 user@machine ~/git/tl-p02 % ./bookScraper.py https://books.toscrape.com/catalogue/the-story-of-art_500/index.html --output book_data.csv
(tl-p02) 19:00 user@machine ~/git/tl-p02 % bookScraper.py
zsh: command not found: bookScraper.py
zsh: exit 127   bookScraper.py
(tl-p02) 19:00 user@machine ~/git/tl-p02 % ./bookScraper.py
^C
zsh: interrupt  ./bookScraper.py
(tl-p02) 19:01 user@machine ~/git/tl-p02 % 
(tl-p02) 19:01 user@machine ~/git/tl-p02 % ./bookScraper.py -h
^C
zsh: interrupt  ./bookScraper.py -h

(tl-p02) 19:01 user@machine ~/git/tl-p02 % git status         
Sur la branche main
Votre branche est à jour avec 'origin/main'.

Modifications qui ne seront pas validées :
  (utilisez "git add <fichier>..." pour mettre à jour ce qui sera validé)
  (utilisez "git restore <fichier>..." pour annuler les modifications dans le répertoire de travail)
	modifié :         bookScraper.py

aucune modification n'a été ajoutée à la validation (utilisez "git add" ou "git commit -a")

(tl-p02) 19:02 user@machine ~/git/tl-p02 % git lgla
* 2d7f5c4 (origin/version-2) Modifier README.md
* 6a87155 Supprimer bookScraper.py
* 945463f  V2: Extraction des informations d'une catégorie du site Books to Scrape
| * dd70d59 (HEAD -> main, origin/main, origin/HEAD) Modifier README.md
| * 4adae04 Modifier README.md
|/  
* be987db Version 1 de bookScraper.py avec Doctests, logging et argparse
* fdc57a5  Ajout du fichier requirements.txt
* f19589d  Ajout du fichier README.md
* d7692e1 Initial commit

(tl-p02) 19:02 user@machine ~/git/tl-p02 % git co -f version-2
la branche 'version-2' est paramétrée pour suivre 'origin/version-2'.
Basculement sur la nouvelle branche 'version-2'

(tl-p02) 19:02 user@machine ~/git/tl-p02 % chmod u+x bookScraper2.py 
(tl-p02) 19:02 user@machine ~/git/tl-p02 % ./bookScraper2.py -h  
^C
zsh: interrupt  ./bookScraper2.py -h
(tl-p02) 19:05 user@machine ~/git/tl-p02 % ll
total 42K
drwxr-xr-x  3 user user    6 25 mars  19:02 .
drwxr-x--- 41 user user   41 25 mars  18:46 ..
-rwxr--r--  1 user user 3,3K 25 mars  19:02 bookScraper2.py
drwxr-xr-x  8 user user   14 25 mars  19:02 .git
-rw-r--r--  1 user user 1,7K 25 mars  19:02 README.md
-rw-r--r--  1 user user   25 25 mars  18:46 requirements.txt
(tl-p02) 19:09 user@machine ~/git/tl-p02 % uname -a && python -V
Linux machine 6.1.0-31-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.128-1 (2025-02-07) x86_64 GNU/Linux
Python 3.11.2
(tl-p02) 19:09 user@machine ~/git/tl-p02 %