In Python 2 it was easy to create a temporary file and access it. However with in Python 3 it seems that is no longer the case. I'm confused on how I can get to the file I create with tempfile.NamedTemporaryFile() so I can call a command on it.
For example:
temp = tempfile.NamedTemporaryFile()
temp.write(someData)
subprocess.call(['cat', temp.name]) # Doesn't print anything out as if file was empty (would work in python 2)
subprocess.call(['cat', "%s%s" % (tempfile.gettempdir(), temp.name])) # Doesn't print anything out as if file was empty
temp.close()