Skip to main content

Posts

NameError: name 'run_gui_update_in_thread' is not defined

Can someone tell me whats wrong with my code, whenever i delete something, a new error pops up the code is a dumpster fire to be honest. tkinter is having errors with simple task, most of the pip installs aren't required, and the code doesn't connect to the plc. The task the code is supposed to connect to the plc and give the status of the tag into microsoft SQL server management Studio. Would very much appreciate any ideas or help. Thanks. import threading import tkinter as tk from tkinter import ttk import datetime import time import logging import pyodbc from pylogix import PLC import matplotlib.pyplot as plt from matplotlib.dates import DateFormatter import tkinter as tk import threading # ... other necessary imports ... # Define global variables root = None tree = None plc_thread = None running = False # Flag to control the PLC reading thread def read_and_write_plc_data(): """Read data from PLC and write to database.""" global runn

No python virtualenv is available error when running nodeenv -p

I have installed nodeenv for node.js and virtualenv for python and would like to link both by using the command nodeenv -p in virtualenv. I get this error No python virtualenv is available. any ideas what my be missing. the virtualenv has it all and i having running django in it. I tried to install and reinstall but it did not work. I am using MAC OS SONOMA source https://stackoverflow.com/questions/77813024/no-python-virtualenv-is-available-error-when-running-nodeenv-p

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory - removing sourcemaps still fails

Our team has a CRA application and we are using the following script to build locally and in bitbucket pipelines node --max-old-space-size=8192 scripts/build.js We are all getting this error now with our source code FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 1: 0x111336665 node::Abort() (.cold.1) [/Users/apple/.nvm/versions/node/v16.20.0/bin/node] 2: 0x11002f1c9 node::Abort() [/Users/apple/.nvm/versions/node/v16.20.0/bin/node] 3: 0x11002f3ae node::OOMErrorHandler(char const*, bool) [/Users/apple/.nvm/versions/node/v16.20.0/bin/node] 4: 0x1101a41d0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/Users/apple/.nvm/versions/node/v16.20.0/bin/node] 5: 0x1101a4193 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/Users/apple/.nvm/versions/node/v16.20.0/bin/node] 6: 0x1103458e5 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/Users/apple/.nvm/versions/

How do I show a error message if no product is found?

I have a search.js file that reads a json file and retrieves information about some products, and then displays it in the page. I am trying to show a error message if no product is found when searching, and this part is almost working. If a search for a non-existent product, the error message appears correctly: enter image description here The problem is, if I search for a product that the name isn't similar to another one, the error still appears.. for example: enter image description here enter image description here Json file structure is like this: [ { "nome": "Carro", "apelido": "ft.car", "desc": "descrição", "img": "/img/carro.png", "link": "/pag/carro.html" }, { "nome": "Carreta Bi-Trem", "apelido": "ft.big.truck", "desc": "descrição",

Sorting data / refresh page with new query - Django5 ListView

I am trying to perform a query on the same page using Django. After selecting data from the dropdown and clicking the button, the information should be filtered accordingly. However, I couldn't find a solution to get the data after selecting from my dropdown and will refresh the page using Django. Is this possible? Here's my views.py class DocListView(ListView): model = Document template_name = 'docs/documents.html' paginate_by = 5 context_object_name = 'doc_list' def get_queryset(self): return Document.objects.all() source https://stackoverflow.com/questions/77806097/sorting-data-refresh-page-with-new-query-django5-listview

Can't delete "^M\n" from a .txt file

I'm generating a .txt from a SQL database. But for some reason, some of my data is not just plain text. My .txt file looks like this: PC001|1FSTFJ|BE21|Rooftop PC002|JVQ2F9|BE22|Basement PC003|JY1035W1|BE22|Basement^M\n I tried some Python and Bash scripts with the help of gpt, but it doesn't work: #!/bin/bash file_path="file.txt" sed -i 's/\^M\n//g' "$file_path" This script literally does nothing, and I don't understand why. And the Python script: def clean_file(file_path): try: with open(file_path, 'r') as file: lines = file.readlines() cleaned_lines = [] for line in lines: # Diviser la ligne en champs, en supposant qu'ils sont séparés par '|' fields = line.strip().split('|') # Nettoyer chaque champ individuellement cleaned_fields = [field.rstrip('M').strip() for field in fields] # Reco

To read Ethernet frames on Canoe using Python

i am a beginner in automation to understand how to read ethernet frames from canoe trace using python. Please help me to understand and how to read either from command prompt or should i have to write driver level code to read ethernet frames? source https://stackoverflow.com/questions/77795772/to-read-ethernet-frames-on-canoe-using-python