manuhack wrote:
> How about write mode? Changing r to w doesn't work...
>
> [EMAIL PROTECTED] wrote:
> > manuhack wrote:
> > > I copied the lines
> > >
> > > f=open('/tmp/workfile', 'w')
> > > print f
> > > f.close()
> > >
> > > from Python 2.4 Documentation 7.2. But it said IOerror No such file
James Thiele wrote:
> What exceptions (if any) can the python builtin compile() function
> throw besides SyntaxError?
- TypeError, if the parameters are wrong/too many/too few
- Any errors that a codec may raise, if there is an encoding
declaration, plus (pre 2.5) MemoryError if the encoding is
In <[EMAIL PROTECTED]>, miker2 wrote:
> import MySQLdb
> base = MySQLdb.connect(host="localhost", user="blah", passwd="blah",
> db="test_py")
> cursor = base.cursor()
> cursor.execute("INSERT INTO table (field) VALUES (int)")
>
> this does not work but the interesting thing is, there is an
> AUTO
thebjorn wrote:
> Bruno Desthuilliers wrote:
> [...]
>
>>Possible solution:
>>
>>import mx.DateTime as dt
>>def age(date):
>>return dt.Age(dt.today(), date).years
>>born = dt.Date(1967, 5, 1)
>>assert age(born) == 39
>
>
> dealbreaker:
>
age(datetime.date(1970,5,2))
>
(snip traceback)
W
John Henry wrote:
> >
> > Carl,
> > OS writers provide much more tools for debugging, tracing, changing
> > the priority of, sand-boxing processes than threads (in general) It
> > *should* be easier to get a process based solution up and running
> > andhave it be more robust, when compared to a th
Dennis Lee Bieber <[EMAIL PROTECTED]> writes:
> Ugh... Seems to me it would be better to find some Python library
> for SSH, something similar to telnetlib, rather than doing an
> os.system() per command line. EACH of those os.system() calls probably
> causes a full fork() operation on Linux/
Russell Warren wrote:
> This is something I have a streak of paranoia about (after discovering
> that the current xmlrpclib has some thread safety issues). Is there a
> list maintained anywhere of the modules that are aren't thread safe?
It's much safer to work the other way: assume that librari
Carl J. Van Arsdall wrote:
> [EMAIL PROTECTED] wrote:
> > Carl J. Van Arsdall wrote:
> >
> >> [EMAIL PROTECTED] wrote:
> >>
> >>> Carl J. Van Arsdall wrote:
> >>>
> >>> I don't get what threading and Twisted would to do for
> >>> you. The problem you actually have is that you sometimes
> >>> need
In <[EMAIL PROTECTED]>, John Machin
wrote:
> You may wish to put more restrictions on the separators ... I would be
> suspicious of cases where dms[2] != dms[5]. What plausible separators
> are there besides ":"? Why allow alphabetics? If there's a use case for
> "23h59m59s", that would have to be
Marc 'BlackJack' Rintsch wrote:
> In <[EMAIL PROTECTED]>, miker2 wrote:
>
> > import MySQLdb
> > base = MySQLdb.connect(host="localhost", user="blah", passwd="blah",
> > db="test_py")
> > cursor = base.cursor()
> > cursor.execute("INSERT INTO table (field) VALUES (int)")
> >
> > this does not work
[EMAIL PROTECTED] wrote:
> John Henry wrote:
> > Granted. Threaded program forces you to think and design your
> > application much more carefully (to avoid race conditions, dead-locks,
> > ...) but there is nothing inherently *non-robust* about threaded
> > applications.
>
> Indeed. Let's just g
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hans wrote:
> > Is there a way that the program that created and started a thread also stops
> > it.
> > (My usage is a time-out).
> >
> > E.g.
> >
> > thread = threading.Thread(target=Loop.testLoop)
> > thread.start() # This thread is expected to
[EMAIL PROTECTED] wrote:
> HI,
>
> I'm having trouble writing to a MySql db using python and the MySQLdb
> module. Here is the code:
>
> import MySQLdb
> base = MySQLdb.connect(host="localhost", user="blah", passwd="blah",
> db="test_py")
> cursor = base.cursor()
> cursor.execute("INSERT INTO table
Sybren Stuvel wrote:
> Ray enlightened us with:
> > Also having to check whether a name has already existed can be a
> > major pain in the butt with Python. With Java you always know when a
> > name has already existed, and what type is bound to the name. I
> > consider this to be a Good Thing (tm
Ray wrote:
Ray, please, don't top-post
(snip)
> Also having to check whether a name has already existed can be a major
> pain in the butt with Python.
assert 'somename' not in dir(someObject)
(snip)
> Regarding the lack of privacy,
s/privacy/language-inforced access restriction/
> --I guess
John Machin wrote:
> [EMAIL PROTECTED] wrote:
> > HI,
> >
> > I'm having trouble writing to a MySql db using python and the MySQLdb
> > module. Here is the code:
> >
> > import MySQLdb
> > base = MySQLdb.connect(host="localhost", user="blah", passwd="blah",
> > db="test_py")
> > cursor = base.curs
Ray wrote:
> The argument against this is that since development with Python is so
> rapid, you're supposed to always equip your code with extensive unit
> tests. I like Python but I've never really bought that argument--I
> guess I've been doing Java too long :)
>
In Java, if you don't always e
i have a code that backsup file from src to dest.
Now if some of the files are locked , i need to skip those files..
I was trying to use fctl module but it can be used only in unix i
suppose.
is there anyother way? i am using windows os.
--
http://mail.python.org/mailman/listinfo/python-list
Steve Jobless wrote:
> Sybren Stuvel wrote:
>
>>Steve Jobless enlightened us with:
>>
>>>The first case can be just a typo, like:
>>>
>>> x.valeu = 5
>>>
>>>I make typos all the time. Without a spell checker, this message
>>>would be unreadable :).
>>
>>Then learn to read what you type, as you ty
[EMAIL PROTECTED] wrote:
> John Machin wrote:
> > [EMAIL PROTECTED] wrote:
> > > HI,
> > >
> > > I'm having trouble writing to a MySql db using python and the MySQLdb
> > > module. Here is the code:
> > >
> > > import MySQLdb
> > > base = MySQLdb.connect(host="localhost", user="blah", passwd="blah"
[EMAIL PROTECTED] wrote:
> sorry guys...
>
> forget about the auto incrementer for a second.
>
> the entry is not being recorded. that is my problem. the script does
> not work. thanks.
after Dijkstra: "the use of mySql cripples the mind; its teaching
should, therefore, be regarded as a criminal
John Machin wrote:
> thebjorn wrote:
> > John Machin wrote:
> > > thebjorn wrote:
[...]
> > > Holy code bloat, Batman! Try this:
> > >
> > > return now.year - born.year - (birthday > now)
> >
> > yuck :-)
>
> But this:
> return now.year - born.year - (birthday > now and 1 or 0) is not yuck?
[EMAIL PROTECTED] wrote:
>
> Sybren Stuvel wrote:
>> It has nothing to do with the print command, and everything with
>> floating point precision. See http://docs.python.org/tut/node16.html
>
>
> how about the discrepancy between
>
print 1.2345
>
> 1.2345
>
print "%10.3f" % 1.2345
"Tim Chase" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> >> >>> r = re.compile(r'(?:\([^\)]*\)|\[[^\]]*\]|\S)+')
> >> >>> r.findall(s)
> >>['(a c)b(c d)', 'e']
> >
> > Ah, it's exactly what I want! I thought the left and right
> > sides of "|" are equal, but it is not true.
>
> I
"Simon Forman" <[EMAIL PROTECTED]> wrote:
| I find the "Tkinter reference: a GUI for Python" under "Local links" on
| this page http://infohost.nmt.edu/tcc/help/lang/python/tkinter.html to
| be very helpful. It has a decent discussion of the grid layout
| manager.
|
| HTH,
| ~Simon
Thanks am c
Jaroslaw Zabiello wrote:
> On Wed, 26 Jul 2006 18:20:44 +0200, Bruno Desthuilliers wrote:
>
>
>>May I suggest that you learn some Lisp dialect ?
>
>
> Nope. I hate Lisp syntax.
This should not prevent you from learning it - at least, you'd then
avoid making dumb statements...
>
>>>Of course
Mike wrote:
> I think the answer is that 'def' is an executable statement in python
> rather than a definition that the compiler interprets at compile time.
>
> As a result the compiler can evaluate 'foo()' when it defines 'bar', so
> it does.
>
> The following works as expected:
> def bar():
>
Jaroslaw Zabiello wrote:
> On Wed, 26 Jul 2006 18:23:22 +0200, Bruno Desthuilliers wrote:
>
>
Care to write an external DSL in Ruby ?
>>>
>>>?
>>
>>I mean : write a parser and interpreter for a DSL. In Ruby.
>
>
> I see. Nope. I do not like code generators.
I'm not talking about "code gen
For the record, the copy and paste fix seems to have worked, so far.
Pupeno wrote:
> Hello,
> I am doing some extreme use of optparse, that is, extending it as
> explained on
> http://docs.python.org/lib/optparse-other-reasons-to-extend-optparse.html
> I have subclassed OptionParser and Option. M
Sybren Stuvel wrote:
> Ray enlightened us with:
> > Huh? No. The compiler will always tell you. Have you ever tried Java
> > before?
>
> I know what I'm talking about, I've got a degree in Computer Science
> from the University of Amsterdam.
Then how come you didn't know that the Java compiler wi
John Machin wrote:
> Ray wrote:
>
> > The argument against this is that since development with Python is so
> > rapid, you're supposed to always equip your code with extensive unit
> > tests. I like Python but I've never really bought that argument--I
> > guess I've been doing Java too long :)
> >
Bruno Desthuilliers wrote:
> Ray wrote:
> Ray, please, don't top-post
Um, top-post? I'm using Google News and it looks like it is placed
correctly in the thread... or you're referring to a different thing?
Ray
--
http://mail.python.org/mailman/listinfo/python-list
thebjorn wrote:
> John Machin wrote:
> > thebjorn wrote:
> > > John Machin wrote:
> > > > thebjorn wrote:
> [...]
> > > > Holy code bloat, Batman! Try this:
> > > >
> > > > return now.year - born.year - (birthday > now)
> > >
> > > yuck :-)
> >
> > But this:
> > return now.year - born.year
Ray wrote:
> Bruno Desthuilliers wrote:
>
>>Ray wrote:
>>Ray, please, don't top-post
>
>
> Um, top-post? I'm using Google News and it looks like it is placed
> correctly in the thread... or you're referring to a different thing?
http://en.wikipedia.org/wiki/Top-posting
--
bruno desthuilliers
Bruno Desthuilliers wrote:
> Ray wrote:
> > Bruno Desthuilliers wrote:
> >
> >>Ray wrote:
> >>Ray, please, don't top-post
> >
> >
> > Um, top-post? I'm using Google News and it looks like it is placed
> > correctly in the thread... or you're referring to a different thing?
>
> http://en.wikipedia.
According to the "wxPython in Action" book using the wx.CallAfter function in a non-gui thread is a safe way for threads to call functions that will then update the gui in the gui thread.
Cheers!!
Dermot.
On 23/07/06, Mark rainess <[EMAIL PROTECTED]> wrote:
[EMAIL PROTECTED] wrote:> Mark rain
Jaroslaw Zabiello wrote:
> Of course, I you like, you can freeze every object you want and nobody can
> be able to open and change it. You can also trace all activity for changing
> something to objects because Ruby has nice system hooks implemented. Ruby
> has nice security system (private, prote
[EMAIL PROTECTED] wrote:
> It looks like the PyTensor object *should* have .xx, .xy, etc
> properties, but they may be accessible through a matrix, i.e. .t(i,j)
Thanks to all of you for your help!
The solution is easy: The tensor components have labels t11, t12,...
Good guess ruibalp!
--
http:
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Yes, someone can, and that someone might as well be you.
> How long does it take to create and clean up 100 trivial
> processes on your system? How about 100 threads? What
> portion of your user waiting time is that?
Here is test prog...
The resu
placid <[EMAIL PROTECTED]> wrote:
> >>> import subprocess
> >>> p = subprocess.Popen(["ffmpeg.exe -i video.mpg", "-f mjpeg -ss 5
> >>> -vframes 1 -s 160x120 -an video.gif"], shell=True, stdout=subprocess.PIPE)
>
> but the ffmpeg complains about the input file being corrupter, whereas
> when i
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I'm trying to monitor about 250 devices with SNMP, using PySNMP version
> 4. I use the threading.Thread to create a threadpool of 10 threads, so
> devices not responding won't slow down the monitoring process too
> much.
This is surely a job for t
Bruno Desthuilliers wrote:
> >>Care to write an external DSL in Ruby ?
>
> I mean : write a parser and interpreter for a DSL. In Ruby.
It is this kind of stuff Rubys talk about when they mention "DSLs in
Ruby":
http://www.artima.com/rubycs/articles/ruby_as_dsl.html
--
http://mail.python.org/m
On 2006-07-25, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:
> Gerhard Fiedler wrote:
>> On 2006-07-25 04:06:24, Steve Holden wrote:
>>
> Since Python has no "local variable declaration", there must be a rule
> to distinguish local names from names living in the enclosing
> namespaces. The rule i
Hi listers,
I wrote this script in Zope some time ago and it worked for a while, but now
I'm getting the following error:
TypeError: coercing to Unicode: need string or buffer, NoneType found
Here's my script:
results = context.module_retriever().tuples() # call to ZSQLMethod
converted = []
for
Hi All,
I'm hoping someone has some experience in this field and could give me
a pointer in the right direction - it's not purely python related
though. Any modules/links someone has tried and found useful would be
greatly appreciated...
I want to have an automated process which basically has its
Jon Bowlas wrote:
> Here's my script:
>
> results = context.module_retriever().tuples() # call to ZSQLMethod
> converted = []
> for result in results:
>result = list(result) # make a list from the tuple
>for i in range(len(result)):
> # for each element in the listified tuple, make de
Ahh, that did it, thanks very much.
Jon
- Original Message -
From: <[EMAIL PROTECTED]>
Newsgroups: comp.lang.python
To:
Sent: Thursday, July 27, 2006 11:19 AM
Subject: Re: coercing to Unicode: need string or buffer, NoneType found
>
> Jon Bowlas wrote:
>
>> Here's my script:
>>
>> re
Jon Bowlas wrote:
> I wrote this script in Zope some time ago and it worked for a while, but
> now I'm getting the following error:
> TypeError: coercing to Unicode: need string or buffer, NoneType found
>
> Here's my script:
>
> results = context.module_retriever().tuples() # call to ZSQLMethod
Ahh yes there are a couple of dodgy records that seem to have been added.
many thanks.
Jon
- Original Message -
From: "Peter Otten" <[EMAIL PROTECTED]>
Newsgroups: comp.lang.python
To:
Sent: Thursday, July 27, 2006 11:22 AM
Subject: Re: coercing to Unicode: need string or buffer, NoneTy
It says line 8 in the traceback so I guess its
result[i] = unicode(result[i], 'latin-1')
Jon
- Original Message -
From: "Sybren Stuvel" <[EMAIL PROTECTED]>
Newsgroups: comp.lang.python
To:
Sent: Thursday, July 27, 2006 11:06 AM
Subject: Re: coercing to Unicode: need string or buffer, N
John Machin schrieb:
>
> BTW, if the script doesn't contain
>
> base.commit()
>
> somewhere, take yourself out to the back lane and give yourself a good
> thumping :-)
That's not really fair, because transactions were added to MySQL only a
short time ago (at least to the default table type)
John Machin wrote:
> [EMAIL PROTECTED] wrote:
> > I know this is a trivial function, and I've now spent more time
> > searching for a surely-already-reinvented wheel than it would take to
> > reinvent it again, but just in case... is there a published,
> > open-source, function out there that takes
[EMAIL PROTECTED] a écrit :
> import MySQLdb
> base = MySQLdb.connect(host="localhost", user="blah", passwd="blah",
> db="test_py")
> cursor = base.cursor()
> cursor.execute("INSERT INTO table (field) VALUES (int)")
>
> this does not work but the interesting thing is, there is an
> AUTO_INCREMENT
Gerhard Fiedler wrote:
> Going back to the original question... What would be the most
> common/useful way to access variables from the outer function for writing
> from within the inner function?
I've done something like this (which doesn't look very nice)
def myfunc():
tok = ['']
def i
Sibylle Koczian wrote:
> John Machin schrieb:
> >
> > BTW, if the script doesn't contain
> >
> > base.commit()
> >
> > somewhere, take yourself out to the back lane and give yourself a good
> > thumping :-)
>
> That's not really fair, because transactions were added to MySQL only a
> short tim
Hi,
I have some basic doubts about thread.
I have a list which has items in it which need to be downloaded from
the internet.
Let's say list is:
list_items[] which has 100 items in it.
I have a function download_from_web() which does the work of
downloading the items from the web. It does error
[EMAIL PROTECTED] wrote:
> John Machin wrote:
> > [EMAIL PROTECTED] wrote:
> > > I know this is a trivial function, and I've now spent more time
> > > searching for a surely-already-reinvented wheel than it would take to
> > > reinvent it again, but just in case... is there a published,
> > > open
Dear users,
I use Python version 2.4.3 and DyBase Object Oriented Database. These
are the first three lines in my program:
import os
import sys
import dybase
I usually get the error message: ImportError: DLL load failed. Kindly
be informed that I have in the folder: C:\Python24\Lib the follow
John Machin wrote:
> Sibylle Koczian wrote:
> > John Machin schrieb:
> > >
> > > base.commit()
[...]
> > That's not really fair, because transactions were added to MySQL only a
> > short time ago (at least to the default table type). There simply hasn't
> > yet been time for every experienced
"Jon Clements" <[EMAIL PROTECTED]> writes:
> problem. What I'm unsure of is the best way to design this. Bear in
> mind that network/email server configuration changes can be made. For
> instance, do I connect to the email server and keep polling it every
> 'n' whatever for new messages, or should
[EMAIL PROTECTED] wrote:
> it seems that the behavior of "print" is that it will round off
> properly for any floating point imperfection, such as shown in the
> first two samples. The third sample seems to be a bug? It doesn't
> know how to handle the floating imperfection in this case.
>
>
>>
Ritesh Raj Sarraf wrote:
> I'm planning to implement threads in my application so that multiple
> items can be downloaded concurrently. I want the thread option to be
> user-defined.
>
> Looking at the documentation of threads (Core Python Programming), I've
> noticed that all threads are execute
Carl J. Van Arsdall wrote:
> Paul Rubin wrote:
>
>>"Carl J. Van Arsdall" <[EMAIL PROTECTED]> writes:
>>
>>
>>>Processes seem fairly expensive from my research so far. Each fork
>>>copies the entire contents of memory into the new process.
>>>
>>
>>No, you get two processes whose address spa
Kay Schluehr wrote:
> Bruno Desthuilliers wrote:
>
>
Care to write an external DSL in Ruby ?
>>
>>I mean : write a parser and interpreter for a DSL. In Ruby.
>
>
> It is this kind of stuff Rubys talk about when they mention "DSLs in
> Ruby":
>
> http://www.artima.com/rubycs/articles/ruby_a
Bruno Desthuilliers wrote:
> Please define "security". I fail to see how language-inforced access
> restriction (and mandatory declarative static typing etc) relates to
> 'security'. As far as I'm concerned, security is about protecting a
> system from piracy, not about inflicting useless pain to
Hi All,
I have some old pysqlite 1.x code that uses a pattern like this:
cu.execute('SELECT weight FROM weights WHERE samplename="foo")
row = cu.fetchone()
weight=row['weight']
It seems like lookups by name are no longer supported in pysqlite2. Is
that true? And if not, and I want to do a SELE
Hello all,
I'm trying to extract the code object from a function, and exec it
without explicitly passing parameters.
The code object 'knows' it expects to receive paramaters. It's
'arg_count' attribute is readonly.
How can I set the arg_count to 0, or pass parameters to the code object
when I ex
[EMAIL PROTECTED]
| I have some old pysqlite 1.x code that uses a pattern like this:
|
| cu.execute('SELECT weight FROM weights WHERE samplename="foo")
| row = cu.fetchone()
| weight=row['weight']
|
| It seems like lookups by name are no longer supported in
| pysqlite2.
According to this:
ht
Asem Eltaher wrote:
> Dear users,
> I use Python version 2.4.3 and DyBase Object Oriented Database. These
> are the first three lines in my program:
>
> import os
> import sys
> import dybase
>
> I usually get the error message: ImportError: DLL load failed. Kindly
> be informed that I have in t
danielx wrote:
> Bruno Desthuilliers wrote:
>
(snip)
>>
>>>Surprising for me are actually two things: 1- the fact itself, and 2- that
>>>term "binding", and that whatever it means > (I'll have to read more on that,
>>>now that I know the term)
>>
>>a "binding" is the association of a name and a re
On Thu, 27 Jul 2006 07:07:05 GMT, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:
>On Wed, 26 Jul 2006 17:38:06 -0700, "Carl J. Van Arsdall"
><[EMAIL PROTECTED]> declaimed the following in comp.lang.python:
>
>> Well, I guess I'm thinking of an event driven mechanism, kinda like
>> setting up signal h
Fuzzyman wrote:
> Hello all,
>
> I'm trying to extract the code object from a function, and exec it
> without explicitly passing parameters.
>
> The code object 'knows' it expects to receive paramaters. It's
> 'arg_count' attribute is readonly.
>
> How can I set the arg_count to 0, or pass paramet
On Thu, 27 Jul 2006 02:30:03 -0500, Nick Craig-Wood <[EMAIL PROTECTED]> wrote:
>[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>> Hans wrote:
>> > Is there a way that the program that created and started a thread also
>> > stops
>> > it.
>> > (My usage is a time-out).
>> >
>> > E.g.
>> >
>> > threa
No, that doesn't work. Though, leaving the random snippet about the
"for file in DirectoryWalker("."):" line, it does leave all files the
same value, rather than switching the value for every single file. The
problem is, the value is shared accross every folder.
--
http://mail.python.org/mailma
Paul Rubin wrote:
>
> Instead of using os.system, maybe you want to use one of the popens or
> the subprocess module. For each ssh, you'd spawn off a process that
> does the ssh and communicates back to the control process through a
> set of file descriptors (Unix pipe endpoints or whatever). The
> I'm running a service on a machine. The service is written in Python
> (of course) and it connects to an XMLRPC server periodically.
> It recreates the ServerProxy instance each time it needs to connect to
> the RPC server.
>
> The server is created with this code:
>
> server = xmlrpclib.Server
PipedreamerGrey wrote:
> I'm using the script below (originally from http://effbot.org, given to
> me here) to open all of the text files in a directory and its
> subdirectories and combine them into one Rich text
> file (index.rtf). Now I'm adapting the script to convert all the text
> files int
"manuhack" <[EMAIL PROTECTED]> wrote in news:1153981114.837884.232610
@p79g2000cwp.googlegroups.com:
> I copied the lines
>
> f=open('/tmp/workfile', 'w')
> print f
> f.close()
>
> from Python 2.4 Documentation 7.2. But it said IOerror No such file or
> directory" '/tmp/workfile'
>
> Is it som
[EMAIL PROTECTED] wrote:
>>>do you mean 'configparser'?
>>
>>Yes.
>>
>>
>>>Does it generate objects from the config file automatically?
>>
>>It generates a representation of the config file as a Python object
>>composed of sections and options. The documentation should get you started.
>
>
> Hiya
On Wed, 26 Jul 2006 16:11:48 -0700, Paddy wrote:
>
> Paddy wrote:
>> Pierre Thibault wrote:
>> > Hello!
>> >
>> > I am currently trying to port a C++ code to python, and I think I am stuck
>> > because of the very different behavior of STL iterators vs python
>> > iterators. What I need to do is
Paul Boddie wrote:
> John Machin wrote:
> > Sibylle Koczian wrote:
> > > John Machin schrieb:
> > > >
> > > > base.commit()
>
> [...]
>
> > > That's not really fair, because transactions were added to MySQL only a
> > > short time ago (at least to the default table type). There simply hasn't
>
Steve Jobless wrote:
> Sybren Stuvel wrote:
> >
> > Steve Jobless enlightened us with:
> > > The first case can be just a typo, like:
> > >
> > > x.valeu = 5
> > >
> > > I make typos all the time. Without a spell checker, this message
> > > would be unreadable :).
> >
> > Then learn to read what
> Actually, the code in the book is:
>
> def f1():
> x = 88
> f2(x)
>
> def f2(x):
> print x
>
> f1()
>
> which makes all the difference in the world. Not to mention that this
> particular section of the book is giving an example of how to write the
> code *without* using nested fun
Thanks Tim! That works well. As a followup, is there a standard
compliant way to ask what fields are in the table?
-kurt
Tim Golden wrote:
> | I have some old pysqlite 1.x code that uses a pattern like this:
> |
> | cu.execute('SELECT weight FROM weights WHERE samplename="foo")
> | row = cu.fe
On Wed, 26 Jul 2006 20:59:12 +0200, Peter Otten wrote:
> Pierre Thibault wrote:
>
>> Hum, this example seems like a special case not really appropriate for my
>> needs. Let me make my problem a little more precise. The objects I'll want
>> to iterate through will always contain some floats. Very
[EMAIL PROTECTED]
| Sent: 27 July 2006 15:01
| To: [email protected]
| Subject: Re: pysqlite2 fetching from select different than pysqlite?
|
| Thanks Tim! That works well. As a followup, is there a standard
| compliant way to ask what fields are in the table?
|
| -kurt
Assuming this is w
On 2006-07-27, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:
> danielx wrote:
>> Bruno Desthuilliers wrote:
>>
> (snip)
>>>
Surprising for me are actually two things: 1- the fact itself, and 2- that
term "binding", and that whatever it means > (I'll have to read more on
that,
now
Fuzzyman wrote:
> Fuzzyman wrote:
> > Hello all,
> >
> > I'm trying to extract the code object from a function, and exec it
> > without explicitly passing parameters.
> >
> > The code object 'knows' it expects to receive paramaters. It's
> > 'arg_count' attribute is readonly.
> >
> > How can I set
[EMAIL PROTECTED] wrote:
> Ouch! You got me there, I did not copy the code properly. Now I feel
> stupid. Thanks for the enlightment.
>
> I think I am starting to get it.
P.S. The point of the example was to show how nesting isn't necessary
much of the time. The authors wanted to show that it i
On 2006-07-26 19:10:14, Carl J. Van Arsdall wrote:
> Ah, alright. So if that's the case, why would you use python threads
> versus spawning processes? If they both point to the same address space
> and python threads can't run concurrently due to the GIL what are they
> good for?
Nothing run
Fuzzyman wrote:
> Fuzzyman wrote:
> > Fuzzyman wrote:
> > > Hello all,
> > >
> > > I'm trying to extract the code object from a function, and exec it
> > > without explicitly passing parameters.
> > >
> > > The code object 'knows' it expects to receive paramaters. It's
> > > 'arg_count' attribute i
Perfect. Thanks much!
-kurt
>
> from pysqlite2 import dbapi2 as sqlite
>
> db = sqlite.connect (":memory:")
> db.row_factory = sqlite.Row
>
> db.execute ("CREATE TABLE x (i INTEGER, code VARCHAR (10), name VARCHAR
> (60))")
>
> for row in db.execute ("PRAGMA TABLE_INFO ('x')"):
> print row['n
On 2006-07-27 09:42:16, Bruno Desthuilliers wrote:
>> Are you saying Python variables don't hold references to "actual" Python
>> objects?
>
> Exactly.
>
>> That idea has been working well for me so far.
>
> It can only take you so far. Now it's time you know the truth: there are
> *no* 'varia
[EMAIL PROTECTED] wrote:
> Paul Boddie wrote:
> > the MySQL-centric culture of ignoring/ridiculing stuff they don't support
> > (and then eventually supporting it, in this case) is probably most to
> > blame if we have to point the finger.
[...]
> I think you should support people rather than pay
Duncan,
I couldn't make out much from the code.
Instead this is what I did.
threads = []
nloops = range(len(lRawData))
for i in nloops:
(sUrl, sFile, download_size, checksum) =
stripper(lRawData[i])
t = threading.Thread(target=download_from_web, args=(sUrl,
Fuzzyman wrote:
>> I'd like to construct the code object so that it takes the parameters
>> from the enclosing scope (the context I pass into exec I guess),
>> without clobbering any local variables that may be defined in the code
>> object.
>>
>> Anyone got any clues ?
Does this do what you want
Simon Forman wrote:
> Fuzzyman wrote:
[snip..]
> > I was hoping I could get to the code object for the *body* of the
> > function. Looks like that won't be possible without dis-assembling the
> > bytecode or other tricks even more hackish than what I've already done.
> >
> > For the record, the co
Antoon Pardon wrote:
> On 2006-07-27, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:
>
>>danielx wrote:
>>
>>>Bruno Desthuilliers wrote:
>>>
>>
>>(snip)
>>
>Surprising for me are actually two things: 1- the fact itself, and 2- that
>term "binding", and that whatever it means > (I'll have t
Thank you,
James
Martin v. Löwis wrote:
> James Thiele wrote:
> > What exceptions (if any) can the python builtin compile() function
> > throw besides SyntaxError?
>
> - TypeError, if the parameters are wrong/too many/too few
> - Any errors that a codec may raise, if there is an encoding
> decla
Ritesh Raj Sarraf wrote:
> Duncan,
>
> I couldn't make out much from the code.
Please, try again to understand Duncan's code. It's much better than
what you did.
> Instead this is what I did.
>
> threads = []
> nloops = range(len(lRawData))
> for i in nloops:
> (sUrl,
1 - 100 of 237 matches
Mail list logo