Jump to content

Recommended Posts

Posted (edited)

For my master thesis I need realtime GTFS data which can be retrieved and parsed with python.
I have this script working locally.

When executed here i get a 500 error. (Exec format error: exec of '***/cgi-bin/gtfsrealtime.py' failed: ***/cgi-bin/gtfsrealtime.py)

 

Could it be that the modules from the google packages I'm importing are missing? (I've read on the forum that the requests package should be installed)

Would it be possible to have them installed if so? (I am on Johnny using python 2.7)

 

Thanks in advance!

from google.transit import gtfs_realtime_pb2
from google.protobuf import json_format
import requests

feed = gtfs_realtime_pb2.FeedMessage()
response = requests.get('https://***')
feed.ParseFromString(response.content)


json = json_format.MessageToJson(feed)


f = open("test.json", "w")
f.write(json)


for entity in feed.entity:
   if entity.HasField('trip_update'):
     print entity.trip_update

f.close()
Edited by pieterm
Posted

 

# pip install google.transit
Collecting google.transit
  Could not find a version that satisfies the requirement google.transit (from versions: )
No matching distribution found for google.transit

# pip install google.protobuf
Collecting google.protobuf
  Could not find a version that satisfies the requirement google.protobuf (from versions: )
No matching distribution found for google.protobuf
Guest
This topic is now closed to further replies.
×
×
  • Create New...