Urrlib2 IncompleteRead error

2010-07-27 Thread dirknbr
I am running urllib2.request and get this response when I do the read. Any ideas what causes this? return response.read() File "C:\Python26\lib\socket.py", line 329, in read data = self._sock.recv(rbufsize) File "C:\Python26\lib\httplib.py", line 518, in read return self._read_chunked(

Re: Unicode error

2010-07-23 Thread dirknbr
To give a bit of context. I am using twython which is a wrapper for the JSON API search=twitter.searchTwitter(s,rpp=100,page=str(it),result_type='recent',lang='en') for u in search[u'results']: ids.append(u[u'id']) texts.append(u[u'text']) This is where texts com

Unicode error

2010-07-23 Thread dirknbr
I am having some problems with unicode from json. This is the error I get UnicodeEncodeError: 'ascii' codec can't encode character u'\x93' in position 61: ordinal not in range(128) I have kind of developped this but obviously it's not nice, any better ideas? try: text=texts[

optparse TypeError

2010-06-28 Thread dirknbr
I get an int object is not callable TypeError when I execute this. But I don't understand why. parser = optparse.OptionParser("usage: %lines [options] arg1") parser.add_option("-l", "--lines", dest="lines", default=10, type="int", help="number of

Re: compile as exe with arguments

2010-06-28 Thread dirknbr
On Jun 28, 11:40 am, dirknbr wrote: > On Jun 28, 11:26 am, "Martin P. Hellwig" > wrote: > > > On 06/28/10 11:18, dirknbr wrote: > > > > I want to compile as an exe using py2exe but the function should take > > > arguments. How would I do this? Curre

Re: compile as exe with arguments

2010-06-28 Thread dirknbr
On Jun 28, 11:26 am, "Martin P. Hellwig" wrote: > On 06/28/10 11:18, dirknbr wrote: > > > I want to compile as an exe using py2exe but the function should take > > arguments. How would I do this? Currently my exe runs (no errors) but > > nothing happens. >

compile as exe with arguments

2010-06-28 Thread dirknbr
I want to compile as an exe using py2exe but the function should take arguments. How would I do this? Currently my exe runs (no errors) but nothing happens. -- http://mail.python.org/mailman/listinfo/python-list

deduping

2010-06-21 Thread dirknbr
Hi I have 2 files (done and outf), and I want to chose unique elements from the 2nd column in outf which are not in done. This code works but is not efficient, can you think of a quicker way? The a=1 is just a redundant task obviously, I put it this way around because I think 'in' is quicker than

Re: Email in 2.6.4

2010-05-24 Thread dirknbr
I have now easy_installled email and I still get errors. It doesn't error on 'import email' but does on call to MimeText. import email msg = MIMEText('test') NameError: name 'MIMEText' is not defined What should I do? -- http://mail.python.org/mailman/listinfo/python-list

Email in 2.6.4

2010-05-24 Thread dirknbr
I am trying to run from email.mime.text import MIMEText but I get an ImportError: No module named mime.text Since email was pre-installed how do I fix this? Dirk -- http://mail.python.org/mailman/listinfo/python-list

Python 3.1 simplejson install

2010-01-29 Thread dirknbr
I am trying to install simplejson on Python 3.1 on Windows. When I do 'python setup.py install' I get 'except DisutilsPlatformError, x: SyntaxError' with a dash under the comma. Any ideas? Dirk -- http://mail.python.org/mailman/listinfo/python-list