| | |
memory error
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Jun 2009
Posts: 5
Reputation:
Solved Threads: 0
this script give me a memory error in parse()...what is a memory error and how can i fix it?
Python Syntax (Toggle Plain Text)
import cgi class COM: def __init__(self): f=open('C:/site/commentlog.txt', 'r') self.lines=f.readlines() f.close() def writecom(self, post): f=open('C:/site/commentlog.txt', 'a') f.write(post) f.close() def getcom(self): try: form=cgi.FieldStorage() q=form.getvalue("posts") if q: writecom(q) return q except: return 0 def parse(self, post): b=[] while post>65: c=post[:64] post=post[64:] b.append(c) b.append(post) return b def postline(self, post): print "<textarea readonly name=\"posts\" rows=\"10\" cols=\"65\">" print post print "</textarea>" def postlines(self, posts): print "<textarea readonly name=\"posts\" rows=\"10\" cols=\"65\">" for line in posts: print line print "</textarea>" def main(self): self.getcom() self.postit() if self.lines: for a in self.lines: if a>65: b=self.parse(a) self.postlines(b) else: self.postline(a) else: pass print "</body>" print "</html>" def postit(self): print "Content-type: text/html\r\n\r\n" print "<style type=\"text/css\">" print "h2 {" print "color : green;" print "}" print "textarea {" print " color : black;" print " background-color : #00f000;" print "}" print "body {" print " background-color : black; } " print "</style>" print "<html>" print "<head>" print "<img src=\" \" width=\"240\" height=\"230\" align=\"right\">" print "</head>" print "<body>" print "<h2>This is my second page anyone can post comments anonymously<br>" print "<form action=\"comments.py.py\" method=\"POST\">" print "<textarea name=\"posts\" rows=\"10\" cols=\"65\">" print "</textarea>" print "<input type=\"submit\" value=\"post\">" print "</form>" print "<hr>" c=COM() c.main()
![]() |
Similar Threads
- Help Please!!! Cherrypy Memory Error (Python)
- Out of memory error (Visual Basic 4 / 5 / 6)
- Containers Perfomance testing - memory error (C++)
- Memory Error (Python)
- Windows 2000 "memory has changed" error at start up (Windows NT / 2000 / XP)
- VB6 Runtime error 7 Out of memory (Visual Basic 4 / 5 / 6)
- memory error in vb6 (Visual Basic 4 / 5 / 6)
- Cant install LINUX successfully---memory error!! (*nix Software)
- Running Low on Virtual Memory, Runtime C++ Error (Windows NT / 2000 / XP)
- Windows XP Memory Error (Windows NT / 2000 / XP)
Other Threads in the Python Forum
- Previous Thread: wxPython download links broken?
- Next Thread: binary strings
Views: 426 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for Python
accessdenied address ansi backend beginner changecolor class code conversion coordinates copy curves customdialog dan08 dictionary directory dynamic edit examples excel feet file float font format ftp function generator getvalue gui halp homework i/o images import info input ip java line linux list lists loop mouse mysql newb number numbers output panel parsing path port prime print program programming projects py2exe pygame pyqt python queue random rational recursion recursive schedule screensaverloopinactive scrolledtext searchingfile server ssh stamp statictext string strings sudokusolver table terminal text thread threading time tkinter tlapse tuple tutorial type ubuntu unicode url urllib urllib2 variable whileloop windows write wxpython






