Re: Why Doesn't This MySQL Statement Execute?

2012-12-18 Thread Chris Angelico
On Wed, Dec 19, 2012 at 2:57 PM, John Gordon wrote: > In Tom Borkin > writes: > >> Actually, what I originally had was: >> cursor.execute("""insert into interactions values(Null, %s, "Call Back", >> %s)""", (i_id, date_plus_2)) >> and that didn't work, either. I tried your variation like: >> cu

Re: where to view open() function's C implementation source code �

2012-12-18 Thread rurpy
On 12/18/2012 04:55 PM, iMath wrote: > > 在 2012年12月19日星期三UTC+8上午4时57分37秒,ru...@yahoo.com写道: > >[...] >> >> There is no need to download the source. You can browse the >> >> source code online. For the v3.0.0 version of open(): >> >> hg.python.org/cpython/file/bd

Re: Why Doesn't This MySQL Statement Execute?

2012-12-18 Thread John Gordon
In Tom Borkin writes: > Actually, what I originally had was: > cursor.execute("""insert into interactions values(Null, %s, "Call Back", > %s)""", (i_id, date_plus_2)) > and that didn't work, either. I tried your variation like: > cursor.execute("""insert into interactions values(Null, %s, "Call

Re: Is it possible monkey patch like this?

2012-12-18 Thread Steven D'Aprano
On Tue, 18 Dec 2012 02:26:42 -0800, Marc Aymerich wrote: > Dear all, > I want to monkey patch a method that has lots of code so I want to avoid > copying all the original method for changing just two lines. The thing > is that I don't know how to do this kind of monkey patching. The only types of

Re: Why Doesn't This MySQL Statement Execute?

2012-12-18 Thread Tom Borkin
Actually, what I originally had was: cursor.execute("""insert into interactions values(Null, %s, "Call Back", %s)""", (i_id, date_plus_2)) and that didn't work, either. I tried your variation like: cursor.execute("""insert into interactions values(Null, %s, "Call Back", %s)""" % (i_id, date_plus_2)

Re: where to view open() function's C implementation source code �

2012-12-18 Thread iMath
在 2012年12月19日星期三UTC+8上午4时57分37秒,ru...@yahoo.com写道: > On Monday, December 17, 2012 10:35:58 PM UTC-7, Roy Smith wrote: > > > iMath wrote: > > > > where to view open() function's C implementation source code ? > > > http://www.python.org/download/releases/ > >

Re: where to view open() function's C implementation source code �

2012-12-18 Thread iMath
在 2012年12月19日星期三UTC+8上午4时57分37秒,ru...@yahoo.com写道: > On Monday, December 17, 2012 10:35:58 PM UTC-7, Roy Smith wrote: > > > iMath wrote: > > > > where to view open() function's C implementation source code ? > > > http://www.python.org/download/releases/ > >

Re: Why Doesn't This MySQL Statement Execute?

2012-12-18 Thread Hans Mulder
On 18/12/12 22:34:08, Tom Borkin wrote: > Hi; > I have this test code: > > if i_id == "1186": > sql = 'insert into interactions values(Null, %s, "Call Back", > "%s")' % (i_id, date_plus_2) > cursor.execute(sql) > db.commit() > print sql > It prints the sql statement, b

Re: os.system and subprocess odd behavior

2012-12-18 Thread Cameron Simpson
On 18Dec2012 05:39, Dave Angel wrote: | On 12/18/2012 05:27 AM, Hans Mulder wrote: | > On 18/12/12 06:10:43, photonym...@gmail.com wrote: | >> I hope I understand the question... but shouldn't you wait for the process to complete before exiting? | >> | >> Something like: | >> | >> pid = subproces

Re: os.system and subprocess odd behavior

2012-12-18 Thread Hans Mulder
On 17/12/12 21:56:50, py_genetic wrote: > /usr/local/Calpont/mysql/bin/mysql > --defaults-file=/usr/local/Calpont/mysql/my.cnf -u root myDB < > /home/myusr/jobs/APP_JOBS/JOB_XXX.SQL > /home/myusr/jobs/APP_JOBS/JOB_XXX.TXT If you're trying to interact with a MySQL database, then you should really

Re: Why Doesn't This MySQL Statement Execute?

