Re: Convert string to command..

2007-10-18 Thread Abandoned
On Oct 18, 8:53 pm, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > Abandoned <[EMAIL PROTECTED]> writes: > > > When you load it, convert the string to dict with cPickle.loads > > > instead of with eval. > > > Yes i understand and this very very good ;) > > Good! :-) > > > psycopg2.ProgrammingError: in

Re: ANN: Pyrex 0.9.6.3

2007-10-18 Thread David Tremouilles
Hello, Was about to report the same problem with setup.py. Regards, David 2007/10/18, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > On Oct 17, 4:12 am, Greg Ewing <[EMAIL PROTECTED]> wrote: > > Pyrex 0.9.6.3 is now available: > > > >http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/ > > > > M

Re: Noob questions about Python

2007-10-18 Thread Michele Simionato
On Oct 18, 7:44 pm, MRAB <[EMAIL PROTECTED]> wrote: > It returns '' when number == 0, so you need to test for that case: > > > def baseN(number, N=2): > > """ > > >>> baseN(9, 2) > > '1001' > > """ > > assert 2 <= N <= 10 > > assert isinstance(number, int) and number >= 0 >

Re: why doesn't have this list a "reply-to" ?

2007-10-18 Thread [david]
Robert Kern wrote: > [david] wrote: >> Steve Lamb wrote: >>> On 2007-10-17, Byung-Hee HWANG <[EMAIL PROTECTED]> wrote: Just click "Ctrl-L", then you can reply to lists directly if you use good mailer like mutt or thunderbird or evolution ;; >>> Thunderbird only if it has the list-rep

problem with eric

2007-10-18 Thread Pradnyesh Sawant
Hello, I have the following single line in my .py file: from PyQt4 import QtCore, QtGui if i run it from eric, i get the following error: unhandled RuntimeError "the PyQt4.QtCore and qt modules both wrap the QObject class" i think that eric is probably trying to load both Qt3 and Qt4, but i don

I can't get minimock and nosetests to play nice

2007-10-18 Thread Matthew Wilson
I'm curious if anyone has ever tried using nosetests along with minimock. I'm trying to get the two to play nice and not making progress. I also wonder if I'm using minimock incorrectly. Here's the code I want to test, saved in a file dtfun.py. class Chicken(object): "I am a chicke

Re: Noob: Loops and the 'else' construct

2007-10-18 Thread Gabriel Genellina
En Thu, 18 Oct 2007 23:44:27 -0300, Ixiaus <[EMAIL PROTECTED]> escribió: > I have just come across a site that discusses Python's 'for' and > 'while' loops as having an (optional) 'else' structure. > > At first glance I interpreted it as being a bit like the 'default' > structure in PHP's switch

Re: vote for Python - PLEASE

2007-10-18 Thread [EMAIL PROTECTED]
On Oct 18, 6:12 pm, Monty Taylor <[EMAIL PROTECTED]> wrote: > Hey everybody, > > MySQL has put up a poll onhttp://dev.mysql.comasking what your primary > programming language is. But it doesn't ask that, it asks what your primary programming language is FOR DEVELOPING MYSQL APPLICATIONS. In my ca

Noob: Loops and the 'else' construct

2007-10-18 Thread Ixiaus
I have just come across a site that discusses Python's 'for' and 'while' loops as having an (optional) 'else' structure. At first glance I interpreted it as being a bit like the 'default' structure in PHP's switch block... But the switch block isn't a loop, so, I am now confused as to the reason f

Noob: Loops and the 'else' construct

2007-10-18 Thread Ixiaus
I have just come across a site that discusses Python's 'for' and 'while' loops as having an (optional) 'else' structure. At first glance I interpreted it as being a bit like the 'default' structure in PHP's switch block... But the switch block isn't a loop, so, I am now confused as to the reason f

Re: What Data is Available With a Pickled Object Over a Socket?

2007-10-18 Thread Gabriel Genellina
En Thu, 18 Oct 2007 19:21:15 -0300, milan_sanremo <[EMAIL PROTECTED]> escribió: > I've read the library entry for pickle a couple of times, and I'm > still not > sure what data is maintained when an item is pickled and sent over a > socket. For most "normal" objects, all their instance attribut

Re: Noob questions about Python

2007-10-18 Thread Ixiaus
That was a very helpful answer Steven, thank you for taking the time to write it! -- http://mail.python.org/mailman/listinfo/python-list

Re: ConfigParser preserving file ordering

