From 82f555b884f5bf06de9929d407646bf01e6ea74d Mon Sep 17 00:00:00 2001 From: Phyks Date: Sun, 8 Sep 2013 23:35:37 +0200 Subject: [PATCH] Bug correction (with cwd) if not executed from its directory --- README.md | 3 +++ velib_stats.py | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index 5e5132f..4244548 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,9 @@ velib_stats.py NUMERO_DE_STATION Pour trouver le numéro unique identifiant la station qui vous intéresse, rendez-vous sur le site de Vélib (http://www.velib.paris.fr/Plan-stations) et recupérez le numéro de la station qui vous intéresse dans l'infobulle. +## Pré-requis +Vous aurez besoin de python3 et du module urllib3 (à installer avec pip au besoin) pour utiliser ce script. + ## License Please, send me an email if you use or modify this program, just to let me know if this program is useful to anybody or how did you improve it :) You can also send me an email to tell me how lame it is ! :) diff --git a/velib_stats.py b/velib_stats.py index c98c50d..9bafaa7 100755 --- a/velib_stats.py +++ b/velib_stats.py @@ -1,10 +1,16 @@ #!/usr/bin/python import sys +import os import datetime import urllib3 import xml.etree.ElementTree as ET +# Change working directory if necessary +file_path = os.path.dirname(__file__) +if file_path != "": + os.chdir(file_path) + if len(sys.argv) != 2: exit('Usage : velib_stats.py Station_number')