Reputation: 1
So I'm pretty new to Python, and I'm trying to write a script that will convert from raw to png. This is what I have so far:
rawData = open('filename', 'r').read()
imgSize = (515, 515)
img = Image.fromstring(1, imgSize, rawData)
im.save('Test.png')
I keep getting an error message that says "[Errno 2] No such file or directory"
There's gotta be something terribly wrong with my code that I don't see. Anybody?
Upvotes: 0
Views: 577
Reputation: 118001
You likely have a variable named filename
, so you should do
rawData = open(filename, 'r').read()
Note that it does not have quotes. Otherwise you are saying the string literal "filename"
is your path, which I strongly doubt.
Upvotes: 1