rbavishi / habitican-curse Goto Github PK
View Code? Open in Web Editor NEWA Terminal application for HabitRPG using the python curses library
License: MIT License
A Terminal application for HabitRPG using the python curses library
License: MIT License
This repo is missing a license. Without a license, all code is copyright the author and may not be used by anyone else.
Please use something like http://choosealicense.com/ to decide what license to use. I recommend MIT or GPL.
From @LordVladneutral in #8 - Sometimes there are issues with symobls in task names - this should fail gracefully.
python2.7 habitican-curse :(
Traceback (most recent call last):
File "habitican-curse", line 54, in
curses.wrapper(main)
File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
return func(stdscr, *args, **kwds)
File "habitican-curse", line 39, in main
G.reqManager.FetchData()
File "/usr/lib/python2.7/site-packages/habitican_curse/request_manager.py", line 221, in FetchData
logger.debug("Processing a TODO: %s" % str(i['text']))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xea' in position 10: ordinal not in range(128)
Am I running it with the wrong python version? (trying to run it in python3)
Version 2 of the Habitica API will be officially deactivated on July 15th.
Here is a migration guide for upgrading to version 3. If you have any questions, feel free to reach out on Github or the Aspiring Comrades Guild.
Reported in #18 , sometimes the API responds with HTTP codes that we don't support - this should be logged/warned and should fail gracefully rather than via an uncaught exception.
I like to mess around with programs and to test their limits. You cannot normally delete a task from a challenge, but in habitican-curse you can flag it for deletion, and that gets you this error message (when you try to write the changes) :
python2.7 habitican-curse
Traceback (most recent call last):
File "habitican-curse", line 54, in <module>
curses.wrapper(main)
File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
return func(stdscr, *args, **kwds)
File "habitican-curse", line 48, in main
G.intf.Input()
File "/usr/lib/python2.7/site-packages/habitican_curse/interface.py", line 354, in Input
self.Command(command)
File "/usr/lib/python2.7/site-packages/habitican_curse/interface.py", line 262, in Command
G.reqManager.Flush() #Send the queue
File "/usr/lib/python2.7/site-packages/habitican_curse/request_manager.py", line 320, in Flush
self.DeleteTask(i.task.taskID)
File "/usr/lib/python2.7/site-packages/habitican_curse/request_manager.py", line 123, in DeleteTask
return self.APIV3_call("tasks/"+task_id,method='delete')
File "/usr/lib/python2.7/site-packages/habitican_curse/request_manager.py", line 73, in APIV3_call
raise ValueError("HTTP Response not recognized: %d" % resp.status_code)
ValueError: HTTP Response not recognized: 401
python2.7 habitican-curse 7,42s user 0,70s system 0% cpu 5:33:29,51 total
Of course nobody should do that, I certainly won't do it again, but in case, there are two fixes you can make for this :
This is how I see it.
Again, just messing around with the program, I noticed it didn't take count of the custom start hour. My cron happens at 6 AM, but if I refresh after midnight, the due dailies are shown as those for the next day.
Not even really an issue, I can deal with that, but it is a possible improvement.
Here's the backtrace:
karanbavishi:Habitican-Curse karan$ python habitica.py
Traceback (most recent call last):
File "habitica.py", line 53, in <module>
curses.wrapper(main)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/curses/wrapper.py", line 43, in wrapper
return func(stdscr, *args, **kwds)
File "habitica.py", line 50, in main
G.intf.Input()
File "/Users/karan/Habitican-Curse/interface.py", line 278, in Input
self.Command(command)
File "/Users/karan/Habitican-Curse/interface.py", line 240, in Command
CT.GetData()
File "/Users/karan/Habitican-Curse/content.py", line 149, in GetData
userStats = H.GetUserStats(data)
File "/Users/karan/Habitican-Curse/helper.py", line 265, in GetUserStats
(gearStats['klass'] == "special" and gearStats['specialClass'] == userClass)):
KeyError: 'specialClass'
It would be fantastic if this were an executable available via pip instead of manual installation.
Traceback (most recent call last):
File "/usr/local/bin/habitican-curse", line 45, in
curses.wrapper(main)
File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
return func(stdscr, *args, **kwds)
File "/usr/local/bin/habitican-curse", line 32, in main
G.intf.Init()
File "/usr/local/lib/python2.7/dist-packages/habitican_curse/interface.py", line 36, in Init
G.HabitMenu.SetXY(1, 2)
AttributeError: 'NoneType' object has no attribute 'SetXY'
anyone have any suggestions?
The curses library seems REALLY fragile. It doesn't work using xfce4-terminal
:
$ habitican-curse
Traceback (most recent call last):
File "/usr/bin/habitican-curse", line 45, in <module>
curses.wrapper(main)
File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
return func(stdscr, *args, **kwds)
File "/usr/bin/habitican-curse", line 27, in main
G.screen.Initialize()
File "/usr/lib/python2.7/site-packages/habitican_curse/screen.py", line 64, in Initialize
curses.init_pair(C.SCR_COLOR_LIGHT_ORANGE, 209, C.SCR_COLOR_BGRD)
_curses.error: init_pair() returned ERR
Uusing Termite
gets a little farther:
[screen clear]
Connecting...
[screen clear]
Traceback (most recent call last):
File "/usr/bin/habitican-curse", line 45, in <module>
curses.wrapper(main)
File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
return func(stdscr, *args, **kwds)
File "/usr/bin/habitican-curse", line 32, in main
G.intf.Init()
File "/usr/lib/python2.7/site-packages/habitican_curse/interface.py", line 55, in Init
G.screen.SaveInRegister(0)
File "/usr/lib/python2.7/site-packages/habitican_curse/screen.py", line 101, in SaveInRegister
self.screen.putwin(self.ctxts[register])
_curses.error: putwin() returned ERR
Doesn't even work on xterm
...
What's up?
I've installed on python2 on Arch Linux.
I see a ton of errors related to curses when using this - mainly to do with resizing windows and drawing lists, output, etc. I think it stems from the fact that, while curses is being used, it's just one plain window and everything is being drawn by hand inside. I''m going to take a crack at "cursifying" this a bit more and using the API to handle the windowing a bit more in line with the curses design guide.
Branch is here and is very much a WIP at this point: https://github.com/jasonuher/Habitican-Curse/tree/UI_fixes
Generated by the #18 mega thread from @LordVladneutral.
Users should be able to:
Installed without sudo, ran habitican-curse :help
and entered uuid and api copy and pasted from site. Was returned an error. I think this must have contained a space character at the end as it was copy pasted from the site so I assumed the uuid/api was incorrect. Deleted ~/.habiticarc
and reentered password on prompt (it would be good to be informed I was storing my password in plaintext). Reinstalled with sudo. habitican-curse :help
. Got the same error.
OSX 10.10.5
Traceback (most recent call last):
File "/Users/kungfujam/anaconda/bin/habitican-curse", line 45, in <module>
curses.wrapper(main)
File "/Users/kungfujam/anaconda/lib/python2.7/curses/wrapper.py", line 43, in wrapper
return func(stdscr, *args, **kwds)
File "/Users/kungfujam/anaconda/bin/habitican-curse", line 30, in main
G.reqManager.FetchData()
File "/Users/kungfujam/anaconda/lib/python2.7/site-packages/habitican_curse/request_manager.py", line 120, in FetchData
item = T.TODO(i)
File "/Users/kungfujam/anaconda/lib/python2.7/site-packages/habitican_curse/task.py", line 299, in __init__
self.dueDate = H.DateTime(str(data['date'])).DueDateFormat()
File "/Users/kungfujam/anaconda/lib/python2.7/site-packages/habitican_curse/helper.py", line 176, in __init__
self.date = self.ConvertDate(inpDate)
File "/Users/kungfujam/anaconda/lib/python2.7/site-packages/habitican_curse/helper.py", line 193, in ConvertDate
retDate = datetime.strptime(date,"%Y-%m-%dT%H:%M:%S.%fZ")
File "/Users/kungfujam/anaconda/lib/python2.7/_strptime.py", line 325, in _strptime
(data_string, format))
ValueError: time data 'None' does not match format '%Y-%m-%dT%H:%M:%S.%fZ'
We can't assume that the user has entered his credentials in the correct manner in .habiticarc
. Eg. What if he enters the key followed by the UUID?
We should maybe let .habiticarc be a collection of key-value pairs to avoid confusion. Eg.
uuid=wayne_rooney
key=ballondor
Also, asking the user to create this file is a little cumbersome, and habitica.py
should not assume that it has been created.
Let habitica.py
first check if .habiticarc
exists and if it contains the user credentials. If not, it should create the file itself before communicating with the server
Generated by the #18 mega thread from @LordVladneutral.
The behavior of the various read/write commands should be consistent and should be included in the documentation. (ie, :r :w :wq etc)
It would be great if the program could display and/or modify the extra notes for any given task. I don't think it would be hard to add either.
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.