2012-12-18 Thread Chris Angelico
On Wed, Dec 19, 2012 at 9:28 AM, Tom Borkin wrote: > No (lol). It returns a date as a string: "2012-12-12" for example. > Tom Then that's why it doesn't work. Wayne was hinting at a major MAJOR problem with your code; it's interpolating data into the SQL statement, instead of providing parameters

Re: Why Doesn't This MySQL Statement Execute?

2012-12-18 Thread Tom Borkin
No (lol). It returns a date as a string: "2012-12-12" for example. Tom On Tue, Dec 18, 2012 at 6:02 PM, Wayne Werner wrote: > On Tue, 18 Dec 2012, Tom Borkin wrote: > > Hi; >> I have this test code: >> >> if i_id == "1186": >> sql = 'insert into interactions values(Null, %s, "Call Ba

Re: Why Doesn't This MySQL Statement Execute?

2012-12-18 Thread Wayne Werner
On Tue, 18 Dec 2012, Tom Borkin wrote: Hi; I have this test code:       if i_id == "1186":   sql = 'insert into interactions values(Null, %s, "Call Back", "%s")' % (i_id, date_plus_2)   cursor.execute(sql)   db.commit()   print sql It prints the sql statement, but it doesn't exe

Why Doesn't This MySQL Statement Execute?

2012-12-18 Thread Tom Borkin
Hi; I have this test code: if i_id == "1186": sql = 'insert into interactions values(Null, %s, "Call Back", "%s")' % (i_id, date_plus_2) cursor.execute(sql) db.commit() print sql It prints the sql statement, but it doesn't execute. If I copy and paste the sql into the m

Re: where to view open() function's C implementation source code �

2012-12-18 Thread rurpy
On Tuesday, December 18, 2012 1:57:37 PM UTC-7, ru...@yahoo.com wrote: >[...] > source code online. For the v3.0.0 version of open(): > hg.python.org/cpython/file/bd8afb90ebf2/Modules/_io/_iomodule.c oops, that should have been: http://hg.python.org/cpython/file/bd8afb90ebf2/Modules/_io/_iom

Re: where to view open() function's C implementation source code �

2012-12-18 Thread rurpy
On Monday, December 17, 2012 10:35:58 PM UTC-7, Roy Smith wrote: > iMath wrote: > > where to view open() function's C implementation source code ? > http://www.python.org/download/releases/ > Download the source for the version you're interested in. iMath: There is no need to download the sou

Re: os.system and subprocess odd behavior

2012-12-18 Thread py_genetic
Solved the issue, by injecting the query into the cmd line. Shell script worked fine as if I was cutting and pasting to the prompt. Seems to still be something with the subprocess receiving and exit code before or when the query finishes, just when I ask to to read from the .SQL file. example

Re: py2exe is on Sourceforge list of top growth projects

2012-12-18 Thread Vlastimil Brom
2012/12/18 Colin J. Williams : ... > Yes, but py2exe appears limited to Python 2.6. > > PyInstaller is another option with similar functionality. > > Colin W. > -- > http://mail.python.org/mailman/listinfo/python-list There are versions for python 2.3 - 2.7: http://sourceforge.net/projects/py2exe/

Re: where to view open() function's C implementation source code ?

2012-12-18 Thread Andrew Robinson
On 12/18/2012 07:03 AM, Chris Angelico wrote: On Wed, Dec 19, 2012 at 1:28 AM, Roy Smith wrote: In article, iMath wrote: Download the source for the version you're interested in. but which python module is open() in ? I met you half-way, I showed you where the source code is. Now you ne

Re: py2exe is on Sourceforge list of top growth projects

2012-12-18 Thread Colin J. Williams
On 18/12/2012 1:52 AM, Frank Millman wrote: This is from Sourceforge's monthly update - Top Growth Projects We're always on the lookout for projects that might be doing interesting things, and a surge in downloads is one of many metrics that we look at to identify them. Here's the projects th

Re: os.system and subprocess odd behavior

2012-12-18 Thread Oscar Benjamin
Can you trim content and interleave your response (instead of top-posting) please? On 18 December 2012 18:26, py_genetic wrote: > HOWEVER... > > when using this command from before no dice > > /usr/local/Calpont/mysql/bin/mysql > --defaults-file=/usr/local/Calpont/mysql/my.cnf -u root myDB <

