Skip to content

Tag: python

How do I create a file I can stream data to in Python?

I’d like to create a file similar to those under /dev that I can stream lines of text to without actually writing anything to the disk. I want to still be able to read this stream like a regular text file. Answer Call the os.mkfifo function, then open the file it creates as normal. Anything that gets wr…

A function that can be stored on memory

suppose we have two python programs. calculate.py and show_results.py. When calculate.py program runs on terminal, it returns a variable (let’s say a list called result) to the computer memory. And when we run show_results.py on terminal, it prints the result from the programs before. Suppose the result…

Create files in subdirectories with the same name [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 4 years ago. Improve this question Reading a list with A and B data in 2 columns, iterating row by row, I was createding a seri…

Could not run Ec2-server on port 80

I could run the server on port 8000 but when i try to use 80 with python manage.py runserver myip:80 I get: You don’t have permission to access that port. If I use sudo python manage.py runserver myip:80 I get: If I write python in the console I get version 3.5.5 and my env is activated. EDIT: Using sud…

Why is SIGALARM killing the Python program on Linux?

This programs prints Alive four times on stdout and then dies. While I am not handling the SIGALARM signal explicitly inside the program, I just expect the alarm to get ignored. However, on Linux, the script dies after the alarm is triggered. I have not been able to find any documentation for Linux which stat…