2007-10-18 Thread Joshua J. Kugler
On Thursday 18 October 2007 15:23, Frank Aune wrote: > Hello, > > I use ConfigParser and actually quite like it, EXCEPT that it doesnt > preserve the section order of the original config file when writing a new. > This behaviour is hopeless IMO, and I've been looking for alternatives. > > I've b

Re: Static variable vs Class variable

2007-10-18 Thread bambam
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Wed, 17 Oct 2007 13:41:06 +0200, Hrvoje Niksic wrote: > >> The current implementation of += uses __add__ for addition and __iadd__ >> for addition that may or may not be in-place. I'd like to know the >> rational

Re: Is there a way to tell if a script has been run by Pythonw.exe instead of Python.exe?

2007-10-18 Thread michaelvmata
On Oct 18, 2:56 pm, Metalone <[EMAIL PROTECTED]> wrote: > In particular I want to know how to tell if reading and writing to the > console can occur. > Something like > sys.isConsolePresent() Look at sys.executable to find the name of the binary for the Python interpreter. -- http://mail.python.

Re: Need scrip to reed rss feeds

2007-10-18 Thread Andreas Kraemer
On Oct 18, 4:39 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, > Does any one know whare I can find some code to phrase a rss feeds? > Thank you, > Ted Try http://feedparser.org/ -- http://mail.python.org/mailman/listinfo/python-list

vote for Python - PLEASE

2007-10-18 Thread Monty Taylor
Hey everybody, MySQL has put up a poll on http://dev.mysql.com asking what your primary programming language is. Even if you don't use MySQL - please go stick in a vote for Python. I'm constantly telling folks that Python needs more love, but PHP and Java are kicking our butts... (I know the w

Re: Noob questions about Python

2007-10-18 Thread MRAB
On Oct 18, 7:05 am, Michele Simionato <[EMAIL PROTECTED]> wrote: > On Oct 17, 5:58 pm, Ixiaus <[EMAIL PROTECTED]> wrote: > > > def bin2dec(val): > > li = list(val) > > li.reverse() > > res = [int(li[x])*2**x for x in range(len(li))] > > print sum(res) > > > It basically does the sam

Re: Embedded Boost.Python Enum

2007-10-18 Thread Cory
Ok, I finally got it figured out. The secret which no one told me what that if you're doing embedding, you have to initialize your modules! BOOST_PYTHON_MODULE(Enums){ ... } defines the function initEnums() which must be called before you can import the module. Finally figured it out by looking he

Need scrip to reed rss feeds

2007-10-18 Thread [EMAIL PROTECTED]
Hi, Does any one know whare I can find some code to phrase a rss feeds? Thank you, Ted -- http://mail.python.org/mailman/listinfo/python-list

ConfigParser preserving file ordering

2007-10-18 Thread Frank Aune
Hello, I use ConfigParser and actually quite like it, EXCEPT that it doesnt preserve the section order of the original config file when writing a new. This behaviour is hopeless IMO, and I've been looking for alternatives. I've been reading the interesting discussion on python-dev about improve

Re: Is there a way to tell if a script has been run by Pythonw.exe instead of Python.exe?

2007-10-18 Thread Graham Dumpleton
On Oct 19, 7:56 am, Metalone <[EMAIL PROTECTED]> wrote: > In particular I want to know how to tell if reading and writing to the > console can occur. > Something like > sys.isConsolePresent() Have you tried: sys.stdin.isatty() sys.stdout.isatty() Graham -- http://mail.python.org/mailman/li

Re: Noob questions about Python

2007-10-18 Thread Steven D'Aprano
On Wed, 17 Oct 2007 23:06:24 -0700, Ixiaus wrote: > I know '<<' is shifting x over by n bits; but could you point me to some > literature that would explain why it is the same as "x*2**n"? (Googling > only returns bit shift, but doesn't necessarily explain the manner in > which you are using it)

Re: Getting error message/trace over the C API

2007-10-18 Thread Sami Vaisanen
On Tue, 16 Oct 2007 18:55:22 +, Duncan Booth wrote: > Sami Vaisanen <[EMAIL PROTECTED]> wrote: > >> Hello group, >> >> I'm writing a C++ based application that embeds the python engine. Now I >> have a problem regarding exception/error information. Is there a way to >> get the exception mes

Re: Extending Python with C API

2007-10-18 Thread Sami Vaisanen
On Thu, 13 Sep 2007 21:26:33 -0400, Carsten Haese wrote: > On Thu, 2007-09-13 at 18:05 -0700, Thierry Masson wrote: >> Hello, >> >> I'm trying to use the C API to extend Python. I've looked at various >> books and web sites (including the docs at python.org) and I can't get >> any of the samples

Re: python logging module and custom handler specified in config file

2007-10-18 Thread Frank Aune
On Thursday 18 October 2007 19:26:59 Vinay Sajip wrote: > The same technique applies to the arguments passed to the constructor. > > Hope this helps, > Thank you! This seems like exactly what I was looking for. Very impressive logging framework btw - I use it whenever I can =) Cheers, Frank --

