jifunks / botany Goto Github PK
View Code? Open in Web Editor NEWcommand line virtual plant buddy
License: ISC License
command line virtual plant buddy
License: ISC License
If I leave botany running for too long (possibly while other users run it, or also leave it running), eventually a "database is locked" error invades the screen.
Sorry that it wasn't possibly to copy paste the full trace well (the output mangled with botany's usual output), but that I captured provides the relevant parts:
self.run()
File "/usr/lib/python3.9/threading.py", line 892, in run
File "/ self._target(*self._args, **self._kwargs) _bootstrap_inner
File "/home/repos/botany/botany.py", line 434, in autosave
self.update_garden_db(this_plant)
File "/home/repos/botany/botany.py", line 517, in update_garden_db
self.init_database()
File "/home/repos/botany/botany.py", line 491, in init_database
c.execute(init_table_string)
sqlite3.OperationalError: database is locked
I could provide a patch to catch the error on init_database's execute, but before that it probably makes sense to decide what to do in these cases: while ignoring the failure is probably alright on autosave calls (the next autosave deals with it; we can also create a counter of consecutive fails to make sure it is only a sporadic concurrency issue), it probably is not in other calls. Also, it make sense investigating the root cause of the issue - who/what is locking the database for so long?
It would be cool to make a web version of this so you could add it to a personal website. Since itβs already in python it could be run by a GitHub action, and somehow give users the ability to water the plant.
If I am correct, you can only find bigger communities in a tilde space (tilde.town, tildeverse), but it's really hard (if not impossible) to figure out if a tilde server runs botany and if they have active players and if, how many?
Is there a list with botany communities?
Would be very interesting to play this game within a big community.
After harevsting a plant, the next one showed up with a surprising growth rate:
'To see things in the seed, that is genius' - Lao Tzu
Generation: 64
Growth rate: 13.600000000000001x
if the plant owner waters the plant, disappears for a week, and during that time someone else waters the plant every day, and then sunday rolls around, the visitors will be cleared and the plant will die if the owner comes back even though it has not been a week since the plant was last watered
It appears to throw an error, and thus jump over setting the self.visited_plant to none again. This in turn results in in the interface drawing the visited plant, rather than yours for the remainder of the program running, unless you visit another garden.
Line 719 in da33b69
Although it is not really possible to prevent malicious users from removing the visitors, even if you water your own plant every day a malicious user could kill it.
Botany checks whether a plant is alive by checking if there is a difference in timestamps from all the waterings that is larger than 5 days.
A malicious user could create a timestamp in the past that is more than 5 days before the last time the user watered their own plant.
When the user then opens botany the plant will be killed.
A simple fix would be to discard all visitor timestamps that are before the last watered timestamp of the user themself (just like timestamps in the future are discarded).
Pardon this beginner-level question.
I'm created a small tilde server and a bit unsure the install process. Does botany get placed inside a shared directory that all users have access to? or is there some other system i should be setting up? Perhaps more explicit install instructions can be added to the README.md (I'd be happy to contribute if i knew the answer)
Please include a license so others may hack on your code!
Take a look at https://choosealicense.com/. If you want something simple, I recommend ISC.
It crashes on startup on terminals that don't support colours.
This corrupts the save file, making it crash all the next times too.
To reproduce, run:
TERM=vt100 ./botany.py
It is possible to detect whether the terminal supports colours by checking curses.COLORS
. This is the number of colours supported. If no colours are supported it is 0.
EDIT: curses.COLORS
doesn't seem to work, but using curses.has_colors()
does.
Is there a reason that this project is using python 2? Would it be better to port it to python 3?
Or are there reasons for this choice?
I saw that you also did rpg task.
why don't you merge the two projects and allow to give some water to the plants every time you complete a task?
In a month support for python2 will end. I think you should consider moving to python3. I made a PR you can use as the base for migrating - #24
Botany is installed on the tildeverse server I frequent. It was noticed that if a user's username contains a - botany will strip that out when you try to copy and paste the username or it wont let you type it in in order visit this users garden. I'm not sure if this is be design or an oversight. I suspect it does this to all special characters.
"I tried visiting cmccabe plant, which gave me the preview (with the RIP tomb), but now I can't see my own plant (either with water or look)"
also doesn't show "you watered x's
can resolve the issue by visiting a working plant.
i think the issue starts around line 704 in menu_screen.py
cmccabe also has weirdly formed json:
{"generation": 1, "score": 82672, "description": "seed", "owner": "cmccabe", "file_name": "/home/cmccabe/.botany/cmccabe_plant.datq\u0014", "age": "10d:17h:7m:22s", "stage": "seed", "is_dead": true, "last_watered": 1525946641}
(why is q\u0014 there?)
so kind of two issues:
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.