diff --git a/mwclient/compatibility.py b/mwclient/compatibility.py
index 0ac4d6001a09ec7567f35c10c02d3e9c6e3bdc8f..cbcb462b7f324296504523745d7144feb6d22a15 100644
--- a/mwclient/compatibility.py
+++ b/mwclient/compatibility.py
@@ -39,7 +39,8 @@ def protectright(version):
 		return 'editprotected'
 	else:
 		return 'protect'
-	
+
+from cStringIO import StringIO
 def old_upload(self, file, filename, description, license = '', ignore = False, file_size = None): 
 	image = self.Images[filename]
 	if not image.can('upload'):