Re: os.system and subprocess odd behavior

2012-12-18 Thread py_genetic
Oscar I can confirm this behavior from terminal. AND this works as well, simulating exactly what I'm doing permissions wise, and calling sudo python test.py below f1 = open('TESTDIR/file1.txt', 'w') f1.write('some test here\n') f1.close() cmd1 = 'cat < TESTDIR/file1.txt > TESTDIR/file2.txt' P

Re: Is it possible monkey patch like this?

2012-12-18 Thread Terry Reedy
On 12/18/2012 5:26 AM, Marc Aymerich wrote: I want to monkey patch a method that has lots of code so I want to avoid copying all the original method for changing just two lines. You omitted the most important piece of information. Can you modify the original code (or get someone else to do so

Re: I need help with graphs in python (2.7.3.1)

2012-12-18 Thread Terry Reedy
On 12/18/2012 6:29 AM, hevymet...@gmail.com wrote: Hi there, I hope that there is someone willing to help me out, I need to generate a graph in Python 2.7.3.1, There is only 2.7.3, no 2.7.3.1, at least not officially. I had to make a .CSV file from my Windows system logs (already did that), a

Re: Delete dict and subdict items of some name

2012-12-18 Thread Terry Reedy
On 12/18/2012 10:27 AM, Gnarlodious wrote: On Tuesday, December 18, 2012 3:31:41 AM UTC-7, Hans Mulder wrote: On 18/12/12 06:30:48, Gnarlodious wrote: from plistlib import readPlist I do not see this used below. def explicate(listDicts): for dict in listDicts: if '

Re: [newbie] problem making equally spaced value array with linspace

2012-12-18 Thread Dave Angel
On 12/18/2012 07:37 AM, Jean Dubois wrote: > I have trouble with the code beneath to make an array with equally > spaced values > When I enter 100e-6 as start value, 700e-6 as end value and 100e-6 I > get the following result: > [ 0.0001 0.00022 0.00034 0.00046 0.00058 0.0007 ] > But I was ho

Re: Delete dict and subdict items of some name

2012-12-18 Thread Gnarlodious
On Tuesday, December 18, 2012 3:31:41 AM UTC-7, Hans Mulder wrote: > On 18/12/12 06:30:48, Gnarlodious wrote: > > > This problem is solved, I am so proud of myself for figuring it out! > > > After reading some of these ideas I discovered the plist is really > > > lists underneath any "Children"

Re: where to view open() function's C implementation source code ?

2012-12-18 Thread Chris Angelico
On Wed, Dec 19, 2012 at 1:28 AM, Roy Smith wrote: > In article , > iMath wrote: >> > Download the source for the version you're interested in. >> >> but which python module is open() in ? > > I met you half-way, I showed you where the source code is. Now you > need to come the other half and l

Re: where to view open() function's C implementation source code ?

2012-12-18 Thread Roy Smith
In article , iMath wrote: > � 2012”N12ŒŽ18“��Š�“�UTC+8‰�Œ�1时35分58秒,Roy > Smith写道: > > In article , > > > > iMath wrote: > > > > > > > > > where to view open() function's C implementation

Re: problem making equally spaced value array with linspace

2012-12-18 Thread Jean Dubois
On 18 dec, 14:09, Peter Otten <__pete...@web.de> wrote: > Jean Dubois wrote: > > I have trouble with the code beneath to make an array with equally > > spaced values > > When I enter 100e-6 as start value, 700e-6 as end value and 100e-6 I > > get the following result: > > [ 0.0001   0.00022  0.0003

Re: [newbie] problem making equally spaced value array with linspace

2012-12-18 Thread Alexander Blinne
Am 18.12.2012 13:37, schrieb Jean Dubois: > I have trouble with the code beneath to make an array with equally > spaced values > When I enter 100e-6 as start value, 700e-6 as end value and 100e-6 I > get the following result: > [ 0.0001 0.00022 0.00034 0.00046 0.00058 0.0007 ] > But I was hop

Re: [newbie] problem making equally spaced value array with linspace

2012-12-18 Thread Peter Otten
Jean Dubois wrote: > I have trouble with the code beneath to make an array with equally > spaced values > When I enter 100e-6 as start value, 700e-6 as end value and 100e-6 I > get the following result: > [ 0.0001 0.00022 0.00034 0.00046 0.00058 0.0007 ] > But I was hoping for: > [ 0.0001

[newbie] problem making equally spaced value array with linspace

2012-12-18 Thread Jean Dubois
I have trouble with the code beneath to make an array with equally spaced values When I enter 100e-6 as start value, 700e-6 as end value and 100e-6 I get the following result: [ 0.0001 0.00022 0.00034 0.00046 0.00058 0.0007 ] But I was hoping for: [ 0.0001 0.0002 0.0003 0.0004 0.0005 0.

Re: Is it possible monkey patch like this?

2012-12-18 Thread Peter Otten
Marc Aymerich wrote: > Dear all, > I want to monkey patch a method that has lots of code so I want to avoid > copying all the original method for changing just two lines. The thing is > that I don't know how to do this kind of monkey patching. > > Consider the following code: > > class Oringinal

Re: I need help with graphs in python (2.7.3.1)

2012-12-18 Thread Thomas Bach
Hi, Most of the tasks you have to do can be achieved quite easily with the standard library (except the plotting). On Tue, Dec 18, 2012 at 03:29:49AM -0800, hevymet...@gmail.com wrote: > These are some steps I need to do first before creating the graph: > - Get the name of a CSV file from an ini

Re: os.system and subprocess odd behavior

2012-12-18 Thread Hans Mulder
On 18/12/12 11:39:56, Dave Angel wrote: > On 12/18/2012 05:27 AM, Hans Mulder wrote: >> On 18/12/12 06:10:43, photonym...@gmail.com wrote: >>> I hope I understand the question... but shouldn't you wait for the process >>> to complete before exiting? >>> >>> Something like: >>> >>> pid = subprocess

I need help with graphs in python (2.7.3.1)

2012-12-18 Thread hevymetl07
Hi there, I hope that there is someone willing to help me out, I need to generate a graph in Python 2.7.3.1, but I am not that skilled with Python and I am completely stuck :( I had to make a .CSV file from my Windows system logs (already did that), and the following steps must bw written in th

Re: Is it possible monkey patch like this?

2012-12-18 Thread Chris Angelico
On Tue, Dec 18, 2012 at 9:26 PM, Marc Aymerich wrote: > Any other idea on how to monkey patch those two conditionals ? Would it be plausible to simply add a parameter to the function that controls its behaviour? It'd be a lot more readable than fiddling from the outside ever would. ChrisA -- ht

Re: os.system and subprocess odd behavior

2012-12-18 Thread Dave Angel
On 12/18/2012 05:27 AM, Hans Mulder wrote: > On 18/12/12 06:10:43, photonym...@gmail.com wrote: >> I hope I understand the question... but shouldn't you wait for the process >> to complete before exiting? >> >> Something like: >> >> pid = subprocess.Popen(...) >> pid.wait() >> >> Otherwise, it'll

Re: Delete dict and subdict items of some name

2012-12-18 Thread Hans Mulder
On 18/12/12 06:30:48, Gnarlodious wrote: > This problem is solved, I am so proud of myself for figuring it out! > After reading some of these ideas I discovered the plist is really > lists underneath any "Children" key: > > > from plistlib import readPlist > > def explicate(listDicts): > f

Re: os.system and subprocess odd behavior

2012-12-18 Thread Hans Mulder
On 18/12/12 06:10:43, photonym...@gmail.com wrote: > I hope I understand the question... but shouldn't you wait for the process to > complete before exiting? > > Something like: > > pid = subprocess.Popen(...) > pid.wait() > > Otherwise, it'll exit before the background process is done. Why w

Is it possible monkey patch like this?

2012-12-18 Thread Marc Aymerich
Dear all, I want to monkey patch a method that has lots of code so I want to avoid copying all the original method for changing just two lines. The thing is that I don't know how to do this kind of monkey patching. Consider the following code: class OringinalClass(object): def origina_metho

Re: where to view open() function's C implementation source code ?

2012-12-18 Thread Terry Reedy
On 12/18/2012 12:25 AM, iMath wrote: where to view open() function's C implementation source code ? depends on the python version. io in 3.x otherwise, it is a builtin -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list