Re: Convert string to command..

2007-10-18 Thread Steven D'Aprano
On Thu, 18 Oct 2007 14:05:34 -0300, Sebastian Bassi wrote: > On 10/18/07, Adam Atlas <[EMAIL PROTECTED]> wrote: >> >> Use the builtin function "eval". > > What is the difference with os.system()? Everything. eval() evaluates Python expressions like "x.append(2+3)". os.system() calls your opera

What Data is Available With a Pickled Object Over a Socket?

2007-10-18 Thread milan_sanremo
I've read the library entry for pickle a couple of times, and I'm still not sure what data is maintained when an item is pickled and sent over a socket. Two importable modules: class envelope(): def __init__(self, rec, d): self.recipient = rec self.listData

Re: Strange behaviour with reversed()

2007-10-18 Thread Dustan
On Oct 18, 3:52 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Thu, 18 Oct 2007 15:24:27 +1000, Ben Finney wrote: > > Steven D'Aprano <[EMAIL PROTECTED]> writes: > > >> and help(reversed) but neither gives any insight to what happens when > >> you use reversed() on a sequenc

Is there a way to tell if a script has been run by Pythonw.exe instead of Python.exe?

2007-10-18 Thread Metalone
In particular I want to know how to tell if reading and writing to the console can occur. Something like sys.isConsolePresent() -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: Pyrex 0.9.6.3

2007-10-18 Thread kyosohma
On Oct 17, 4:12 am, Greg Ewing <[EMAIL PROTECTED]> wrote: > Pyrex 0.9.6.3 is now available: > >http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/ > > Main features of this release: > >* The C API now uses just one name in the module namespace, > instead of a name per C function. > >

Re: Running another python interpreter

