<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.5803" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial color=#0000ff><SPAN 
class=215173511-01072009>Hi,</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff><SPAN 
class=215173511-01072009></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff><SPAN class=215173511-01072009>I think I'm 
up against a limitation in <FONT face="Courier New">cStringIO.StringIO()</FONT>, 
but could not find any clues on the web, especially not in <A 
href="http://docs.python.org/library/stringio.html">http://docs.python.org/library/stringio.html</A>.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff><SPAN 
class=215173511-01072009></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff><SPAN class=215173511-01072009>What I have 
is the following function:</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff><SPAN 
class=215173511-01072009></SPAN></FONT> </DIV>
<DIV><FONT face="Courier New" color=#0000ff><SPAN 
class=215173511-01072009>    def 
concatenate_files(self,filename_array):<BR>        
import types</SPAN></FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New" color=#0000ff><SPAN 
class=215173511-01072009>        f = 
cStringIO.StringIO()<BR>        for filename 
in 
filename_array:<BR>            
log_stream = 
LogStream(filename)<BR>            
if not isinstance(log_stream, 
types.NoneType):<BR>                
try:<BR>                    
string_ = 
log_stream.input_file.read()<BR>                
except AttributeError, 
e:<BR>                        
sys.stderr.write("AttributeError: 
"+str(e)+"\n")<BR>                        
sys.stderr.write("log_stream: 
"+str(log_stream)+"\n")<BR>            
else:<BR>                
return(None)</SPAN></FONT></DIV>
<DIV><FONT face="Courier New"></FONT> </DIV>
<DIV><FONT face="Courier New" color=#0000ff><SPAN 
class=215173511-01072009>            
f.write(string_)<BR>        return 
(f)</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial color=#0000ff><SPAN class=215173511-01072009>And, when the 
list of files - in filename_array - is pointing to long/large enough files, 
I get the exception:</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff><SPAN 
class=215173511-01072009></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff><SPAN class=215173511-01072009><FONT 
face="Courier New">Traceback (most recent call last):<BR>  File 
"svm_ts_tool_in_progress.py", line 244, in OnSelectCell<BR>    
self.InspectorViewController(row,col)<BR>  File 
"svm_ts_tool_in_progress.py", line 1216, in 
InspectorViewController<BR>    
self.InspectorePaneGetRecords(self.req_table, rec)<BR>  File 
"svm_ts_tool_in_progress.py", line 1315, in 
InspectorePaneGetRecords<BR>    log_stream = 
ConcatenatedLogStream(self.events_dict[req_table]["db_dict"].keys())<BR>  
File "c:\Documents and 
Settings\rbarak\rbarak_devel\dpm16\ConcatenatedLogStream.py", line 31, in 
__init__<BR>    self.input_file = 
self.concatenate_files(filename_array)<BR>  File "c:\Documents and 
Settings\rbarak\rbarak_devel\dpm16\ConcatenatedLogStream.py", line 47, in 
concatenate_files<BR>    string_ = 
log_stream.input_file.read()<BR>MemoryError</FONT></SPAN></FONT></DIV>
<OL>
  <LI><FONT face=Arial color=#0000ff><SPAN class=215173511-01072009>Anyone knows 
  whet's the limitation on cStringIO.StringIO() objects ?</SPAN></FONT></LI>
  <LI><FONT face=Arial color=#0000ff><SPAN class=215173511-01072009>Could you 
  suggest a better way to create a string that contains the concatenation of 
  several big files ?</SPAN></FONT></LI></OL>
<DIV><FONT face=Arial color=#0000ff><SPAN 
class=215173511-01072009>Thanks,<BR>Ron.<BR></DIV></SPAN></FONT></BODY></HTML>