I have a QToolBar full of QPushButtons. As the window is resized to reduce its width, the width of toolbar is reduced. If the width is reduced beyond a certain point, the buttons starts disappearing. I think the situations is understood. There are certain situations when someone has to reduce the window width so setting minimum width is out of
Tag: python-3.x
Why do my files have a last modified timestamp of January 1, 1980?
I’m working in Python with a number of libraries at play. I have a group of files on a Linux server that have the last modified timestamp of midnight on January 1, 1980 (unix timestamp 315532800.0). The last changed timestamp however is recent. What could have caused this? In particular, Jan 1 1980 is a suspiciously round number, but not
DNS Resolver does not contain answer
I’m trying to automate some of the tasks with python. I have to chcek if some domains are still in ours DNS servers. So searching through stack i found script with dns.resolver and tryied to suit it to my needs. So, the script looks like this: My domainfile.txt looks like this: And error message i recived is: Traceback (most recent
Python datetime module problems
I’m using the datetime module in python3.7. When I run it from terminal it throws an error: Answer As you named your file datetime.py it may lead to confusion when calling it from outside. you should rename it to something else like my_datetime.py you also need to import datetime before using it
Is there a way to assign different jobs (processes) to specific core in linux using python?
I have python functions that should run parallelly in a linux environment utilizing multi cores. Is there a way to specify which core should be used for each process explicitly? Currently, I am using python multiprocessing module to run these python functions as parallel processes in 4 cores. Answer Possibly with the combination of os.sched_setaffinity and os.sched_getaffinity. The docstring says:
How to rewrite this multiprocessing code for Windows?
I’m currently using multiprocessing so I can obtain user input while running other code. This version of code runs on ubuntu 19.04 for me, but for my friend it doesn’t work on windows. How can I make this code work on windows? Also the user input lags behind by one input. If the user presses a button it only prints
What would be an optimal way to perform DNS query from bash in python3?
I have this simple bash script that I’m thinking about incorporating into my python project as I couldn’t figure out a graceful way to do this in python3 compared to this single bash oneliner. Is there a better way to do this in python3 or a library that would assist with storing all legitimate unique hostnames in a list or
How to make a one-window program with GTK, python and glade?
I’d like to write a program that has one main window and if I click on a button it changes the content of the window (or something similar) and the user can go back after that to the “home page”. I’m using python3, gtk3 and glade on Ubuntu 19.04. Here’s the example.glade XML file And here’s the Python3 file I’d
How to solve the handshake failure using ssl in python?
I try connect to specific https server: But the python says: I try using TLS1: But says: Have a upgraded ssl in python and operative system: From netcat can connect without problems: What is the problem and how to solve this? Answer From the documentation: Since Python 3.2 and 2.7.9, it is recommended to use the SSLContext.wrap_socket() of an SSLContext
Is there a way to delete zip archive comments in python?
I have multiple zip archives all with a similar comment. Is there a way to delete the comment from the archives with python and use it over multiple archives with similar comment? What I have tried with single archive This is not working. Comment is not getting deleted in the archive, plus I want this to work on multiple archives