Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

airport_timezones.json Error #14

Closed
pltrant opened this issue Oct 11, 2022 · 5 comments
Closed

airport_timezones.json Error #14

pltrant opened this issue Oct 11, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@pltrant
Copy link

pltrant commented Oct 11, 2022

I'm suddenly getting this error. I do have the most current version downloaded. This is on Windows 11 (22H2) with Python 3.10.5.

C:\>python "C:\auto-southwest-check-in\southwest.py" 14MNE6 Soandso Person
Traceback (most recent call last):
  File "C:\auto-southwest-check-in\southwest.py", line 33, in <module>
    set_up(arguments)
  File "C:\auto-southwest-check-in\southwest.py", line 24, in set_up
    account.get_checkin_info(confirmation_number)
  File "C:\auto-southwest-check-in\lib\account.py", line 45, in get_checkin_info
    self._get_reservation_info(confirmation_number)
  File "C:\auto-southwest-check-in\lib\account.py", line 73, in _get_reservation_info
    flight = Flight(self, confirmation_number, flight)
  File "C:\auto-southwest-check-in\lib\flight.py", line 25, in __init__
    self._get_flight_info(flight)
  File "C:\auto-southwest-check-in\lib\flight.py", line 32, in _get_flight_info
    self.departure_time = self._get_flight_time(flight)
  File "C:\auto-southwest-check-in\lib\flight.py", line 37, in _get_flight_time
    airport_timezone = self._get_airport_timezone(departure_airport_code)
  File "C:\auto-southwest-check-in\lib\flight.py", line 44, in _get_airport_timezone
    with open("utils/airport_timezones.json") as tz:
FileNotFoundError: [Errno 2] No such file or directory: 'utils/airport_timezones.json'

\auto-southwest-check-in\utils\airport_timezones.json does exist too.

@pltrant
Copy link
Author

pltrant commented Oct 11, 2022

This fixes it on Windows, but I'm not sure about linux:

_get_airport_timezone in flight.py:

script_dir = os.path.dirname(__file__)
tz_file_path = '..\\utils\\airport_timezones.json'
with open(os.path.join(script_dir, tz_file_path)) as tz:

@jdholtz
Copy link
Owner

jdholtz commented Oct 11, 2022

Thanks for bringing this to my attention. I forgot to test on Windows. I’ll try to integrate your potential fix to work on both systems.

@jdholtz
Copy link
Owner

jdholtz commented Oct 11, 2022

Oh, this is actually an error when not running the script in the project directory. That means the config file is not being read correctly either. I will make a new branch to fix this soon.

Edit: The config file was still being read correctly.

@jdholtz
Copy link
Owner

jdholtz commented Oct 11, 2022

Hey @pltrant. I've provided a potential fix in the absolute_paths branch. Can you test this to make sure it works in Windows (python should handle it, but just to be sure)?

P.S your Check In information is in the picture you provided. You may want to remove that

@pltrant
Copy link
Author

pltrant commented Oct 11, 2022

Confirmed, this resolved the issue!

[The check in information from my original post were modified . That's not the real information . Thanks though!]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants