How do you save what you've done in a module without keeping the computer on? [closed] - python

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Am going to design a game about raising dragons but don't know a way of saving my session/exp/stats so it would be pointless! Can't work out how to use pickle so can somebody give me an answer?
P.S.Simplify your answers as I am stupid

Here is a link for info on basic I/O in the standard library: http://docs.python.org/tutorial/inputoutput.html You will want to store the data from the game in some format (that is up to you) to a file, and then, later, you will read the file, and parse the data, and put it back into memory when the user comes back from a previous session.

Related

Running a function with the different functionalities at different times in Python [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I'm looking for a way to create a function that takes two args, time and operation and it does the operation at the given time as an argument. The script should be running on a server and it reads the data from a Redis-like database. I'm trying to find a way to do that avoid using any other frameworks or non-standard packages. Have any idea about that?
See the library https://github.com/dbader/schedule and this example https://github.com/dbader/schedule/blob/master/docs/examples.rst#run-a-job-once

How can I get how long my computer's been idle (idle time) using python? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
The computer obviously stores it sense it knows when to put the screen saver on. Is there a python program that can get the computer's idle time?
This questions has already been answered several times it appears. A quick google search for this topic should give you other stack overflow Q's & A's for this question, but here is one of the previously answered links:
detecting idle time using python

How to save an svg-element using selenium not locally? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have a python-selenium-bot that takes a screenshot of an image and saves it in an assets folder which my frontend flutter-app then accesses.
However I think there is a better way to do this. Is it possible to not save the picture on the disk but rather in a variable or something like that so that I can send it via my rest api. This would be a lot cleaner and not so error prone.
Is there any way to save a svg without taking a screenshot of it?
Update:
My solution now is calling driver.get_screenshot_as_bas64 this allows me to save the screenshot as base64 in a variable and then pass that through my API. My Frontend can then decoded that screenshot again.

How to verify it's the same computer [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I was wondering if there's any Python code I can run that, assuming the Python code has not been tampered with, will return an ID specific to that computer that cannot be spoofed. My initial thought was to use MAC addresses, but I know those can be easily spoofed. How about CPU serial number? How would I go about doing that?
Thanks.
This is an impossible problem, as it's equivalent to effective DRM. Every identifier can be spoofed. Remember, the user can tamper with your Python code (any compiling/obfuscating/encrypting you do can be reversed, so don't bother) to return whatever identifier they want. (And even if your code were absolutely read-only, they could change the Python runtime or the OS to do whatever they want.)

hook file creation in python [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm working on a program, where in some part of it, it needs to listen to the OP for when files are created/saved, so I can work on said file.
I know the basic concept of hooking, but I don't know exactly how to implement it in this specific use(I know how to attach a hook to a specific PID, but here I need to listen to all processes and see if one of them is creating a file).
I'm using pydbg for my hooking needs, but if your answer uses something different, feel free to still answer.
Thanks :)
It seems you need something like watchdog, pyinotify or python-inotify. You can also see this SO question for other options.

Categories

Resources