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

Add support for Windows operating systems. #13

Open
rmkujala opened this issue Apr 1, 2018 · 4 comments
Open

Add support for Windows operating systems. #13

rmkujala opened this issue Apr 1, 2018 · 4 comments

Comments

@rmkujala
Copy link
Member

rmkujala commented Apr 1, 2018

Some crucial parts of gtfspy do not work on Windows.

To sort this out, we should

  1. Identify what parts do not work on Windows (at least the way the process timezones is set does not work sometimes?)
  2. Work around these issues when time permits.

Any contributions towards this end are also welcome!

Documenting the progress on this front in this issue. Let us also know (by commenting below), if this issue (library not running on windows) is blocking you from using this library.

In the meanwhile, one workaround could be to work around the problem using VirtualBox or installing Linux next to with Windows.

@guidesc
Copy link

guidesc commented Apr 3, 2018

Hi Rainer,

Thx for all your efforts to open source this library. I'm on Windows 7 and has an issue when I ran example_export.py file.

The issue is the following: module 'time' has no attribute 'tzset'.

I searched online and it seems like it only supports Unix system.

@rkdarst
Copy link
Member

rkdarst commented Apr 3, 2018

The original reason for the timezone handling was to use the operating system timezone database with the built-in sqlite functions (because unix comes with the full zoneinfo database and can be configured per-process). Windows doesn't have that functionality... so you have to use pytz instead. Since all the sqlite date handling is my fault, I took a look to see what needs to be updated for timezone stuff:

A while ago, I think someone did most of the work needed to make it independent of the OS, so actually is pretty easy.

I see the remaining sqlite functions in these places:

  • day_loader.py: strftime (line 88) (This converts a day '2018-04-03' to "unixtime at noon minus 12 hours". I guess do this manually in the loop right above, make a new variable, add to the insert statement)
  • dates_loader.py strftime again (line 97) (A bit harder because this data goes from one table to another without coming through Python. Or one could make a python-sqlite function, bind it, and use that (probably too much work), )
  • copy_where strings in calendar_dates_loader.py, calendar_loader.py. (these are statically calculated, so do the calculation in Python in TableLoader.copy first, add new template variable start_date and end_date and put those in there.)

So overall, I think @rmkujala or someone already solved the hardest problems, and these are easier relatively...

Another workaround: Installing Cygwin used to be a good workaround on Windows (basically unix operating system APIs on windows). I think it should emulate the right APIs.

@evelyn9191
Copy link
Contributor

This issue is blocking me from using this library on Windows. Maybe with another library, such as pytz, the same could be achieved?

@jweckstr
Copy link
Collaborator

I'm sorry for the let down but at the moment no one of the gtfspy developers have the time nor the resources to implement these changes. However, we gladly invite anyone to implement the changes themselves and make a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants