How to handle a nested JSON?
I have a problem. I have a nested JSON file: json_data = ''' { "appVersion": "", "device": { "model": "" }, "bef": { "catalog": "" }, "data": [ { "timestamp": "", "label": "", "category": "" } ] } I would…
I have a problem. I have a nested JSON file: json_data = ''' { "appVersion": "", "device": { "model": "" }, "bef": { "catalog": "" }, "data": [ { "timestamp": "", "label": "", "category": "" } ] } I would…
Within a python script I have a function which looks as below: def NotifierFunc(Mail, Ticket_Num, Open_DtTime): cmd = "/home/path/MyPerlScript.pl --channel 'MyChannel' --userid 'itsme' --message 'Hello <at>"+Mail+"<at> : The ticket <a href='`echo 'http://snview/'"+Ticket_Num+">`echo "+Ticket_Num+"`</a> is not closed for more than 72…
I am trying to read a csv file into a dataframe to transform that into nested jsons. The deliminter in the csv file is ';'. After loading the data into a dataframe, following is what I get: name frequency frequency_start_date…
import json response_message = { 'id': 'chatcmpl-9Iof6Uwf74o9N6uKsyxIVMFFIDJYC', 'object': 'chat.completion', 'created': 1714271676, 'model': 'gpt-3.5-turbo-0125', 'choices': [ { 'index': 0, 'message': { 'role': 'assistant', 'content': 'sfsdfs {n "plant": {n "light blocker": 1,n "give water": 0,n "spray water": 0,n "conditions": {n "humidity (%)":…
Yesterday I switched to Ubuntu 24.04 LTS from windows and having an issue with my django project and tried every suggestion on the web but no luck. I'm getting below issue: django.core.exceptions.ImproperlyConfigured: 'django.db.backends.postgresql' isn't an available database backend or couldn't…
I need to write a file that can be appended (and not overwritten!) and then to read this file. This is the code I wrote: import io, json def WriteJSON(): Taskslist = [["1Name", "1c:/path/file.ext", "1Some other text", 10, ["a", "b",…
Why I have problem like that? How did you solve that? I am trying to connect to postgresql import psycopg2 conn = psycopg2.connect(database="test", user="postgres", password="260508", host="localhost", port="5432") print("Database Connected....") in result i have error. Traceback (most recent call last): File…
I have the following file structure: . ├── main.py └── modules ├── __init__.py ├── package1 │ ├── __init__.py │ ├── module1.py │ ├── module2.py │ └── __pycache__ │ ├── __init__.cpython-310.pyc │ └── module1.cpython-310.pyc ├── package2 │ ├── __init__.py │ ├──…
Environment Ubuntu 20.04 Python 3.8.10 Pip 20.0.2 Using pip venv to create a virtual environment in my project directory. These are the commands I am running. python3 -m pip venv .venv # Create the virtual environment source .venv/bin/activate (.venv) $…
24.04 ACTUALIZATION I managed to fix the problem related to my query: it was enough to change the name of the fields in the document from 'Company ID' to 'CompanyID' and from 'Workplace ID' to 'WorkplaceID'. But now a new…