[BUG] Instapy shouldn't crash (ie exit(9)) on upload function
katsully opened this issue · 0 comments
Describe the bug
I was using the cli.upload function inside my code with a try/except. This code will be part of an ongoing installation so if the wifi cuts out for whatever reason I need the script to keep running. However, with the current version of instapy, the script crashes despite have a try/except because of a exit function inside its own try/except. (cli.py line 74)
To Reproduce
Code to reproduce the behavior:
try:
with client(username,password) as cli:
cli.upload(fileName, text)
except Exception as e:
print(e.output)
Then cut the wifi/internet. The program will crash despite there being a try/except. Users should have power with what happens on an error, not the library.
Expected behavior
A clear and concise description of what you expected to happen.
Logs
If there are any errors or exceptions, add the logs to help explain your problem.
ClientError URLError urlopen error [Errno 11001] getaddrinfo failed> (Code: 0, Response: )
Env (please complete the following information):
- Windows 10
- Python: 3.6
- instapy-cli Version: 0.0.9.0
Additional context
Add any other context about the problem here.
- Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)
My original stackoverflow post: https://stackoverflow.com/questions/58072571/prevent-python-script-from-crashing-with-try-except-using-instapy-cli-library
My forked library with the exit function commented out: https://github.com/katsully/instapy-cli