Coder Social home page Coder Social logo

subwayclock's Introduction

subwayclock

Display clock for NYC subways

subwayclock's People

Contributors

lightalan avatar qirh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

subwayclock's Issues

Can't use 2 different station feeds in one instance...

If I try to use 2 different stations not on the same feed, the output fails. Example below.

pi@raspberrypi:~/subway $ ./mta.py 234N A42N
(('2', '4', '4', '2', '4', '2', '4', '2', '4'), (4, 6, 15, 19, 22, 31, 39, 42, 54), [], [])

pi@raspberrypi:~/subway $ ./mta.py 234N 234S
(('2', '4', '4', '2', '4', '2', '4', '2', '2'), (3, 5, 14, 19, 22, 30, 39, 42, 54), ('2', '4', '4', '2', '2', '4', '4', '2', '4', '2', '4', '2', '4', '2', '2', '4', '2'), (7, 8, 17, 21, 30, 31, 34, 37, 46, 52, 58, 64, 71, 77, 91, 92, 107))

I think you may end up having to make 2 calls if there are different feeds for the 2 stations called.

I was using it for 2 nearby stations in Brooklyn headed into the city. One is Hoyt-Schermerhorn, on the A, C, G (A42N) and Nevins Street on the 2,3,4,5 (234N).

Thank you for your awesome code. It's working in ALL other aspects. 👍

Error when testing mta.py

Im running into an issue when testin ./mta.py

I am receiving the following - are able to help point me in the right direction?

Traceback (most recent call last):
File "./mta.py", line 180, in
print(getTrainTimes("Q03N","Q03S"))
File "./mta.py", line 151, in getTrainTimes
times = gettimes(f, ourUptownStation, ourDowntownStation)
File "./mta.py", line 72, in gettimes
response = requests.get(feed, headers=headers, timeout=30)
File "/usr/lib/python3/dist-packages/requests/api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "/usr/lib/python3/dist-packages/requests/api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 354, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/lib/python3.7/http/client.py", line 1244, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.7/http/client.py", line 1285, in _send_request
self.putheader(hdr, value)
File "/usr/lib/python3.7/http/client.py", line 1217, in putheader
values[i] = one_value.encode('latin-1')
UnicodeEncodeError: 'latin-1' codec can't encode character '\ufeff' in position 0: ordinal not in range(256)

API Change

I noticed that my clock started having problems a little while back but was able to get it working again with a reboot. Recently i attempted this and when it came back up it couldnt connect at all. I attempted to build a new unit to see if something had gotten corrupted but discovered the issue appears to be with the API/mta.py. I noticed that my account no longer let me sign in so i signed up again and when i did so, I tried to run mta.py manually and it returned blank values. I tried to get a new api key and it returns the erros listed below. I was wondering if you had encountered the same thing and if you had modified the script accordingly. It appears the issues stems from the get train times function.

Traceback (most recent call last):
File "./mta.py", line 176, in
print(getTrainTimes("Q03N","Q03S"))
File "./mta.py", line 147, in getTrainTimes
times = gettimes(f, ourUptownStation, ourDowntownStation)
File "./mta.py", line 72, in gettimes
feed.ParseFromString(response.content)
File "/home/pi/.local/lib/python3.7/site-packages/google/protobuf/message.py", line 199, in ParseFromString
return self.MergeFromString(serialized)
File "/home/pi/.local/lib/python3.7/site-packages/google/protobuf/internal/python_message.py", line 1134, in MergeFromString
if self._InternalParse(serialized, 0, length) != length:
File "/home/pi/.local/lib/python3.7/site-packages/google/protobuf/internal/python_message.py", line 1188, in InternalParse
buffer, new_pos, wire_type) # pylint: disable=protected-access
File "/home/pi/.local/lib/python3.7/site-packages/google/protobuf/internal/decoder.py", line 977, in _DecodeUnknownField
raise _DecodeError('Wrong wire type in tag.')
google.protobuf.message.DecodeError: Wrong wire type in tag.

subway.py not working tkinter import *

Im getting an error

ModuleNotFoundError: No module named 'tkinter". I have no idea how to address this.

I will state that i am doing this in an Ubuntu VM because my new PI and Display dont arrive until next week but i wanted to get everything working first so that this would be an easy build to give to my girlfriend as a gift.

When i run ./mta.py with my station information i get good results so that script is working fine.

Any help would be greatly appreciated.

thanks,
-mp

Error while running subway.py

I’ve been trying to run the subway.py

But I keep getting the same error message

pi@raspberrypi:~/subway $ ./subway.py
Traceback (most recent call last):
File "./subway.py", line 171, in
m = Tk()
File "/usr/lib/python3.5/tkinter/init.py", line 1880, in init
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable

