Questions tagged [cstringio]

A simple fast partial StringIO replacement in Python 2

This module provides a simple useful replacement for the StringIO module that is written in C. It does not provide the full generality of StringIO, but it provides enough for most applications and is especially useful in conjunction with the pickle module.

https://docs.python.org/2/library/stringio.html#module-cStringIO

Note that cStringIO was removed from Python 3 (ref: here).

33 questions
0
votes
1 answer

Reading image from URL with misc.imread returning a flattened array instead of a colour image

I'm trying to read an image from a URL (provided by Google's Static Maps API). The image displays okay in browser. https://maps.googleapis.com/maps/api/staticmap?maptype=satellite¢er=37.530101,38.600062&zoom=14&size=256x278&key=... But when I…
Bill
  • 10,323
  • 10
  • 62
  • 85
0
votes
1 answer

Write file from cStringIO

I am trying to write a cStringIO buffer to disk. The buffer may represent a pdf, image or html file. The approach I took seems a bit wonky, so I am open to alternative approaches as a solution as well. def copyfile(self, destfilepath): if…
Baywatch
  • 423
  • 5
  • 17
0
votes
2 answers

Convert cStringIO variable into file

I have an Excel file created inside a cStringIO variable. I need to open it and read it. But to open an excel file with the xlrd function xlrd.open_workbook(excel_file_name), I need to call it by its file name. But in this case there is no file name…
Xar
  • 7,572
  • 19
  • 56
  • 80
1 2
3