hook file creation in python [closed] - python

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.

Related

How to convert python code into a simple c haeder? [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 7 months ago.
Improve this question
I'm Working on a program that takes in text from the user and then implements functionalities in the backend, kind of like an interpreter, I have the parser working amazingly in python but some of the backend capabilities I feel would do great on c. I have looked into CPython but I don't seem to understand how to do it if it's even possible at all. I'm just a beginner, if someone could guide that will be very helpful.
CPython is just an implementation of Python in the C programming language. If you want to incorporate C code, you can write extension modules documented here.
Check out this StackOverflow post as well.
Alternatively, write a C program, compile it, and then call it via the subprocess module documented here.

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 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.)

I want to check if online video is streaming or not. How to do it 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 3 years ago.
Improve this question
I want to write a script to check if I am able to stream an online video in a website. I just want a binary no (0 or 1) to see if the content is working or not and I want to do it via Python.
I have search in the internet but couldn't found an adequate answer.
The easier solution would be to calculate your internet consumption. If your internet consumption is higher than a certain limit, then you may assume that your streaming is working fine. If not, you may configure an alert.

How do you save what you've done in a module without keeping the computer on? [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 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.

Categories

Resources