Python Forum
Issue with error handling
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Issue with error handling
#2
Well, I am not new to Python, actually I am newer than you. I am just trying to help so excuse me if my help is not what you are expecting.

I see that you have 8 countries available for the user, and the user has to use only 5 countries from the list. I cannot understand what the else section is doing.
if any(e.lower() == 'germany' for e in exchanges):
                global data_germany
                data_germany = quandl.get("CHRIS/EUREX_FDAX1", authtoken='hZcy4YazMK8shJxDxV-q', start_date=start, end_date=end)         
                return data_germany
            else: 
                print("Please, enter a coutry specified in the list")
                exchange1 = None
What I see, that someone would choose any combination from the 8 countries, or would even enter invalid country. So, why not to check using the if statement whether the countries in [exchanges] is belonging to the original preferred 8 countries?
Reply


Messages In This Thread
Issue with error handling - by Alberto - Jan-29-2018, 04:39 PM
RE: Issue with error handling - by Msaad - Jan-29-2018, 06:09 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  error handling in multiprocessing /spawn.py Cees 0 2,917 Feb-03-2020, 03:22 PM
Last Post: Cees

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020