2007-10-18 Thread Gabriel Genellina
On 18 oct, 16:55, Sushant <[EMAIL PROTECTED]> wrote: > Does gateway.py has the python interpreter in the top (i.e., > #!/usr/local/bin/python) The OP said he's on Windows so that doesn't matter. > On Thursday 18 October 2007 2:13 pm, Simon Pickles wrote: > > > os.spawnv(os.P_NOWAIT, "gateway

Re: CGI and external JavaScript nightmare

2007-10-18 Thread IamIan
> > The OP's problem is that he suffers from the delusion that people want > > to steal the source code for hisCGIscript. Why is assuming someone may try to get my source CGI delusional? I'm on a shared server (Dreamhost). The CGI itself has 755 permissions to execute, but what about folder permi

Re: image resize question

2007-10-18 Thread Matimus
On Oct 18, 11:56 am, "Tim Arnold" <[EMAIL PROTECTED]> wrote: > Hi, I'm using the Image module to resize PNG images from 300 to 100dpi for > use in HTML pages, but I'm losing some vertical and horizontal lines in the > images (usually images of x-y plots). > > Here's what I do: > import Image > def

Re: strptime and microseconds

2007-10-18 Thread Gabriel Genellina
On 18 oct, 13:46, mathieu <[EMAIL PROTECTED]> wrote: > On Oct 18, 6:36 pm, mathieu <[EMAIL PROTECTED]> wrote: > > > I am trying to use strptime to parse my microseconds but I was not > > > able the documentation for it. The only list I found was: > Ok final version is simply: > > s1 = "20070619"

AttributeError - FM Receiver - Intermediate freq.

2007-10-18 Thread noroi
Hi, I got problems while running Eric Blossom's FM receiver's example codes from the GNURadio tutorial page; the RF front end reads the signal input from daughter board, and when the compiler tried to call mothods to set values for IF and gain, such as set_AGC(), get_output_freq(), etc... it

Re: Problem with format string / MySQL cursor

2007-10-18 Thread Florian Lindner
On 18 Okt., 22:08, Paul McNett <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On Oct 19, 7:32 am, Florian Lindner <[EMAIL PROTECTED]> wrote: > >> Hello, > >> I have a string: > > >> INSERT INTO mailboxes (`name`, `login`, `home`, `maildir`, `uid`, > >> `gid`, `password`) VALUES (%s, %s,

Re: Elisp Tutorial: HTML Syntax Coloring Code Block

2007-10-18 Thread j.oke
On 18 Ott, 06:15, Xah Lee <[EMAIL PROTECTED]> wrote: > [...] Half lost on my firmness gains to more glad heart, Or violent and from forage drives A glimmering of all sun new begun Both harp thy discourse they march'd, Forth my early, is not without delay; For their soft with whirlwind; and balm. U

Re: Convert string to command..

2007-10-18 Thread [EMAIL PROTECTED]
On Oct 18, 1:38 pm, Bruno Desthuilliers wrote: > Abandoned a écrit : > (snip) > > > I'm very confused :( > > I try to explain main problem... > > I have a table like this: > > id-1 | id-2 | value > > 23 24 34 > > 56 68 66 > > 56 98 32455 > > 55 62 655 > > 56

Re: Problem with format string / MySQL cursor

2007-10-18 Thread Paul McNett
[EMAIL PROTECTED] wrote: > On Oct 19, 7:32 am, Florian Lindner <[EMAIL PROTECTED]> wrote: >> Hello, >> I have a string: >> >> INSERT INTO mailboxes (`name`, `login`, `home`, `maildir`, `uid`, >> `gid`, `password`) VALUES (%s, %s, %s, %s, %i, %i, %s) >> >> that is passed to a MySQL cursor from MySQ

Re: Can you escape a % in string that will used for substitution

2007-10-18 Thread Tim Chase
> Is there a way to do: > > s = "I like python %i%s of the time." > print s % (99, "%") > > without having to pass in "%"? You mean like s = "I like python %i%% of the time." print s % 99 http://docs.python.org/lib/typesseq-strings.html -tkc -- http://mail.python.org/mailman/listinfo

Re: Running another python interpreter

2007-10-18 Thread Sushant
Does gateway.py has the python interpreter in the top (i.e., #!/usr/local/bin/python) -Sushant. On Thursday 18 October 2007 2:13 pm, Simon Pickles wrote: > Well, I tried: > > os.spawnv(os.P_NOWAIT, "gateway.py", ()) > > and got: > > OSError: [Errno 8] Exec format > > Simon Pickles wrote:

Can you escape a % in string that will used for substitution

2007-10-18 Thread Gerard Brunick
Is there a way to do: s = "I like python %i%s of the time." print s % (99, "%") without having to pass in "%"? Thanks, Gerard -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with Python class creating

2007-10-18 Thread Bruno Desthuilliers
dmitrey a écrit : > Hi all, > I have the code like this one: > > from myMisc import ooIter > class MyClass: Unless you have a need for compatibility with aged Python versions, you'd be better using new-style classes: class MyClass(object): > def __init__(self): pass This is the default be

Re: problem with Python class creating

2007-10-18 Thread timaranz
On Oct 19, 8:22 am, dmitrey <[EMAIL PROTECTED]> wrote: > Hi all, > I have the code like this one: > > from myMisc import ooIter > class MyClass: > def __init__(self): pass > iterfcn = lambda *args: ooIter(self) # i.e pass the class instance > to other func named ooIter > field2 = val2 >

Re: Problem with format string / MySQL cursor

2007-10-18 Thread timaranz
On Oct 19, 7:32 am, Florian Lindner <[EMAIL PROTECTED]> wrote: > Hello, > I have a string: > > INSERT INTO mailboxes (`name`, `login`, `home`, `maildir`, `uid`, > `gid`, `password`) VALUES (%s, %s, %s, %s, %i, %i, %s) > > that is passed to a MySQL cursor from MySQLdb: > > ret = cursor.execute(sql,

problem with Python class creating

2007-10-18 Thread dmitrey
Hi all, I have the code like this one: from myMisc import ooIter class MyClass: def __init__(self): pass iterfcn = lambda *args: ooIter(self) # i.e pass the class instance to other func named ooIter field2 = val2 field3 = val3 # etc So it yields "global name 'self' is not defined"

Re: Strange behaviour with reversed()

2007-10-18 Thread Terry Reedy
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] |I don't understand how reversed() is operating. I've read the description | in the docs: | | reversed(seq) | Return a reverse iterator. seq must be an object which supports the | sequence protocol (the __len__() method

image resize question

2007-10-18 Thread Tim Arnold
Hi, I'm using the Image module to resize PNG images from 300 to 100dpi for use in HTML pages, but I'm losing some vertical and horizontal lines in the images (usually images of x-y plots). Here's what I do: import Image def imgResize(self,filename): img = Image.open(filename) dpi

Re: Embedded Boost.Python Enum

2007-10-18 Thread Roman Yakovenko
On 10/18/07, Cory <[EMAIL PROTECTED]> wrote: > > Hi, > > I have a hopefully quick question about how to use Boost.Python to > export an Enum. > I am embedding python in C++ and am currently exporting my classes in > the following way: > > nameSpace["OBJECT"] = class_("OBJECT") > .def("getTy

Re: Strange behaviour with reversed()

2007-10-18 Thread Andreas Kraemer
On Oct 18, 2:25 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > Steven D'Aprano <[EMAIL PROTECTED]> wrote: > >> Note that the starting index is determined at creation time, not when > >> the iteration begins. So, if you create a reversed object over a list > >> containing 3 elements, the first return

Re: Appending a list's elements to another list using a list comprehension

2007-10-18 Thread Debajit Adhikary
On Oct 18, 9:47 am, [EMAIL PROTECTED] (Alex Martelli) wrote: > Debajit Adhikary <[EMAIL PROTECTED]> wrote: > > > How does "a.extend(b)" compare with "a += b" when it comes to > > performance? Does a + b create a completely new list that it assigns > > back to a? If so, a.extend(b) would seem to be

Problem with format string / MySQL cursor

2007-10-18 Thread Florian Lindner
Hello, I have a string: INSERT INTO mailboxes (`name`, `login`, `home`, `maildir`, `uid`, `gid`, `password`) VALUES (%s, %s, %s, %s, %i, %i, %s) that is passed to a MySQL cursor from MySQLdb: ret = cursor.execute(sql, paras) paras is: ('flindner', '[EMAIL PROTECTED]', '/home/flindner/', '/home

1 year free

2007-10-18 Thread nayloon
www.nayloon.com business2business website.Full dynamic and 2 language 10 pages.You post your products you can find customer from all over world.Try it.You will see the different. -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert string to command..

2007-10-18 Thread Carsten Haese
On Thu, 2007-10-18 at 19:53 +0200, Hrvoje Niksic wrote: > Don't > forget to also use a bind variable, something like: > > cursor.execute("INSERT INTO cache2 VALUES (?)", a) I second the advice, but that code won't work. The bind parameters must be a sequence, and psycopg2 (unfortunately) uses %s

Re: Running another python interpreter

2007-10-18 Thread Simon Pickles
Well, I tried: os.spawnv(os.P_NOWAIT, "gateway.py", ()) and got: OSError: [Errno 8] Exec format Simon Pickles wrote: > Hello, > > I have several servers which link to each other (and of course, to clients). > > At present, I am starting them in turn manually. Is there a way with >

Re: Convert string to command..

2007-10-18 Thread Hrvoje Niksic
Abandoned <[EMAIL PROTECTED]> writes: > > When you load it, convert the string to dict with cPickle.loads > > instead of with eval. > > Yes i understand and this very very good ;) Good! :-) > psycopg2.ProgrammingError: invalid byte sequence for encoding "UTF8": > 0x80 > HINT: This error can a

Running another python interpreter

2007-10-18 Thread Simon Pickles
Hello, I have several servers which link to each other (and of course, to clients). At present, I am starting them in turn manually. Is there a way with python to say, "open gateway.py in a new interpreter window"? I looked at execv, etc, but they seem to replace the current process. Ah, maybe

Re: Noob questions about Python

2007-10-18 Thread Arnaud Delobelle
On Oct 18, 7:06 am, Ixiaus <[EMAIL PROTECTED]> wrote: [...] > I know '<<' is shifting x over by n bits; but could you point me to > some literature that would explain why it is the same as "x*2**n"? I haven't got literature but I've got a (hopefully straightforward) explanation: In binary 2 is 10

Re: Best way to generate alternate toggling values in a loop?

2007-10-18 Thread Luis Zarrabeitia
On Thursday 18 October 2007 09:09, Grant Edwards wrote: > I like the solution somebody sent me via PM: > > def toggle(): > while 1: > yield "Even" > yield "Odd" > That was me. Sorry, list, I meant to send it to everyone but I my webmail didn't respect the list* headers :(. Th

Re: Convert string to command..

2007-10-18 Thread Bruno Desthuilliers
Abandoned a écrit : (snip) > I'm very confused :( > I try to explain main problem... > I have a table like this: > id-1 | id-2 | value > 23 24 34 > 56 68 66 > 56 98 32455 > 55 62 655 > 56 28 123 > ( 3 millions elements) > > I select where id=5

Re: Convert string to command..

2007-10-18 Thread Bruno Desthuilliers
Richard Brodie a écrit : > "Matimus" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >> I think several people have given you the correct answer, but for some >> reason you aren't getting it. Instead of saving the string >> representation of a dictionary to the database... > > Mi

Re: Convert string to command..

2007-10-18 Thread Bruno Desthuilliers
Abandoned a écrit : (snip) > import cPickle as pickle > a="{2:3,4:6,2:7}" > s=pickle.dumps(a, -1) > g=pickle.loads(s); > print g > '{2:3,4:6,2:7}' > > Thank you very much for your answer but result is a string ?? > Of course it's a string. That's what you pickled. What did you hope ? If you want

Re: Convert string to command..

2007-10-18 Thread Bruno Desthuilliers
Abandoned a écrit : > On Oct 18, 6:51 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >> On Thu, 18 Oct 2007 08:41:30 -0700, Abandoned wrote: >>> import cPickle as pickle >>> a="{2:3,4:6,2:7}" >>> s=pickle.dumps(a, -1) >>> g=pickle.loads(s); >>> print g >>> '{2:3,4:6,2:7}' >>> Thank you ver

Re: python logging module and custom handler specified in config file

2007-10-18 Thread Vinay Sajip
On 15 Oct, 15:15, Frank Aune <[EMAIL PROTECTED]> wrote: > What I'm wondering, is if its possible to specify the database handler in a > config file like: > > [handler_database] > class=DBHandler > level=DEBUG > formatter=database > args=('localhost', uid='root') > > I've seen the log_test14.py exam

Re: Convert string to command..

2007-10-18 Thread Richard Brodie
"Matimus" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I think several people have given you the correct answer, but for some > reason you aren't getting it. Instead of saving the string > representation of a dictionary to the database... Mind you, if this were Jeopardy, "Store

Re: CGI and external JavaScript nightmare

2007-10-18 Thread Paul Boddie
On 18 Okt, 17:24, Steve Holden <[EMAIL PROTECTED]> wrote: > allen.fowler wrote: [Quoting IamIan...] > >> One CGI question - since all of my CGIs are spitting out HTML is their > >> source code safe? wget and linking to the source deliver the output > >> HTML. Are there any other methods of trying

Re: Convert string to command..

2007-10-18 Thread Sebastian Bassi
On 10/18/07, Adam Atlas <[EMAIL PROTECTED]> wrote: > > Use the builtin function "eval". What is the difference with os.system()? -- Sebastián Bassi (セバスティアン). Diplomado en Ciencia y Tecnología. Curso Biologia molecular para programadores: http://tinyurl.com/2vv8w6 GPG Fingerprint: 9470 0980 620D

Re: Convert string to command..

2007-10-18 Thread Abandoned
On Oct 18, 7:40 pm, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > Abandoned <[EMAIL PROTECTED]> writes: > > Sorry i can't understand :( > > Yes my database already has data in the "{..}" format and i select > > this and i want to use it for dictionary.. > > But, do you use Python to create that data?

Fwd: Pyinotify : which user ?

2007-10-18 Thread Roc Zhou
-- Forwarded message -- From: Roc Zhou <[EMAIL PROTECTED]> Date: Oct 19, 2007 12:48 AM Subject: Re: Pyinotify : which user ? To: Sébastien Weber <[EMAIL PROTECTED]> The command lsof or fuser can report who is using the file, maybe you can have a look at their source code, but they

Re: Convert string to command..

2007-10-18 Thread Hrvoje Niksic
Abandoned <[EMAIL PROTECTED]> writes: > Sorry i can't understand :( > Yes my database already has data in the "{..}" format and i select > this and i want to use it for dictionary.. But, do you use Python to create that data? If so, simply convert it to pickle binary format instead of "{...}".

Re: some questions about Python and tkinter

2007-10-18 Thread fabdeb
On Oct 16, 9:17 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Tue, 16 Oct 2007 11:52:22 -0700, fabdeb wrote: > > the first: what is the differences between a function and a classe? > > A class bundles data and functions into one object. > > > In which case i should use a function ? >

Re: strptime and microseconds

2007-10-18 Thread mathieu
On Oct 18, 6:36 pm, mathieu <[EMAIL PROTECTED]> wrote: > On Oct 18, 6:00 pm, mathieu <[EMAIL PROTECTED]> wrote: > > > > > Hi there, > > > I am trying to use strptime to parse my microseconds but I was not > > able the documentation for it. The only list I found was: > > > http://docs.python.org/

Re: Convert string to command..

2007-10-18 Thread Matimus
On Oct 18, 9:09 am, Abandoned <[EMAIL PROTECTED]> wrote: > On Oct 18, 6:57 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > > > > Abandoned wrote: > > > On Oct 18, 6:35 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > >> Abandoned wrote: > > >> > On Oct 18, 6:14 pm, "Diez B. Roggisch" <[E

Re: strptime and microseconds

2007-10-18 Thread mathieu
On Oct 18, 6:00 pm, mathieu <[EMAIL PROTECTED]> wrote: > Hi there, > > I am trying to use strptime to parse my microseconds but I was not > able the documentation for it. The only list I found was: > > http://docs.python.org/lib/module-time.html > > So I can get seconds with %S, but nowhere is

Re: Convert string to command..

2007-10-18 Thread Hrvoje Niksic
Abandoned <[EMAIL PROTECTED]> writes: > I select where id=56 and 100.000 rows are selecting but this took 2 > second. (very big for my project) > I try cache to speed up this select operation.. > And create a cache table: > id-1 | all > 56{68:66, 98:32455, 62:655} If you use Python to create

Re: Convert string to command..

2007-10-18 Thread Abandoned
On Oct 18, 7:02 pm, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > Abandoned <[EMAIL PROTECTED]> writes: > > import cPickle as pickle > > a="{2:3,4:6,2:7}" > > s=pickle.dumps(a, -1) > > g=pickle.loads(s); > > print g > > '{2:3,4:6,2:7}' > > > Thank you very much for your answer but result is a string ?

Re: Convert string to command..

2007-10-18 Thread Hrvoje Niksic
Abandoned <[EMAIL PROTECTED]> writes: > import cPickle as pickle > a="{2:3,4:6,2:7}" > s=pickle.dumps(a, -1) > g=pickle.loads(s); > print g > '{2:3,4:6,2:7}' > > Thank you very much for your answer but result is a string ?? Because you gave it a string. If you give it a dict, you'll get a dict:

Re: Convert string to command..

2007-10-18 Thread Abandoned
On Oct 18, 6:57 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Abandoned wrote: > > On Oct 18, 6:35 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> Abandoned wrote: > >> > On Oct 18, 6:14 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> >> Abandoned wrote: > >> >> > Thanks you all

strptime and microseconds

2007-10-18 Thread mathieu
Hi there, I am trying to use strptime to parse my microseconds but I was not able the documentation for it. The only list I found was: http://docs.python.org/lib/module-time.html So I can get seconds with %S, but nowhere is there a microsecond symbol... Thanks for pointer to doc, -Mathieu

Pyinotify : which user ?

2007-10-18 Thread Sébastien Weber
Hello, I'm actually writing an application with pyinotify which watchs a directory. Pyinotify lets me know the events (access, modify, suppression, etc.) on and in the directory, but not the users who are responsable of them. Does someone know a library which could give me that information (who'

Re: Convert string to command..

2007-10-18 Thread Diez B. Roggisch
Abandoned wrote: > On Oct 18, 6:35 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> Abandoned wrote: >> > On Oct 18, 6:14 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> >> Abandoned wrote: >> >> > Thanks you all answer.. >> >> > But "eval" is very slow at very big dictionary {2:3,4:5,6:1

version 1.4 of scalar class released

2007-10-18 Thread [EMAIL PROTECTED]
Version 1.4 of my scalar class is available at http://RussP.us/scalar.htm No major changes. I have corrected the "repr" function to make it more useful, and I have added a "unit_type" function that returns the type of a unit (e.g., time, length, force). The unit_type function is intended mainly f

Re: Convert string to command..

2007-10-18 Thread Abandoned
On Oct 18, 6:51 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Thu, 18 Oct 2007 08:41:30 -0700, Abandoned wrote: > > import cPickle as pickle > > a="{2:3,4:6,2:7}" > > s=pickle.dumps(a, -1) > > g=pickle.loads(s); > > print g > > '{2:3,4:6,2:7}' > > > Thank you very much for your answe

Re: Convert string to command..

2007-10-18 Thread Marc 'BlackJack' Rintsch
On Thu, 18 Oct 2007 08:41:30 -0700, Abandoned wrote: > import cPickle as pickle > a="{2:3,4:6,2:7}" > s=pickle.dumps(a, -1) > g=pickle.loads(s); > print g > '{2:3,4:6,2:7}' > > Thank you very much for your answer but result is a string ?? In Python terms yes, strings in Python can contain any by

Re: Convert string to command..

2007-10-18 Thread Abandoned
On Oct 18, 6:35 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Abandoned wrote: > > On Oct 18, 6:14 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> Abandoned wrote: > >> > Thanks you all answer.. > >> > But "eval" is very slow at very big dictionary {2:3,4:5,6:19} > >> > (100.000 el

Re: Convert string to command..

2007-10-18 Thread Abandoned
On Oct 18, 6:26 pm, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > Abandoned <[EMAIL PROTECTED]> writes: > > 173.000 dict elements and it tooks 2.2 seconds this very big time > > for my project > > If you're generating the string from Python, use cPickle instead. > Much faster: > > >>> import time > >>

Re: Convert string to command..

2007-10-18 Thread Diez B. Roggisch
Abandoned wrote: > On Oct 18, 6:14 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> Abandoned wrote: >> > Thanks you all answer.. >> > But "eval" is very slow at very big dictionary {2:3,4:5,6:19} >> > (100.000 elements) >> > Is there any easy alternative ? >> >> How big? How slow? For me,

Re: Convert string to command..

2007-10-18 Thread Hrvoje Niksic
Abandoned <[EMAIL PROTECTED]> writes: > 173.000 dict elements and it tooks 2.2 seconds this very big time > for my project If you're generating the string from Python, use cPickle instead. Much faster: >>> import time >>> d = dict((i, i+1) for i in xrange(17)) >>> len(d) 17 >>> s=repr(d)

Re: CGI and external JavaScript nightmare

2007-10-18 Thread Steve Holden
allen.fowler wrote: >> One CGI question - since all of my CGIs are spitting out HTML is their >> source code safe? wget and linking to the source deliver the output >> HTML. Are there any other methods of trying to steal the source CGI I >> need to protect against? >> >> Thank you. > > Not sure I

Re: open remote terminal

2007-10-18 Thread Steve Holden
Fabian Braennstroem wrote: > Hi, > > I would like to use python to start an terminal, e.g. xterm, and login on a > remote machine using rsh or ssh. This could be done using 'xterm -e ssh > machine', but after the login I would like to jump to a given directory. > Does anyone have an idea how to do

Re: Convert string to command..

2007-10-18 Thread Abandoned
On Oct 18, 6:14 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Abandoned wrote: > > Thanks you all answer.. > > But "eval" is very slow at very big dictionary {2:3,4:5,6:19} > > (100.000 elements) > > Is there any easy alternative ? > > How big? How slow? For me, a 1-element list takes

Re: Convert string to command..

2007-10-18 Thread Diez B. Roggisch
Abandoned wrote: > Thanks you all answer.. > But "eval" is very slow at very big dictionary {2:3,4:5,6:19} > (100.000 elements) > Is there any easy alternative ? How big? How slow? For me, a 1-element list takes 0.04 seconds to be parsed. Which I find fast. Diez -- http://mail.python.o

Re: Convert string to command..

2007-10-18 Thread Abandoned
Thanks you all answer.. But "eval" is very slow at very big dictionary {2:3,4:5,6:19} (100.000 elements) Is there any easy alternative ? -- http://mail.python.org/mailman/listinfo/python-list

Re: pymssql - insert NULL to int

2007-10-18 Thread Diez B. Roggisch
rc wrote: > On Oct 17, 11:07 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> rc wrote: >> > How to insert NULL values in to int field using params. >> >> > I'm trying to use pymssql.execute, passing the operation and list of >> > params. One of the values in the params is a NULL value going

Re: Pull Last 3 Months

2007-10-18 Thread Hyuga
On Oct 18, 12:25 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > I prefer the calendar module in that case: > > py> import locale > py> locale.setlocale(locale.LC_ALL, '') > 'Spanish_Argentina.1252' > py> > py> import calendar > py> calendar.month_abbr[12] > 'Dic' > py> def prev_months(since,

Re: Convert string to command..

2007-10-18 Thread Diez B. Roggisch
Abandoned wrote: > I want to convert a string to command.. > For example i have a string: > a="['1']" > I want to do this list.. > How can i do ? The correct wording here would be expression. To evaluate expressions, there is the function eval: a = eval("['1']") But beware: if the expression co

Re: Convert string to command..

2007-10-18 Thread Adam Atlas
On Oct 18, 10:23 am, Abandoned <[EMAIL PROTECTED]> wrote: > I want to convert a string to command.. > For example i have a string: > a="['1']" > I want to do this list.. > How can i do ? Use the builtin function "eval". -- http://mail.python.org/mailman/listinfo/python-list

Convert string to command..

2007-10-18 Thread Abandoned
I want to convert a string to command.. For example i have a string: a="['1']" I want to do this list.. How can i do ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to generate alternate toggling values in a loop?

2007-10-18 Thread cokofreedom
On Oct 18, 3:48 pm, Iain King <[EMAIL PROTECTED]> wrote: > On Oct 18, 2:29 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > > > > > On 2007-10-17, Debajit Adhikary <[EMAIL PROTECTED]> wrote: > > > > # Start of Code > > > > def evenOdd(): > > > values = ["Even", "Odd"] > > > state = 0 > > >

  1   2   >