Relative Content

Tag Archive for pythonjson

read_file.read() not returning anything while trying to update json file

This is what is supposed to happen: Create a new json file if it does not exist, and add an element with the keys “name” and “path”. I’m getting the following error : json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0). I’ve noticed that read_file doesn’t return anything, and I don’t know what’s wrong with it. On the print screen, I was expecting to see the content of maps.json shown in the console before “hello”.

search JSON by value

I’m trying to use Python to search a json by its value, not its variable.
Basically: I want ot search .a json file for the string/second vaue and return the first value
I’m making a stenography game, and I’m trying to do this so I can search for the strokes by the word.

I’m a beginner programmer and need help completing the code

My goal is to comment on the last post of my chosen person on Facebook as fast as possible, for this chat GBT wrote me a code but it doesn’t work.
I would like to use Python to comment a specially selected text on a specially selected user’s post when the user makes a new post.
The code should start working if the time of the last post made by the user coincided with the current time
I am looking for the fastest way to solve this problem
Thank you in advance for anyone who could help me with this❤️

Serialize and Deserialize JSON in Python

**I am having problems with serializing and deserializing JSON in Python. This is the worker class in a multithreaded python file:** class Worker(QObject): finished = pyqtSignal() result = pyqtSignal(str, str) error = pyqtSignal(str) def __init__(self, saved_text: str = None): super().__init__() self.saved_text = saved_text if saved_text else “Default text if none provided.” def run(self): try: logging.debug(“Worker […]