Commits

Alon Hammerman committed 97d3c6f

Catching the io.UnsupportedOperation for fileno

Comments (0)

Files changed (1)

         'multipart_encode']
 
 try:
+    from io import UnsupportedOperation
+except ImportError:
+    UnsupportedOperation = None
+
+try:
     import uuid
     def gen_boundary():
         """Returns a random string to use as the boundary for a message"""
             # Try and determine the file size
             try:
                 self.filesize = os.fstat(fileobj.fileno()).st_size
-            except (OSError, AttributeError):
+            except (OSError, AttributeError, UnsupportedOperation):
                 try:
                     fileobj.seek(0, 2)
                     self.filesize = fileobj.tell()