Skip to content

Commit

Permalink
Merge pull request #1001 from TeachMeTW/IO-fix
Browse files Browse the repository at this point in the history
Fix file handling to prevent ValueError
  • Loading branch information
shankari authored Dec 21, 2024
2 parents af72d04 + c2def6b commit 91b4b57
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions emission/net/ext_service/transit_matching/match_stops.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
url = "https://lz4.overpass-api.de/"

try:
query_file = open('conf/net/ext_service/overpass_transit_stops_query_template')
except:
with open('conf/net/ext_service/overpass_transit_stops_query_template', 'r', encoding='UTF-8') as query_file:
query_string = "".join(query_file.readlines())
except FileNotFoundError:
print("transit stops query not configured, falling back to default")
query_file = open('conf/net/ext_service/overpass_transit_stops_query_template.sample')

query_string = "".join(query_file.readlines())
with open('conf/net/ext_service/overpass_transit_stops_query_template.sample', 'r', encoding='UTF-8') as query_file:
query_string = "".join(query_file.readlines())

RETRY = -1

Expand Down

0 comments on commit 91b4b57

Please sign in to comment.