So, in my python Flask application, there’s a background process which reads data once a day from an S3 bucket. This data is fetched upon application startup by the background process. There’s a service that takes this data and processes it per request. I’m trying to understand the best way for this data to be ..
# main.py var = 99 def importModule(): import main print(main.var, end=’>inside ‘) main.var = 0 importModule() print(var, end=’>outside ‘) # out:99>inside 0>outside 0>inside 99>outside Output is ’99>inside 0>outside 0>inside 99>outside’ How did this happen?? Source: Python..
I am trying to solve the following problem. I have a package where I want to know the user’s imported module and its aliases. For example, if I have a file package.py and it has a function get_imported_modules(), In the setting given bellow, where the following is either a python file or inside a Jupiter ..
I am trying to write a subscriber that will take images from a camera in a gazebo simulation and save them. I am able to take pictures and save them, however I am trying to increment the image name each time, yet I am finding it difficult to do so. I tried to create a ..
I’m a beginner and I know there is something I missed but I don’t know exactly what, So I have a PySide6 app, and I created a function to generate a calendar in a QTableWidget using calendar module in python all worked fine but the problem came when I tried to add a navigation buttons ..
How could i edit my code so i can run functions at the same time using multiprocessing or something similar and edit the value of a global variable in the same way like i would with a regular function? This is an examples showing the code that i have been using: import multiprocessing from multiprocessing ..
I was playing with the tkinter and multiprocessing package and global variable. I am not able to set the variable while I press the button. When it is released, its value doesn’t remain and is restored to its previous state. Your help is really appreciated. Here is the MVP. from multiprocessing import Process from tkinter ..
I am a relative newcomer to python, but I thought I understood it’s rules around the use of globals fairly well. I dislike globals and generally try to avoid them, but occasionally they can be useful. Recently I needed a short script to process an existing text file, only to get an obtuse error that ..
This code is meant to get a set of data and calculate if the entererd data is within a certain criteria and if the user wants to they can enter the set of data how many times they want but when ever i try to enter a second set of data when it loops the ..
I am creating a GUI in tkinter having a listbox and a Text item in a child window which appears after a button click. Listbox is displaying values of a dict which are basically names of files/directories in disk image. I want to change the text of Text widget on <ListboxSelect> event and display type ..