Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 16300

AttributeError: 'NoneType' object has no attribute 'flush' with pyinstaller [duplicate]

$
0
0

I've created a python method to print data to screen and in a file:

def printf(handler, string):    print(string)    sys.stdout.flush()    if handler is not None:        handler.write(str(string))        handler.write("\n")

The code works just fine when I'm running it in the virtual env. However, when I use the exe created using pyinstaller, I run into the error :

 AttributeError: 'NoneType' object has no attribute 'flush'

The call to the flush method seems to cause the crash but I don't know how to solve this.I did not find a solution after looking on the net.

How can the builtin sys.stdout be None?


Viewing all articles
Browse latest Browse all 16300

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>