You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, it's really a great library and kudos to the development. I've integrated this library in a project of mine where multiple threads are printing on the terminal at the same time. Consider these two functions:
Now, if you run these functions simulataneously using threads (a couple times to make sure), you will see sometimes each bar is overlapped on the other bar. Which means that the functions being called are not thread safe. And calling multiple lines at the same time will mess the output.
The text was updated successfully, but these errors were encountered:
Well, blessed is thread safe, I have successfully used it in a threaded terminal server project serving each client ip it’s own output (telnet 1984.ws a public server), It hasn’t any thing to do with threads, just that the file descriptor (sys.stdout) is shared. If you removed the threads and used asyncio, for example, it would have the same problem.
in blessed docs we say, “calls to location() may not be nested”, calling it twice on the same file descriptor is an example of “nesting”, the use of threads just makes it appear logically separate, I’m sorry this wasn’t clear, maybe we can add some documentation
These context managers have the side effect of printing hidden terminal sequences to the screen that are interpreted by the terminal, it can only handle one location sequence
Well, i guess that explains the messed up terminal. I found a quick solution though by putting all the location related statements under the same class and used a class variable to determine if another location context wrapper is being used somewhere. If it is, then while True: pass. Otherwise, go on.
I think adding that to the documentation would be very helpful. I don't know if i should close this right now or not though i found my answer. On to you from here.
Also, one more question, i had. It's a different one. Anyways, i am asking here. When i compile my script pyinstaller --noconsole option with blessed being used in the script, i get this error:
Failed to execute script
Without creating the terminal instance, i.e. term = Terminal(), it works all fine.
First of all, it's really a great library and kudos to the development. I've integrated this library in a project of mine where multiple threads are printing on the terminal at the same time. Consider these two functions:
Now, if you run these functions simulataneously using threads (a couple times to make sure), you will see sometimes each bar is overlapped on the other bar. Which means that the functions being called are not thread safe. And calling multiple lines at the same time will mess the output.
The text was updated successfully, but these errors were encountered: