amrav / chai Goto Github PK
View Code? Open in Web Editor NEWPython tool to help book tickets on the Indian Railways
Home Page: http://www.amrav.net/2014/03/14/chai/
License: Other
Python tool to help book tickets on the Indian Railways
Home Page: http://www.amrav.net/2014/03/14/chai/
License: Other
copying gevent/threadpool.py -> build/lib.macosx-10.10-x86_64-2.7/gevent
copying gevent/timeout.py -> build/lib.macosx-10.10-x86_64-2.7/gevent
copying gevent/util.py -> build/lib.macosx-10.10-x86_64-2.7/gevent
copying gevent/win32util.py -> build/lib.macosx-10.10-x86_64-2.7/gevent
copying gevent/wsgi.py -> build/lib.macosx-10.10-x86_64-2.7/gevent
running build_ext
Running '/bin/sh /private/var/folders/jj/z46b5_x91q3c465qyd0rcpmm0000gn/T/pip-build-HJWwZ9/gevent/libev/configure > configure-output.txt' in /private/var/folders/jj/z46b5_x91q3c465qyd0rcpmm0000gn/T/pip-build-HJWwZ9/gevent/build/temp.macosx-10.10-x86_64-2.7/libev
building 'gevent.core' extension
creating build/temp.macosx-10.10-x86_64-2.7/gevent
clang -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -U__llvm__ -DLIBEV_EMBED=1 -DEV_COMMON= -DEV_CLEANUP_ENABLE=0 -DEV_EMBED_ENABLE=0 -DEV_PERIODIC_ENABLE=0 -Ibuild/temp.macosx-10.10-x86_64-2.7/libev -Ilibev -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c gevent/gevent.core.c -o build/temp.macosx-10.10-x86_64-2.7/gevent/gevent.core.o
In file included from gevent/gevent.core.c:313:
In file included from gevent/libev.h:2:
libev/ev.c:477:48: warning: '/*' within block comment [-Wcomment]
/*#define MIN_INTERVAL 0.00000095367431640625 /* 1/2**20, good till 2200 */
^
libev/ev.c:970:42: error: '_Noreturn' keyword must precede function declarator
ecb_inline void ecb_unreachable (void) ecb_noreturn;
^~~~~~~~~~~~
_Noreturn
libev/ev.c:773:26: note: expanded from macro 'ecb_noreturn'
#define ecb_noreturn _Noreturn
^
libev/ev.c:1531:31: warning: 'extern' variable has an initializer [-Wextern-initializer]
EV_API_DECL struct ev_loop *ev_default_loop_ptr = 0; /* needs to be initialised to make it a definition despite extern */
^
libev/ev.c:1702:7: warning: unused variable 'ocur_' [-Wunused-variable]
array_needsize (ANPENDING, pendings [pri], pendingmax [pri], w_->pending, EMPTY2);
^
libev/ev.c:1664:22: note: expanded from macro 'array_needsize'
int ecb_unused ocur_ = (cur); \
^
libev/ev.c:1713:3: warning: unused variable 'ocur_' [-Wunused-variable]
array_needsize (W, rfeeds, rfeedmax, rfeedcnt + 1, EMPTY2);
^
libev/ev.c:1664:22: note: expanded from macro 'array_needsize'
int ecb_unused ocur_ = (cur); \
^
libev/ev.c:1840:7: warning: unused variable 'ocur_' [-Wunused-variable]
array_needsize (int, fdchanges, fdchangemax, fdchangecnt, EMPTY2);
^
libev/ev.c:1664:22: note: expanded from macro 'array_needsize'
int ecb_unused ocur_ = (cur); \
^
In file included from gevent/gevent.core.c:313:
In file included from gevent/libev.h:2:
In file included from libev/ev.c:2390:
libev/ev_kqueue.c:50:3: warning: unused variable 'ocur_' [-Wunused-variable]
array_needsize (struct kevent, kqueue_changes, kqueue_changemax, kqueue_changecnt, EMPTY2);
^
libev/ev.c:1664:22: note: expanded from macro 'array_needsize'
int ecb_unused ocur_ = (cur); \
^
In file included from gevent/gevent.core.c:313:
In file included from gevent/libev.h:2:
In file included from libev/ev.c:2396:
libev/ev_poll.c:66:7: warning: unused variable 'ocur_' [-Wunused-variable]
array_needsize (struct pollfd, polls, pollmax, pollcnt, EMPTY2);
^
libev/ev.c:1664:22: note: expanded from macro 'array_needsize'
int ecb_unused ocur_ = (cur); \
^
libev/ev.c:3554:34: warning: '&' within '|' [-Wbitwise-op-parentheses]
fd_change (EV_A_ fd, w->events & EV__IOFDSET | EV_ANFD_REIFY);
~~~~~~~~~~^~~~~~~~~~~~~ ~
libev/ev.c:3554:34: note: place parentheses around the '&' expression to silence this warning
fd_change (EV_A_ fd, w->events & EV__IOFDSET | EV_ANFD_REIFY);
^
( )
libev/ev.c:3593:3: warning: unused variable 'ocur_' [-Wunused-variable]
array_needsize (ANHE, timers, timermax, ev_active (w) + 1, EMPTY2);
^
libev/ev.c:1664:22: note: expanded from macro 'array_needsize'
int ecb_unused ocur_ = (cur); \
^
libev/ev.c:4273:5: warning: unused variable 'ocur_' [-Wunused-variable]
array_needsize (ev_idle *, idles [ABSPRI (w)], idlemax [ABSPRI (w)], active, EMPTY2);
^
libev/ev.c:1664:22: note: expanded from macro 'array_needsize'
int ecb_unused ocur_ = (cur); \
^
libev/ev.c:4313:3: warning: unused variable 'ocur_' [-Wunused-variable]
array_needsize (ev_prepare *, prepares, preparemax, preparecnt, EMPTY2);
^
libev/ev.c:1664:22: note: expanded from macro 'array_needsize'
int ecb_unused ocur_ = (cur); \
^
libev/ev.c:4351:3: warning: unused variable 'ocur_' [-Wunused-variable]
array_needsize (ev_check *, checks, checkmax, checkcnt, EMPTY2);
^
libev/ev.c:1664:22: note: expanded from macro 'array_needsize'
int ecb_unused ocur_ = (cur); \
^
libev/ev.c:4498:3: warning: unused variable 'ocur_' [-Wunused-variable]
array_needsize (ev_fork *, forks, forkmax, forkcnt, EMPTY2);
^
libev/ev.c:1664:22: note: expanded from macro 'array_needsize'
int ecb_unused ocur_ = (cur); \
^
libev/ev.c:4581:3: warning: unused variable 'ocur_' [-Wunused-variable]
array_needsize (ev_async *, asyncs, asyncmax, asynccnt, EMPTY2);
^
libev/ev.c:1664:22: note: expanded from macro 'array_needsize'
int ecb_unused ocur_ = (cur); \
^
14 warnings and 1 error generated.
error: command 'clang' failed with exit status 1
----------------------------------------
Command "/usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/jj/z46b5_x91q3c465qyd0rcpmm0000gn/T/pip-build-HJWwZ9/gevent/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/jj/z46b5_x91q3c465qyd0rcpmm0000gn/T/pip-qlOEmi-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/jj/z46b5_x91q3c465qyd0rcpmm0000gn/T/pip-build-HJWwZ9/gevent/
Hi @amrav ,
Thanks for creating chai. It is working well to check the availability of trains but I couldn't get the optimize result. There is some issue with grequests
. Here's the trace-back.
hargup@hargup-Lenovo-G580:~/210fs/chai
> python chai.py -t 12875 -s KGP -d AME -D 30 -m 9 optimize master [007d724]
Fetching stations on route... done.
Using up to 100 concurrent connections.
Fetching availability... 17%Traceback (most recent call last):
File "/home/hargup/anaconda/lib/python2.7/site-packages/gevent/greenlet.py", line 327, in run
result = self._run(*self.args, **self.kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/grequests.py", line 71, in send
self.url, **merged_kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/requests/sessions.py", line 448, in request
resp = self.send(prep, **send_kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/requests/sessions.py", line 554, in send
r = adapter.send(request, **kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/requests/adapters.py", line 410, in send
raise ConnectionError(e, request=request)
ConnectionError: HTTPConnectionPool(host='10.3.100.207', port=8080): Max retries exceeded with url: http://www.indianrail.gov.in/cgi_bin/inet_accavl_cgi.cgi (Caused by ProxyError('Cannot connect to proxy.', error(104, 'Connection reset by peer')))
<Greenlet at 0x7f05e0310a50: <bound method AsyncRequest.send of <grequests.AsyncRequest object at 0x7f05e0c2efd0>>(stream=False)> failed with ConnectionError
Fetching availability... 26%Traceback (most recent call last):
File "/home/hargup/anaconda/lib/python2.7/site-packages/gevent/greenlet.py", line 327, in run
result = self._run(*self.args, **self.kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/grequests.py", line 71, in send
self.url, **merged_kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/requests/sessions.py", line 448, in request
resp = self.send(prep, **send_kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/requests/sessions.py", line 554, in send
r = adapter.send(request, **kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/requests/adapters.py", line 410, in send
raise ConnectionError(e, request=request)
ConnectionError: HTTPConnectionPool(host='10.3.100.207', port=8080): Max retries exceeded with url: http://www.indianrail.gov.in/cgi_bin/inet_accavl_cgi.cgi (Caused by ProxyError('Cannot connect to proxy.', error(104, 'Connection reset by peer')))
<Greenlet at 0x7f05d8e72550: <bound method AsyncRequest.send of <grequests.AsyncRequest object at 0x7f05e0ae5e10>>(stream=False)> failed with ConnectionError
Traceback (most recent call last):
File "/home/hargup/anaconda/lib/python2.7/site-packages/gevent/greenlet.py", line 327, in run
result = self._run(*self.args, **self.kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/grequests.py", line 71, in send
self.url, **merged_kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/requests/sessions.py", line 448, in request
resp = self.send(prep, **send_kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/requests/sessions.py", line 554, in send
r = adapter.send(request, **kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/requests/adapters.py", line 410, in send
raise ConnectionError(e, request=request)
ConnectionError: HTTPConnectionPool(host='10.3.100.207', port=8080): Max retries exceeded with url: http://www.indianrail.gov.in/cgi_bin/inet_accavl_cgi.cgi (Caused by ProxyError('Cannot connect to proxy.', error(104, 'Connection reset by peer')))
<Greenlet at 0x7f05d8be1f50: <bound method AsyncRequest.send of <grequests.AsyncRequest object at 0x7f05e0b45e10>>(stream=False)> failed with ConnectionError
Fetching availability... 26%Traceback (most recent call last):
File "/home/hargup/anaconda/lib/python2.7/site-packages/gevent/greenlet.py", line 327, in run
result = self._run(*self.args, **self.kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/grequests.py", line 71, in send
self.url, **merged_kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/requests/sessions.py", line 448, in request
resp = self.send(prep, **send_kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/requests/sessions.py", line 554, in send
r = adapter.send(request, **kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/requests/adapters.py", line 410, in send
raise ConnectionError(e, request=request)
ConnectionError: HTTPConnectionPool(host='10.3.100.207', port=8080): Max retries exceeded with url: http://www.indianrail.gov.in/cgi_bin/inet_accavl_cgi.cgi (Caused by ProxyError('Cannot connect to proxy.', error(104, 'Connection reset by peer')))
<Greenlet at 0x7f05d8be1910: <bound method AsyncRequest.send of <grequests.AsyncRequest object at 0x7f05e0b22a90>>(stream=False)> failed with ConnectionError
Fetching availability... 61%Traceback (most recent call last):
File "/home/hargup/anaconda/lib/python2.7/site-packages/gevent/greenlet.py", line 327, in run
result = self._run(*self.args, **self.kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/grequests.py", line 71, in send
self.url, **merged_kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/requests/sessions.py", line 448, in request
resp = self.send(prep, **send_kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/requests/sessions.py", line 554, in send
r = adapter.send(request, **kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/requests/adapters.py", line 410, in send
raise ConnectionError(e, request=request)
ConnectionError: HTTPConnectionPool(host='10.3.100.207', port=8080): Max retries exceeded with url: http://www.indianrail.gov.in/cgi_bin/inet_accavl_cgi.cgi (Caused by ProxyError('Cannot connect to proxy.', error(104, 'Connection reset by peer')))
<Greenlet at 0x7f05d81060f0: <bound method AsyncRequest.send of <grequests.AsyncRequest object at 0x7f05e07b8c90>>(stream=False)> failed with ConnectionError
Traceback (most recent call last):
File "/home/hargup/anaconda/lib/python2.7/site-packages/gevent/greenlet.py", line 327, in run
result = self._run(*self.args, **self.kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/grequests.py", line 71, in send
self.url, **merged_kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/requests/sessions.py", line 448, in request
resp = self.send(prep, **send_kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/requests/sessions.py", line 554, in send
r = adapter.send(request, **kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/requests/adapters.py", line 410, in send
raise ConnectionError(e, request=request)
ConnectionError: HTTPConnectionPool(host='10.3.100.207', port=8080): Max retries exceeded with url: http://www.indianrail.gov.in/cgi_bin/inet_accavl_cgi.cgi (Caused by ProxyError('Cannot connect to proxy.', error(104, 'Connection reset by peer')))
<Greenlet at 0x7f05bb398910: <bound method AsyncRequest.send of <grequests.AsyncRequest object at 0x7f05e0e3e590>>(stream=False)> failed with ConnectionError
Fetching availability... 73%Traceback (most recent call last):
File "/home/hargup/anaconda/lib/python2.7/site-packages/gevent/greenlet.py", line 327, in run
result = self._run(*self.args, **self.kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/grequests.py", line 71, in send
self.url, **merged_kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/requests/sessions.py", line 448, in request
resp = self.send(prep, **send_kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/requests/sessions.py", line 554, in send
r = adapter.send(request, **kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/requests/adapters.py", line 410, in send
raise ConnectionError(e, request=request)
ConnectionError: HTTPConnectionPool(host='10.3.100.207', port=8080): Max retries exceeded with url: http://www.indianrail.gov.in/cgi_bin/inet_accavl_cgi.cgi (Caused by ProxyError('Cannot connect to proxy.', error(104, 'Connection reset by peer')))
<Greenlet at 0x7f05d8195050: <bound method AsyncRequest.send of <grequests.AsyncRequest object at 0x7f05e06ec750>>(stream=False)> failed with ConnectionError
Fetching availability... 96%Traceback (most recent call last):
File "/home/hargup/anaconda/lib/python2.7/site-packages/gevent/greenlet.py", line 327, in run
result = self._run(*self.args, **self.kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/grequests.py", line 71, in send
self.url, **merged_kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/requests/sessions.py", line 448, in request
resp = self.send(prep, **send_kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/requests/sessions.py", line 554, in send
r = adapter.send(request, **kwargs)
File "/home/hargup/anaconda/lib/python2.7/site-packages/requests/adapters.py", line 410, in send
raise ConnectionError(e, request=request)
ConnectionError: HTTPConnectionPool(host='10.3.100.207', port=8080): Max retries exceeded with url: http://www.indianrail.gov.in/cgi_bin/inet_accavl_cgi.cgi (Caused by ProxyError('Cannot connect to proxy.', error(104, 'Connection reset by peer')))
<Greenlet at 0x7f05ba02e050: <bound method AsyncRequest.send of <grequests.AsyncRequest object at 0x7f05e03d3910>>(stream=False)> failed with ConnectionError
Fetching availability... 99%
Traceback (most recent call last):
File "chai.py", line 201, in <module>
main()
File "chai.py", line 41, in main
args.func(args)
File "chai.py", line 26, in _optimize
optimize(args.train_no, args.src, args.dst, args.day, args.month, args.class_, args.quota)
File "chai.py", line 111, in optimize
print_plan(shortest_path(src, dst, stations['names'], cost), avail, indices)
File "chai.py", line 87, in shortest_path
weight=cost(names[i], names[j]))
File "chai.py", line 109, in cost
return numerical_cost(cost_tuple(src, dst, avail, indices))
File "chai.py", line 47, in cost_tuple
elif re.match("AVAILABLE", avail[v1][v2]):
KeyError: u'ETW'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.