I don’t know if I’m missing something

Thanks in advance

feedsToCheck Appears to Only Check One Feed Per Station

I'm trying to identify trains running on two lines, the A/C and B/D, arriving at Columbus Circle, station A24. The code, however, only returns the trains arriving on the B/D line, which are associated with feedsToCheck = BDFMfeednum. If I put ACEHfeednum ahead of BDFMfeednum, the code returns the trains arriving on the A/C line, but not the B/D line. I can't seem to get the code to return the trains running on both lines.

Any help would be greatly appreciated.

DecodeError: Truncated message

Traceback (most recent call last):
File "/home/pi/.local/lib/python3.7/site-packages/google/protobuf/internal/python_message.py", line 1127, in MergeFromString
if self._InternalParse(serialized, 0, length) != length:
File "/home/pi/.local/lib/python3.7/site-packages/google/protobuf/internal/python_message.py", line 1181, in InternalParse
buffer, new_pos, wire_type) # pylint: disable=protected-access
File "/home/pi/.local/lib/python3.7/site-packages/google/protobuf/internal/decoder.py", line 969, in _DecodeUnknownField
(data, pos) = _DecodeUnknownFieldSet(buffer, pos)
File "/home/pi/.local/lib/python3.7/site-packages/google/protobuf/internal/decoder.py", line 943, in _DecodeUnknownFieldSet
(tag_bytes, pos) = ReadTag(buffer, pos)
File "/home/pi/.local/lib/python3.7/site-packages/google/protobuf/internal/decoder.py", line 192, in ReadTag
while six.indexbytes(buffer, pos) & 0x80:
IndexError: index out of bounds on dimension 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "./mta.py", line 180, in
print(getTrainTimes("Q03N","Q03S"))
File "./mta.py", line 151, in getTrainTimes
times = gettimes(f, ourUptownStation, ourDowntownStation)
File "./mta.py", line 76, in gettimes
feed.ParseFromString(response.content)
File "/home/pi/.local/lib/python3.7/site-packages/google/protobuf/message.py", line 187, in ParseFromString
return self.MergeFromString(serialized)
File "/home/pi/.local/lib/python3.7/site-packages/google/protobuf/internal/python_message.py", line 1133, in MergeFromString
raise message_mod.DecodeError('Truncated message.')
google.protobuf.message.DecodeError: Truncated message.

Getting some errors - not sure how to troubleshoot further. Happens when running as ./mta.py or as ./mta.py 127N 127S.

Display Size doesn't fit

I went with a different display then the one you listed and while everything works great now from a code perspective, if i have the pi connected to a monitor or a tv when i plug it into the small screen/case that i had intended run this on, the display is too large and you can only see the direction one way and the otherway is cut off. I went into raspi-config and set the resolution to 800 x 480 which is what the manufacturer lists. This seems to work fine for the regular desktop but not the subway time output. Is there an easy way to resize the output so that it will fit this screen correctly or would it make more sense for me to get a different screen and use this one for a different project down the road. Any assistance will definitely help and i apologize for asking you my previous question about tkinter since it would have been irrelevant if i had atually been using the raspian os instead of a basic ubuntu installation.

Stopped working this morning.

Everything was working and i was getting the correct times for my station, but starting this morning i noticed that the train time wasnt updating, and it stopped getting the train time. now when i try to run mta.py i get the following error. cant figure out why.

pi@raspberrypi:~/subway $ ./mta.py
Traceback (most recent call last):
File "./mta.py", line 177, in
print(getTrainTimes("Q03N","Q03S"))
File "./mta.py", line 148, in getTrainTimes
times = gettimes(f, ourUptownStation, ourDowntownStation)
File "./mta.py", line 73, in gettimes
feed.ParseFromString(response.content)
File "/home/pi/.local/lib/python3.7/site-packages/google/protobuf/message.py", line 187, in ParseFromString
return self.MergeFromString(serialized)
File "/home/pi/.local/lib/python3.7/site-packages/google/protobuf/internal/python_message.py", line 1127, in MergeFromString
if self._InternalParse(serialized, 0, length) != length:
File "/home/pi/.local/lib/python3.7/site-packages/google/protobuf/internal/python_message.py", line 1185, in InternalParse
new_pos = local_SkipField(buffer, old_pos, end, tag_bytes)
File "/home/pi/.local/lib/python3.7/site-packages/google/protobuf/internal/decoder.py", line 1032, in SkipField
return WIRETYPE_TO_SKIPPER[wire_type](buffer, pos, end)
File "/home/pi/.local/lib/python3.7/site-packages/google/protobuf/internal/decoder.py", line 922, in _SkipLengthDelimited
raise _DecodeError('Truncated message.')
google.protobuf.message.DecodeError: Truncated message.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.