Hello,
if I do this:
for row in sqlsth:
pkcolumns.append(row[0].strip())
etc
without a prior:
pkcolumns = [];
I get this error on first iteration:
UnboundLocalError: local variable 'pkcolums' referenced before assignment
I guess that's normal as it's the way python works..
[EMAIL PROTECTED] wrote:
> Yves> My question is: Is there no way to append to a non existing list?
>
> My question in return is: How is Python supposed to know that pkcolumns is
> supposed to be a list instead of some other type of object that happens to
> define an append() method?
I am fair
by the amount of answers that my question
rose, in so little time!
thanks all!
> There is a lot I don't like about python but if you have to use it, you
> have to cope with it.
>
> Yves Glodt wrote:
>> My question is: Is there no way to append to a non existing list?
>
Juho Schultz wrote:
> Yves Glodt wrote:
>> Hello,
>>
>> if I do this:
>>
>> for row in sqlsth:
>> pkcolumns.append(row[0].strip())
>> etc
>>
>>
>> without a prior:
>>
>> pkcolumns = [];
>>
>>
bruno at modulix wrote:
> Yves Glodt wrote:
>> Hello,
>>
>> if I do this:
>>
>> for row in sqlsth:
>> pkcolumns.append(row[0].strip())
>> etc
>>
>>
>> without a prior:
>>
>> pkcolumns = [];
>>
>>
[EMAIL PROTECTED] wrote:
> Thomas Bellman wrote:
>> The next time you go shopping at your local super-market, do
>> *not* get a shopping-cart (or shopping-basket, or any similar
>> container). As you pick up the things you want to buy, try
>> to put them into the non-existing cart. Perhaps you wi
Max M wrote:
> Yves Glodt wrote:
>> bruno at modulix wrote:
>>
>>> Yves Glodt wrote:
>>>
>>>> Hello,
>>>>
>>>> if I do this:
>>>>
>>>> for row in sqlsth:
>>>> pkcolumns.append(row[0]
bruno at modulix wrote:
> Yves Glodt wrote:
> (snip)
>> ok I see your point, and python's...
>>
>> (just FYI, and not to start a flamewar ;-):
>> In php, the [] means "append to an array object".
>
> yes, I know this.
>
>> If the array
[EMAIL PROTECTED] wrote:
> Yves Glodt wrote:
>> Which raises another question... :-)
>>
>> Is there a possibility to bring together apache and python in a way that
>> I can embed python into html?
> What do you mean ?
I need this (invalid example-html follows):
Hello list,
I need to iterate over a class and get all her variable names and
values, e.g. considering this example:
class testclass:
var1 = 'ab'
var2 = 'cd'
var3 = 'ef'
test = testclass()
Then I wanna do sonmething like this:
for name,value in test:
print n
Yves Glodt wrote:
> Hello list,
>
> I need to iterate over a class and get all her variable names and
> values, e.g. considering this example:
>
>
> class testclass:
> var1 = 'ab'
> var2 = 'cd'
> var3 = 'ef'
>
Yves Glodt wrote:
> Yves Glodt wrote:
>> Hello list,
>>
>> I need to iterate over a class and get all her variable names and
>> values, e.g. considering this example:
>>
>>
>> class testclass:
>> var1 = 'ab'
>> var2 = &
bruno at modulix wrote:
> Yves Glodt wrote:
>> Yves Glodt wrote:
>>
>>> Hello list,
>>>
>>> I need to iterate over a class and get all her variable names and
>>> values, e.g. considering this example:
>>>
>>>
>>&g
Hello,
another question rose for me today...
Is there a way to start an external process, in it's own context (not as
the exec-() functions do), and get it's pid...?
e.g.:
pid = wonderfulstartprocfunction('/usr/bin/wine bla.exe')
#... later
if (...):
os.kill(pid,9)
best regards,
Yve
Gerhard Häring wrote:
> Yves Glodt wrote:
>> Hello,
>>
>> another question rose for me today...
>>
>> Is there a way to start an external process, in it's own context (not as
>> the exec-() functions do), and get it's pid...? [...]
>
> Che
Hello,
how can I clone a class instance?
I have trouble finding that in the documentation...
thanks and best regards,
Yves
--
http://mail.python.org/mailman/listinfo/python-list
Andres de la Cuadra wrote:
> Hola, me llamo Andres de la cuadra, soy un usuario de python en chile y me
> gustaría saber como puedo cerrer un programa a través de python. Yo se que
> con la librería os puedo ejecutar programas, pero no e encontrado una
> librería para poder cerrarlos
Hola Andres,
(I asked about this several times in the twisted list but never got an
answer, maybe here I'll more happy...)
Hi,
I'm new to conch and I wonder if somebody could point me to an example
of how to create an ssh tunnel with conch to forward a connection (e.g.
database or vnc) through that tunnel (i
> [EMAIL PROTECTED] wrote:
>
>> So, I've written my first GUI app in python. I've turned it into a
>> binary .exe and .app that runs on Windows and Mac respectively, but on
>> my Linux box, where I wrote the thing, I still have to drop to the
>> command line and ./myscript.py. What can I do t
Hi,
I tried something like this but the umask part does not work clearly...:
newpid =
os.spawnle(os.P_NOWAIT,'/usr/bin/touch','/usr/bin/touch','xyz','umask 0113')
What would be the correct syntax for setting the umask for the created
process...?
Best regards,
Yves
--
http://mail.python.org/
Fredrik Lundh wrote:
> Yves Glodt wrote:
>
>> I tried something like this but the umask part does not work clearly...:
>>
>> newpid =
>> os.spawnle(os.P_NOWAIT,'/usr/bin/touch','/usr/bin/touch','xyz','umask 0113')
>&g
David Wahler wrote:
> Yves Glodt wrote:
>> It does, I did like this:
>>
>> os.umask(0113)
>> newpid =
>> os.spawnl(os.P_NOWAIT,'/usr/local/bin/wine','/usr/local/bin/wine',executable)
>>
>> But I wanted to use spawnle and it's
Hi,
I need to write a heartbeat solution to monitor some external clients,
and what is different as in the examples that I have seen so far is that
I want my central server to poll the clients, and not the clients
"pinging" the central server.
In detail I need a daemon on my central server whi
Hi list,
can anybody point me to a tutorial, howto or example code of
python-soappy...? google did not have really useful results about...
Best regards,
Yves
--
http://mail.python.org/mailman/listinfo/python-list
Hi there,
I have a daemon running 24/7, and I want that it executes a certain function
several times a day, as specified in an configfile (e.g.
actiontimes=10:00,12:00,19:00)
Do I have to fiddle with sched.scheduler and calc. time differences to
schedule my events, or is there another (nicer..
Hi,
I have a mainwindow in my pyqt application, and on click of a button I
want to start an assistant (wizard).
I have create the wizard with the Qt Designer, generated the python code
with pyuic, imported it "from assistant import *", and subclassed it as
usual.
To show it, the onclick metho
Hi,
I have a daemon which runs permanently, and I want it to do a special
operation at some specifiy times every day, consider this configfile
extract:
[general]
runat=10:00,12:00
What would be the easiest and most pythonic way to do this?
Something like this pseudocode:
while True:
Hi there,
I seem to be unable to find a way to appends more keys/values to the end
of a dictionary... how can I do that?
E.g:
mydict = {'a':'1'}
I need to append 'b':'2' to it to have:
mydict = {'a':'1','b':'2'}
How to do?
Best regards,
Yves
--
http://mail.python.org/mailman/listinfo/pyt
Rene Pijlman wrote:
> Yves Glodt:
>> I seem to be unable to find a way to appends more keys/values to the end
>> of a dictionary
>
> A dictionary has no order, and therefore no end.
that means I can neither have a dictionary with 2 identical keys but
different values..
Yves Glodt wrote:
> Hi there,
>
> I seem to be unable to find a way to appends more keys/values to the end
> of a dictionary... how can I do that?
>
> E.g:
>
> mydict = {'a':'1'}
>
> I need to append 'b':'2' to it to have
Paul Rubin wrote:
> Yves Glodt <[EMAIL PROTECTED]> writes:
>> that means I can neither have a dictionary with 2 identical keys but
>> different values...?
>
> No.
>
>> I would need e.g. this:
>> (a list of ports and protocols, to be treated later in a
Hello,
I need to compare 2 instances of objects to see whether they are equal
or not, but with the code down it does not work (it outputs "not equal")
#!/usr/bin/python
class Test:
var1 = ''
var2 = ''
test1 = Test()
test1.var1 = 'a'
test1.var2 = 'b'
test2 = Test()
test2.var1
Rene Pijlman wrote:
> Yves Glodt:
>> I need to compare 2 instances of objects to see whether they are equal
>> or not,
>
> This prints "equal":
thank you!
Have a nice day,
Yves
> class Test(object):
> def __init__(self):
> self.var1 =
bruno at modulix wrote:
> Yves Glodt wrote:
>> Hello,
>>
>>
>> I need to compare 2 instances of objects to see whether they are equal
>> or not, but with the code down it does not work (it outputs "not equal")
>>
>>
>> #!/usr/bin/python
Robin Haswell wrote:
> Hey there
>
> I'm doing some threading in python with Python 2.3 and 2.4 on Ubuntu and
> Debian machines, and I've noticed that if I open a lot of threads (say,
> 50), I get lots of python processes with individual PIDs, which consume a
> disproportionate amount of CPU. Does
Hi list,
Playing with the great pysvn I get this problem:
Traceback (most recent call last):
File "D:\avn\mail.py", line 80, in ?
mailbody += diff
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position
10710: ordinal not in range(128)
It seems the pysvn.client.diff fun
#x27;é' as well :-(
How am I supposed to print non-ascii characters the correct way?
best regards,
Yves
> Sebastjan
>
> On 3/3/06, Yves Glodt <[EMAIL PROTECTED]> wrote:
>> Hi list,
>>
>>
>> Playing with the great pysvn I get this problem:
>>
37 matches
Mail list logo