Commits

Mauro Scomparin committed 38233fc

Now it works on windows.. (added binary opening on the image file.)

Comments (0)

Files changed (1)

tumbrlPicUploader.py

 	print program_author
 	
 def saveCredentialsToFile(credentials,fileCred):
-	fileToWrite = open(fileCred,'w')
+	fileToWrite = open(fileCred,'wb')
 	fileToWrite.write(json.dumps(credentials))
 	fileToWrite.close()
 
 	saveCredentialsToFile(credentials,fileCred)
 	
 def getCredentialsFromFile(fileCred):
-	fileToRead = open(fileCred,'r')
+	fileToRead = open(fileCred,'rb')
 	crendentials = json.loads(fileToRead.read())
 	fileToRead.close()
 	return crendentials
 	params['tags'] = results.tags
 	i = 1
 	for img in glob.glob( os.path.join(results.dirname, file_mask) ):
-		params['data[%d]' % (i-1) ] = file(img).read()
+                #windows opens file like it wants.. added the read binary and looks like it likes it..
+		params['data[%d]' % (i-1) ] = file(img,'rb').read()
 		i+=1
 		print(img)
 	print api.createPost(creds['blogname'],params);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.