>
> XLS != CSV
> XLS is M$'s format for spreadsheets whereas CSV is essentially a text
> document with comma-delimited fields. If you open it up in OpenOffice
> and go File -> Save As then in the 'Save as type:' drop-down list
> select 'Text CSV (.csv)' and ofc change your code to point to the new
Hi,
I am trying to read a csv file using csv.reader. The file is created
using Open Office and saved in Excel format.
import csv
reader = csv.reader(open('test.xls'))
for row in reader:
print row
It however throws the exception _csv.Error:
: line contains NULL byte
Any idea whats going wro
Hi,
I want to use variables passed to a function in an inner defined
function. Something like-
def fun1(method=None):
def fun2():
if not method: method = 'GET'
print '%s: this is fun2' % method
return
fun2()
fun1()
However I get this error-
UnboundLocalError: loc
> To help debug this, you may want to try the following.
>
> 1) Copy smptlib.py into your local directory. On my
> box, you can find it here, or import sys; print
> sys.path to help find it on your box:
>
>/usr/local/lib/python2.3
>
> 2) Go the login() method, add some print statements
> there
>
> > I am trying to send a mail using smtplib. My server requires me to
> > authenticate, for this I'm using SMTP.login function. However it
> > fails-
>
> server = smtplib.SMTP(host='mail.domain', port=25)
> server.login('username', 'password')
> > Traceback (most recent call last):
> >
On May 29, 8:52 pm, glomde <[EMAIL PROTECTED]> wrote:
> Hi I wonder if you can set what subclass a class should
> have at instance creation.
>
> The problem is that I have something like:
>
> class CoreLang():
> def AssignVar(self, var, value):
> pass
>
> class Lang1(CoreLang):
>
On May 29, 8:52 pm, glomde <[EMAIL PROTECTED]> wrote:
> Hi I wonder if you can set what subclass a class should
> have at instance creation.
>
> The problem is that I have something like:
>
> class CoreLang():
> def AssignVar(self, var, value):
> pass
>
> class Lang1(CoreLang):
>
Hi,
I am trying to send a mail using smtplib. My server requires me to
authenticate, for this I'm using SMTP.login function. However it
fails-
>>> server = smtplib.SMTP(host='mail.domain', port=25)
>>> server.login('username', 'password')
Traceback (most recent call last):
File "", line 1, in ?
> > I am trying to execute some tasks periodically, those familiar with
> > unix can think of it as equivalent to cron jobs.
>
> Can you not use cron? If not, why not? Is there an equivalent service
> you can use?
I can, but the work I want to do is written in Python. This is not an
issue but I wo
Hi,
I am trying to execute some tasks periodically, those familiar with
unix can think of it as equivalent to cron jobs. I have tried looking
around, but couldn't find a way. Would appreciate any pointers or
clues..
Thanks,
-Ram
--
http://mail.python.org/mailman/listinfo/python-list
> > I want a way to get the contents in the order of their declaration,
> > i.e. [B, A, D]. Does anyone know a way to get it?
>
> My suggestion would be to actually parse the text of the module. "Brute
> force" is what it's called ;). But doing so with, say, pyparsing
> shouldn't be *very* difficul
Hi,
I want to get a module's contents (classes, functions and variables)
in the order in which they are declared. Using dir(module) therefore
doesn't work for me as it returns a list in alphabetical order. As an
example-
# mymodule.py
class B: pass
class A: pass
class D: pass
# test.py
import my
> > Hi,
>
> > I am facing an issue in daemonizing a thread using setDaemon method.
> > Here is my code-
>
> > import time
> > from threading import Thread
>
> > class MThread(Thread):
> > def run(self):
> > f = open('/tmp/t.log', 'w')
> > for i in range(10):
> > f.wr
On Apr 20, 2:03 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Red hat 4 comes with python 2.3, and I am trying to upgrade to python
> 2.4. So I download and compile the source of python2.4.
>
> But as I run it I get the following error, can you please tell me how
> to fix it?
>
> # /
Hi,
I am facing an issue in daemonizing a thread using setDaemon method.
Here is my code-
import time
from threading import Thread
class MThread(Thread):
def run(self):
f = open('/tmp/t.log', 'w')
for i in range(10):
f.write('Iteration %d\n' % i)
time.
Sam wrote:
> On 21 Jan 2007 12:49:17 -0800, Ramashish Baranwal
> <[EMAIL PROTECTED]> wrote:
> > class Base:
> > staticvar = 'Base'
> >
> > @staticmethod
> > def printname():
> > # this doesn't work
> >
Hi,
I want to access a static variable in a staticmethod. The variable can
be redefined by derived classes and that should be reflected in base's
staticmethod. Consider this trivial example-
class Base:
staticvar = 'Base'
@staticmethod
def printname():
# this doesn't work
Carsten Haese wrote:
> On Wed, 2006-12-27 at 10:37 -0800, Ramashish Baranwal wrote:
> >[...]
> > def fun2(**kwargs):
> > # get id param
> > id = kwargs.pop('id', '')
> > # pass on remaining to fun1
> > fun1(kwargs
Hi,
I need to process few out of a variable number of named arguments in a
function and pass the remaining to another function that also takes
variable number of named arguments. Consider this simple example,
def fun1(**kwargs):
print kwargs.keys()
def fun2(**kwargs):
# get id param
19 matches
Mail list logo