All Questions
Tagged with error-handling python-3.x
41 questions
3
votes
1
answer
99
views
Scraping website with Python and Selenium to collect data from dynamic website
Summary:
The code scrapes the website and collects the data to store it in CSV. It also downloads selected information that is available for download in PDF format. The details and the entire code are ...
2
votes
2
answers
197
views
Checking file header for magic number in Python
I wrote this to check files for successful compression with LZ4.
Any advice is welcome.
Particularly regarding raising exceptions and error handling.
...
1
vote
1
answer
198
views
Python exception for handling invalid argument types
Greetings
One small problem that anyone have to tackle with in Python is handling invalid argument types ( without an automatic static type checking tool like
Mypy )
One of the best methods for ...
3
votes
2
answers
486
views
Hardware API, primarily for Error handling
I have a piece of equipment that I am interacting with. The manufacturer provided an SDK and some simple examples of how to interact with the device. However, I need to write an API for interacting ...
1
vote
1
answer
135
views
Two versions of user-specified exception filters that log a different message on match
I'd like to show you two versions of my two functions that support my logging tools. Their purpose is to log a different message (here abort) when an error occured ...
1
vote
1
answer
410
views
Protecting functions from empty DataFrames
Pandas likes to throw cryptic errors when you feed its functions with empty DataFrames saying nothing that would help you to identify the root cause. In order to ...
1
vote
1
answer
235
views
Function to return a file name from lists/dictionary constants
I'm reworking a set of two functions that return a text file name, constructed from a string argument and string variables from a module called inventory. It seems ...
3
votes
1
answer
76
views
Cancelling function execution with a ContinuationError
Although throwing excptions for control flow is a controversial topic there are some quite popular examples of using this anti-pattern like C#'s async routines throwing the ...
3
votes
1
answer
170
views
Take in 10 numbers, validate each input, append then in a list and then prints the sum of the list values
I'm practicing loops in Python and started trying to have a better approach with user inputs, is there better ways of dealing with inputs when coding?
And I tried using deques too, it worked very well,...
3
votes
1
answer
100
views
Sending a CSV file for a client list from a database
What can I improve about this code in order to be production-ready? I'm not worried about security but about errors that could occur.
What exceptions should I catch? I feel overwhelmed about ...
4
votes
0
answers
87
views
Error handling best practices using a custom error handling module
I am trying to learn how to effectively use error handling in my code. To do this, I have created a class inside main.py which reads the value of a specified curve ...
1
vote
3
answers
1k
views
Custom exception handling function or logging library?
I want to document every exception handled in my code and some states of the code when it works properly.
What I've done is two functions, one that creates an 'error report' (function: ...
-3
votes
3
answers
99
views
Opinion on Python exceptions? [closed]
Just looking for opinions on which is the best way to use exceptions?
Should the exception handling go inside the function or should it go outside the function when you actually call the function. ...
1
vote
1
answer
79
views
File handling with try and except [closed]
I am learning programming with Python. I am not sure if I can write a try/except block like this.
...
4
votes
1
answer
2k
views
Minesweeper - Python 3 (beginner)
I’ve just created Minesweeper game, which work perfectly fine (for me).
Any suggestions on how to improve this code would be greatly appreciate, in terms of:
Object-oriented
Array
Error handling
...