Re: MySQL - "create table" creates malfunctioning tables

2013-01-24 Thread Walter Hurry
On Fri, 25 Jan 2013 07:55:06 +0100, F.R. wrote: > The other day, for unfathomable reasons, I lost control over tables > which I create. There was no concurrent change of anything on the > machine, such as an update. So I have no suspect. Does the following > action log suggest any recommendation t

MySQL - "create table" creates malfunctioning tables

2013-01-24 Thread F.R.
The other day, for unfathomable reasons, I lost control over tables which I create. There was no concurrent change of anything on the machine, such as an update. So I have no suspect. Does the following action log suggest any recommendation to experienced SQL programmers? 1. A table: mysql>

Re: Changing the font size of anOptionMenu widget

2013-01-24 Thread Rick Johnson
Ignoring the fact that the Tkinter.Optionmenu is by far the worst widget in the toolkit, not to mention that the whole idea of "Tkinter X_Variables" was a poor attempt to reuse code at the expense destroying the simple and intuitive interface of "get" and "set"; here is your answer: ## START

Inherent asyncore.dispatcher_with_send exception

2013-01-24 Thread nobody
Hi, I have a class ClientHandler(asyncore.dispatcher_with_send), it was running fine without calling any of my own classes. But it got following exception when I called my own class GetMyResponse inside the def handle_read(self). Not sure why it causes disturbance to asyncore.dispatcher_with_se

Re: using split for a string : error

2013-01-24 Thread Chris Angelico
On Fri, Jan 25, 2013 at 12:33 PM, Oscar Benjamin wrote: > I have solved similar situations with > sorted(filenames, key=lambda s: (len(s), s)) > which is better than lexicographical ordering for sorting integer > strings. It gets the _Int file wrong in this case (but I consider it > luck that

Need Pattern For Logging Into A Website

2013-01-24 Thread Tim Daneliuk
I need to write a Python script to do the following: - Connect to a URL and accept any certificate - self-signed or authoritative - Provide login name/password credentials - Fill in some presented fields - Hit a "Submit" button Why? Because I don't want to have to start a browser and do

Re: using split for a string : error

2013-01-24 Thread Oscar Benjamin
On 25 January 2013 01:11, Chris Angelico wrote: > On Fri, Jan 25, 2013 at 12:03 PM, Oscar Benjamin > wrote: >> On 24 January 2013 11:35, Chris Angelico wrote: >>> >>> It's usually fine to have int() complain about any non-numerics in the >>> string, but I must confess, I do sometimes yearn for a

Re: using split for a string : error

2013-01-24 Thread Chris Angelico
On Fri, Jan 25, 2013 at 12:03 PM, Oscar Benjamin wrote: > On 24 January 2013 11:35, Chris Angelico wrote: >> >> It's usually fine to have int() complain about any non-numerics in the >> string, but I must confess, I do sometimes yearn for atoi() semantics: >> atoi("123asd") == 123, and atoi("qqq"

Re: using split for a string : error

2013-01-24 Thread Chris Angelico
On Fri, Jan 25, 2013 at 11:20 AM, Steven D'Aprano wrote: > Chris Angelico wrote: > >> It's usually fine to have int() complain about any non-numerics in the >> string, but I must confess, I do sometimes yearn for atoi() semantics: >> atoi("123asd") == 123, and atoi("qqq") == 0. I've not seen a >>

Re: using split for a string : error

2013-01-24 Thread Oscar Benjamin
On 24 January 2013 11:35, Chris Angelico wrote: > > It's usually fine to have int() complain about any non-numerics in the > string, but I must confess, I do sometimes yearn for atoi() semantics: > atoi("123asd") == 123, and atoi("qqq") == 0. I've not seen a > convenient Python function for doing

Re: The best, friendly and easy use Python Editor.

2013-01-24 Thread Chris Angelico
On Fri, Jan 25, 2013 at 7:25 AM, Tim Chase wrote: > On 01/24/13 13:34, Leonard, Arah wrote: >>> >>> All true (especially the holy wars bit!). OP didn't (as far as >>> I can see) even say which OS he is using. Anyway, my suggestion >>> is generally that people use the editor with which they are >>>

RE: Dict comp help

2013-01-24 Thread Joseph L. Casale
> >>> data = [{'a': 'xx', 'b': 'yy', 'c': 'zz'},  {'a': 'dd', 'b': 'ee', 'c':  > >>> 'ff'}]  > >>> {d["a"]: d["c"] for d in data} > {'xx': 'zz', 'dd': 'ff'} Priceless, That is exactly what I needed, for which I certainly over complicated! Thanks everyone! jlc -- http://mail.python.org/mailman/

Re: Dict comp help

2013-01-24 Thread Rob Day
On 24 January 2013 21:11, Oscar Benjamin wrote: l = [{'a': 'xx', 'b': 'yy', 'c': 'zz'}, {'a': 'dd', 'b': 'ee', 'c': 'ff'}] dict(d.values()[:2] for d in l) > {'xx': 'zz', 'dd': 'ff'} Python doesn't guarantee any ordering of items in a dictionary; {'a': 'xx', 'b': 'yy', 'c': 'zz'}.values(

RE: Dict comp help

2013-01-24 Thread Leonard, Arah
> Hi, > Slightly different take on an old problem, I have a list of dicts, I need to > build one dict from this based on two values from each dict in the list. Each > of the dicts in the list have similar key names, but values of course differ. > > > [{'a': 'xx', 'b': 'yy', 'c': 'zz'},  {'a': '

Re: The best, friendly and easy use Python Editor.

2013-01-24 Thread Kayode Odeyemi
Simply use Netbeans On Thu, Jan 24, 2013 at 10:09 PM, llanitedave wrote: > On Thursday, January 24, 2013 7:54:55 AM UTC-8, rusi wrote: > > > > > [I personally use emacs. It would be sadistic to make that into a > > > > recommendation] > > Lol! That's just too true. It's also true for Eclipse, w

Re: Dict comp help

2013-01-24 Thread Peter Otten
Joseph L. Casale wrote: > Slightly different take on an old problem, I have a list of dicts, I need > to build one dict from this based on two values from each dict in the > list. Each of the dicts in the list have similar key names, but values of > course differ. > > > [{'a': 'xx', 'b': 'yy', '

Re: The best, friendly and easy use Python Editor.

2013-01-24 Thread Tetsuya
On 01/24/2013 04:51 PM, John Gordon wrote: In Sharwan Joram writes: use vim. He said he wanted autocomplete. Does Vim have that? Vim has everything, you just need a bunch of plugins. I code mainly in python and django, and I use these plugins (among others): powerline (status bar indi

Re: The best, friendly and easy use Python Editor.

2013-01-24 Thread llanitedave
On Thursday, January 24, 2013 7:54:55 AM UTC-8, rusi wrote: > > [I personally use emacs. It would be sadistic to make that into a > > recommendation] Lol! That's just too true. It's also true for Eclipse, which I use very comfortably on Windows 7, but has proven to be a nightmare to set up o

Re: Dict comp help

2013-01-24 Thread Oscar Benjamin
On 24 January 2013 20:58, Joseph L. Casale wrote: > Hi, > Slightly different take on an old problem, I have a list of dicts, I need to > build one dict > from this based on two values from each dict in the list. Each of the dicts > in the list have > similar key names, but values of course diffe

Re: Dict comp help

2013-01-24 Thread Dave Angel
On 01/24/2013 03:58 PM, Joseph L. Casale wrote: Hi, Slightly different take on an old problem, I have a list of dicts, I need to build one dict from this based on two values from each dict in the list. Each of the dicts in the list have similar key names, but values of course differ. [{'a': '

Dict comp help

2013-01-24 Thread Joseph L. Casale
Hi, Slightly different take on an old problem, I have a list of dicts, I need to build one dict from this based on two values from each dict in the list. Each of the dicts in the list have similar key names, but values of course differ. [{'a': 'xx', 'b': 'yy', 'c': 'zz'},  {'a': 'dd', 'b': 'ee'

Re: Retrieving the full command line

2013-01-24 Thread Tim Golden
On 24/01/2013 20:01, Oscar Benjamin wrote: On 24 January 2013 17:13, Tim Golden wrote: A package-based module run via -m (python -m package.module) works as described (including the implicit __main__ module, my primary use-case). Does it work in the "python -m package.module" case? It looks t

RE: The best, friendly and easy use Python Editor.

2013-01-24 Thread Leonard, Arah
>> Sound advice. Most of the time I still use Visual Studio for editing >> Python because I also use it for C++, so it's just what I'm used to. >> No big deal, really. Whatever works is what works. It's just a text >> file after all. >> > > I assume you're using PyTools (http://pytools.code

Re: The best, friendly and easy use Python Editor.

2013-01-24 Thread Tim Chase
On 01/24/13 13:34, Leonard, Arah wrote: All true (especially the holy wars bit!). OP didn't (as far as I can see) even say which OS he is using. Anyway, my suggestion is generally that people use the editor with which they are already comfortable. Sound advice. [snip] Whatever works is what wo

Re: The best, friendly and easy use Python Editor.

2013-01-24 Thread Neil Cerutti
On 2013-01-24, Tim Chase wrote: > On 01/24/13 10:23, Thomas Heller wrote: >> Am 24.01.2013 16:54, schrieb rusi: >>> [I personally use emacs. It would be sadistic to make that into a >>> recommendation] >>> >> It would be truly sadistic to force a long-time emacs user to any >> other editor. > > I

Re: The best, friendly and easy use Python Editor.

2013-01-24 Thread Neil Cerutti
On 2013-01-24, John Gordon wrote: > In Sharwan Joram > writes: > >> use vim. > > He said he wanted autocomplete. Does Vim have that? Yes, you use its ctags support to get it working, I believe. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: The best, friendly and easy use Python Editor.

2013-01-24 Thread Dave Hirschfeld
Leonard, Arah bruker-axs.com> writes: > > > All true (especially the holy wars bit!). OP didn't (as far as I can see) > >even say which OS he is using. > Anyway, my suggestion is generally that people use the editor with which > > they are already comfortable. > > > > Sound advice. Most of

Re: Retrieving the full command line

2013-01-24 Thread Oscar Benjamin
On 24 January 2013 17:13, Tim Golden wrote: > On 24/01/2013 16:53, Oscar Benjamin wrote: >>> Does it work if you use the -m option to run a module rather than a script? >> >> Sorry that was written incorrectly. I meant to say: does it work when >> a module is directly on sys.path rather than as a

RE: The best, friendly and easy use Python Editor.

2013-01-24 Thread Leonard, Arah
> All true (especially the holy wars bit!). OP didn't (as far as I can see) > even say which OS he is using. Anyway, my suggestion is generally that people > use the editor with which they are already comfortable. > Sound advice. Most of the time I still use Visual Studio for editing Python b

Re: Python to send Midi commands to iPad via USB

2013-01-24 Thread rusi
On Jan 24, 3:31 pm, mikp...@gmail.com wrote: > Dear all, > > I am asking for a design/strategy suggestion. > > What I have to do is to write a Python application that will send MIDI > commands to an iPad application. > All I know is that the iPad application can be connected to an external Midi >

Re: The best, friendly and easy use Python Editor.

2013-01-24 Thread Walter Hurry
On Thu, 24 Jan 2013 22:10:21 +1100, Chris Angelico wrote: > On Thu, Jan 24, 2013 at 8:43 PM, Hazard Seventyfour > wrote: >> Hello, >> >> I new in this python and decided to learn more about it, so i can make >> an own script :), >> >> for all senior can you suggest me the best, friendly and easy

Search Engine optimization technique

2013-01-24 Thread Marlen Coner
jilltoler.com is a web blog where you can find WHAT IS Search Engine optimization, what is SEO Analytics, and how to you SEO tools and Importance of SEO Rankings. For more information please visit : http://www.jilltoler.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Increase value in hash table

2013-01-24 Thread Vito De Tullio
moonhkt wrote: > Data file > V1 > V2 > V3 > V4 > V4 > V3 > > How to using count number of data ? > > Output > V1 = 1 > V2 = 1 > V3 =2 > V4 = 2 import collections with open(data_file) as f: print(collections.Counter(f.readlines())) it's a start -- ZeD -- http://mail.python.org/mai

Re: mysql solution

2013-01-24 Thread Ferrous Cranus
Τη Πέμπτη, 24 Ιανουαρίου 2013 5:39:54 μ.μ. UTC+2, ο χρήστης Lele Gaifax έγραψε: > UPDATE visitors > >SET visitors.hits=visitors.hits+1, > >visitors.useros=%s, > >visitors.browser=%s, > >visitors.date=%s > > WHERE visitors.pin=(SELECT counters.pin > >

Re: monolithic apps

2013-01-24 Thread Ulrich Eckhardt
Am 24.01.2013 18:06, schrieb tamn...@gmail.com: Any suggestions for study?..: Is is possible to take a large executable with GUI and real time data and images, to extract modules, and it can run as if it looks like a monolithic application (windows over main windows, or images over other images)

Changing the font size of anOptionMenu widget

2013-01-24 Thread Angel
I am changing the font of an OptionMenu widget: w = OptionMenu(master, variable, "one", "two", "three") with w.configure() That changes the font of the widget but how can I change also the font (size) of the menu that appears when the mouse clicks it? Thanks in advandce, A. -- http://

Re: monolithic apps

2013-01-24 Thread Dave Angel
On 01/24/2013 12:06 PM, tamn...@gmail.com wrote: Any suggestions for study?..: Is is possible to take a large executable with GUI and real time data and images, to extract modules, and it can run as if it looks like a monolithic application (windows over main windows, or images over other ima

Re: The best, friendly and easy use Python Editor.

2013-01-24 Thread Andrew Gudovich
I think PyCharm is ideal for you. http://www.jetbrains.com/pycharm/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Retrieving the full command line

2013-01-24 Thread Tim Golden
On 24/01/2013 16:53, Oscar Benjamin wrote: >> Does it work if you use the -m option to run a module rather than a script? > > Sorry that was written incorrectly. I meant to say: does it work when > a module is directly on sys.path rather than as a submodule of a > package? In this case __package__

monolithic apps

2013-01-24 Thread tamnt54
Any suggestions for study?..: Is is possible to take a large executable with GUI and real time data and images, to extract modules, and it can run as if it looks like a monolithic application (windows over main windows, or images over other images) but is various python script driven modules ca

Re: The best, friendly and easy use Python Editor.

2013-01-24 Thread Tim Chase
On 01/24/13 10:23, Thomas Heller wrote: Am 24.01.2013 16:54, schrieb rusi: [I personally use emacs. It would be sadistic to make that into a recommendation] It would be truly sadistic to force a long-time emacs user to any other editor. I saw the recommendation for Vim elsewhere on the threa

Re: Retrieving the full command line

2013-01-24 Thread Oscar Benjamin
On 24 January 2013 16:08, Oscar Benjamin wrote: > On 24 January 2013 15:51, Tim Golden wrote: >> On 24/01/2013 15:28, Oscar Benjamin wrote: >>> On 24 January 2013 13:45, Tim Golden wrote: On 24/01/2013 11:30, Oscar Benjamin wrote: > I don't really understand what your spec is. Why do yo

Re: The best, friendly and easy use Python Editor.

2013-01-24 Thread Thomas Heller
Am 24.01.2013 16:54, schrieb rusi: [I personally use emacs. It would be sadistic to make that into a recommendation] It would be truly sadistic to force a long-time emacs user to any other editor. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Retrieving the full command line

2013-01-24 Thread Oscar Benjamin
On 24 January 2013 15:51, Tim Golden wrote: > On 24/01/2013 15:28, Oscar Benjamin wrote: >> On 24 January 2013 13:45, Tim Golden wrote: >>> On 24/01/2013 11:30, Oscar Benjamin wrote: I don't really understand what your spec is. Why do you need to inspect this information from sys.argv?

Re: The best, friendly and easy use Python Editor.

2013-01-24 Thread John Gordon
In Sharwan Joram writes: > use vim. He said he wanted autocomplete. Does Vim have that? -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb

Re: The best, friendly and easy use Python Editor.

2013-01-24 Thread Chris Angelico
On Fri, Jan 25, 2013 at 2:54 AM, rusi wrote: > - last expression with _ (underscore) Small terminology quibble: That's not last expression, but last non-None result. >>> 1+2 3 >>> _ 3 >>> _,None (3, None) >>> _ (3, None) >>> _[1] >>> _ (3, None) Otherwise, agree totally. Get to know the interac

Re: The best, friendly and easy use Python Editor.

2013-01-24 Thread rusi
On Jan 24, 2:43 pm, Hazard Seventyfour wrote: > Hello, > > I new in this python and decided to learn more about it, so i can make an own > script :), > > for all senior can you suggest me the best, friendly and easy use with nice > GUI editor for me, and have many a good features such as auto co

Re: Retrieving the full command line

2013-01-24 Thread Tim Golden
On 24/01/2013 15:28, Oscar Benjamin wrote: > On 24 January 2013 13:45, Tim Golden wrote: >> On 24/01/2013 11:30, Oscar Benjamin wrote: >>> I don't really understand what your spec is. Why do you need to >>> inspect this information from sys.argv? Can you not just always use >>> 'python -m pkg' as

Re: mysql solution

2013-01-24 Thread Lele Gaifax
Duncan Booth writes: > I'm not MySQL expert, but something like this might work: > > cursor.execute('''UPDATE visitors,counter > SET visitors.hits=visitors.hits+1, visitors.useros=%s, > visitors.browser =%s, visitors.date=%s > WHERE visitors.pin=counter.pin AND counter.page = %s > AND v

Re: The best, friendly and easy use Python Editor.

2013-01-24 Thread Sharwan Joram
On Thursday, January 24, 2013 8:42:19 PM UTC+5:30, John Gordon wrote: > In Hazard Seventyfour > writes: > > > > > Hello, > > > > > I new in this python and decided to learn more about it, so i can make > > > an own script :), > > > > > for all senior can you suggest me the best, friend

Re: Retrieving the full command line

2013-01-24 Thread Oscar Benjamin
On 24 January 2013 13:45, Tim Golden wrote: > On 24/01/2013 11:30, Oscar Benjamin wrote: >> I don't really understand what your spec is. Why do you need to >> inspect this information from sys.argv? Can you not just always use >> 'python -m pkg' as your entry point? > [SNIP] > > For completeness,

Re: mysql solution

2013-01-24 Thread Chris Angelico
On Fri, Jan 25, 2013 at 2:19 AM, Duncan Booth wrote: > Ferrous Cranus wrote: > >> I can do that but then i have to use that pin column's value in my >> next statement. >> >> cursor.execute( '''UPDATE visitors SET hits = hits + 1, useros = %s, >> browser = %s, date = %s WHERE pin = %s AND host = %

Re: mysql solution

2013-01-24 Thread Duncan Booth
Ferrous Cranus wrote: > I can do that but then i have to use that pin column's value in my > next statement. > > cursor.execute( '''UPDATE visitors SET hits = hits + 1, useros = %s, > browser = %s, date = %s WHERE pin = %s AND host = %s''', (useros, > browser, date, pin, host)) I'm not MySQL

Re: The best, friendly and easy use Python Editor.

2013-01-24 Thread John Gordon
In Hazard Seventyfour writes: > Hello, > I new in this python and decided to learn more about it, so i can make > an own script :), > for all senior can you suggest me the best, friendly and easy use with > nice GUI editor for me, and have many a good features such as auto > complete/auto cor

Re: anyone can make a Python bindings of VLC-Qt ?

2013-01-24 Thread Chris Angelico
On Fri, Jan 25, 2013 at 1:25 AM, iMath wrote: > > anyone can make a Python bindings of VLC-Qt ? > https://github.com/ntadej/vlc-qt > accurately, can anyone make a PyQt bindings of VLC-Qt ? Yes, someone can. Ideally, someone who knows C++, Python, VLC, and Qt, and has the time to port the code

Re: mysql solution

2013-01-24 Thread Chris Angelico
On Fri, Jan 25, 2013 at 12:31 AM, Ferrous Cranus wrote: > Τη Πέμπτη, 24 Ιανουαρίου 2013 1:16:51 μ.μ. UTC+2, ο χρήστης Chris Angelico > έγραψε: >> Glad you've listened to at least some of what you've been told. But if >> you want to be taken seriously on this list, I recommend going back to >> you

Re: mysql solution

2013-01-24 Thread Ferrous Cranus
Τη Πέμπτη, 24 Ιανουαρίου 2013 3:37:24 μ.μ. UTC+2, ο χρήστης Lele Gaifax έγραψε: > How? What's the error message/traceback? REURNING is not a correct mysql syntax thats why it produces errors. > If, as Chris said, MySQL does not support the “RETURNING” syntax, you > > cannot use that. I gave two

anyone can make a Python bindings of VLC-Qt ?

2013-01-24 Thread iMath
anyone can make a Python bindings of VLC-Qt ? https://github.com/ntadej/vlc-qt accurately, can anyone make a PyQt bindings of VLC-Qt ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Retrieving the full command line

2013-01-24 Thread Tim Golden
On 24/01/2013 11:30, Oscar Benjamin wrote: > I don't really understand what your spec is. Why do you need to > inspect this information from sys.argv? Can you not just always use > 'python -m pkg' as your entry point? Sorry about the confusion. I think my original point was simply one of surprise

Re: mysql solution

2013-01-24 Thread Lele Gaifax
Ferrous Cranus writes: > The following statement fails. > > [code] > cursor.execute( '''INSERT INTO counters(page, hits) VALUES(%s, %s) RETURNING > (pin) > ON DUPLICATE KEY UPDATE hits = hits + 1''', > (htmlpage, 1) ) > [/code] How? What's the error message/traceback?

Re: mysql solution

2013-01-24 Thread Ferrous Cranus
Τη Πέμπτη, 24 Ιανουαρίου 2013 1:16:51 μ.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: > On Thu, Jan 24, 2013 at 10:04 PM, Ferrous Cranus > wrote: > > > I;am now convinced the hash solution isn't reversible and also isn't unique. > > > I'am trying the database oriented solution. > > > > Glad yo

Re: mysql solution

2013-01-24 Thread Ferrous Cranus
column 'pin' is an 5-digit integer auto_increment primary key. What i want is to insert a new record or update the existing one, if 'pin' column's value exist. The following statement fails. [code] cursor.execute( '''INSERT INTO counters(page, hits) VALUES(%s, %s) RETURNING (pin)

Re: Python to send Midi commands to iPad via USB

2013-01-24 Thread Chris Angelico
On Thu, Jan 24, 2013 at 11:25 PM, wrote: > I think I am not lucky :-( > > $ aplaymidi -l > PortClient name Port name > 14:0Midi Through Midi Through Port-0 > > I get the same either the iPad is connected or not. > So I guess is not recognized. >

Re: Python to send Midi commands to iPad via USB

2013-01-24 Thread mikprog
[..] > > > ~$ pmidi -p 128:0 No.19.mid > > > Could not open file No.19.mid > > > > > > Doesn't that mean that the iPad is not seen? > > > Heya! That was just an example; I used track number 19 from the opera > > "Iolanthe" as my test file. Pick any other MIDI file you have handy. This is

Re: using split for a string : error

2013-01-24 Thread inshu chauhan
Thanks a lot people.. :).. :) On Thu, Jan 24, 2013 at 1:10 PM, Tobias M. wrote: > Am 24.01.2013 13:02, schrieb Chris Angelico: > > On Thu, Jan 24, 2013 at 10:58 PM, Tobias M. wrote: >> >>> Chris Angelico wrote: >>> I'd not consider the performance, but the correctness. If you're ex

Re: mysql solution

2013-01-24 Thread Lele Gaifax
Ferrous Cranus writes: > Τη Πέμπτη, 24 Ιανουαρίου 2013 1:25:20 μ.μ. UTC+2, ο χρήστης Lele Gaifax > έγραψε: Please, trim your response messages, cutting away useless details. > > I just tried this statement: > > == > cursor.execute( '''INSERT INTO counter

Re: using split for a string : error

2013-01-24 Thread Tobias M.
Am 24.01.2013 13:02, schrieb Chris Angelico: On Thu, Jan 24, 2013 at 10:58 PM, Tobias M. wrote: Chris Angelico wrote: I'd not consider the performance, but the correctness. If you're expecting them to be integers, just cast them, and specifically _don't_ catch ValueError. Any non-integer value

Re: using split for a string : error

2013-01-24 Thread Chris Angelico
On Thu, Jan 24, 2013 at 10:58 PM, Tobias M. wrote: > Chris Angelico wrote: >> >> I'd not consider the performance, but the correctness. If you're >> expecting them to be integers, just cast them, and specifically >> _don't_ catch ValueError. Any non-integer value will then noisily >> abort the scr

Re: mysql solution

2013-01-24 Thread Ferrous Cranus
Τη Πέμπτη, 24 Ιανουαρίου 2013 1:25:20 μ.μ. UTC+2, ο χρήστης Lele Gaifax έγραψε: > Ferrous Cranus writes: > > > > > I;am now convinced the hash solution isn't reversible and also isn't > > > unique. > > > > Great! > > > > > how is the mysql statement is going to find the 'pin' to update t

Re: using split for a string : error

2013-01-24 Thread Tobias M.
Chris Angelico wrote: I'd not consider the performance, but the correctness. If you're expecting them to be integers, just cast them, and specifically _don't_ catch ValueError. Any non-integer value will then noisily abort the script. (It may be worth checking for blank first, though, depending o

Re: Python to send Midi commands to iPad via USB

2013-01-24 Thread Chris Angelico
On Thu, Jan 24, 2013 at 10:48 PM, wrote: > Thanks for your help Chris! > forgive my ignorance, but I am not sure what you mean. > I've installed pmidi and what I get is: > > ~$ pmidi -p 128:0 No.19.mid > Could not open file No.19.mid > > Doesn't that mean that the iPad is not seen? Heya! That wa

Re: Python to send Midi commands to iPad via USB

2013-01-24 Thread mikprog
On Thursday, January 24, 2013 10:44:47 AM UTC, Chris Angelico wrote: [..] > > Are you able to hook into ALSA? I've had reasonable success driving a > > USB-MIDI cable using ALSA. See if you can do it with the inbuilt > > 'pmidi' app first: > > > > $ pmidi -p 128:0 No.19.mid > > > > (that u

Re: using split for a string : error

2013-01-24 Thread Chris Angelico
On Thu, Jan 24, 2013 at 10:16 PM, Tobias M. wrote: > Chris Angelico wrote: >> The other thing you may want to consider, if the values are supposed >> to be integers, is to convert them to Python integers before >> comparing. > > I thought of this too and I wonder if there are any major differences

Re: How do functions get access to builtins?

2013-01-24 Thread Steven D'Aprano
Rouslan Korneychuk wrote: > I found the answer in Python's source code. When you execute a code > object, PyFrame_New is called which gets 'bultins' from 'globals', but > inside PyFrame_New (defined on line 596 of Objects/frameobject.c) is the > following (line 613): > >builtins = PyDict_GetI

XML validation / exception.

2013-01-24 Thread Andrew Robinson
A quick question: On xml.etree, When I scan in a handwritten XML file, and there are mismatched tags -- it will throw an exception. and the exception will contain a line number of the closing tag which does not have a mate of the same kind. Is there a way to get the line number of the earlier

Re: Retrieving the full command line

2013-01-24 Thread Oscar Benjamin
On 24 January 2013 10:56, Tim Golden wrote: > On 24/01/2013 10:06, Oscar Benjamin wrote: >> On 24 January 2013 04:49, Steven D'Aprano >> wrote: >> [SNIP] >>> >>> Contrariwise, I don't believe that there is currently *any* way to >>> distinguish between running a script with or without -m. That sh

Re: using split for a string : error

2013-01-24 Thread Chris Angelico
On Thu, Jan 24, 2013 at 10:01 PM, inshu chauhan wrote: > Yeah I tried printing, there were trailing white spaces, so i used strip() > and IT Worked !!! :) Awesome! Keep repr() in mind, it's a great way to check what's really there. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: mysql solution

2013-01-24 Thread Chris Angelico
On Thu, Jan 24, 2013 at 10:25 PM, Lele Gaifax wrote: > The simplest way is to execute a SELECT just after the insertion, doing > a > > SELECT pin FROM counters WHERE page = %s > > I don't use MySQL, so I can't say if it supports "INSERT ... RETURNING ..." > SQL syntax: should it, then you could

Re: using split for a string : error

2013-01-24 Thread Tobias M.
Chris Angelico wrote: The other thing you may want to consider, if the values are supposed to be integers, is to convert them to Python integers before comparing. Currently, you're working with strings. Replace this: if sp[9] == sp[10]: with this: if int(sp[9]) == int(sp[10]): I thought of t

Re: mysql solution

2013-01-24 Thread Lele Gaifax
Ferrous Cranus writes: > I;am now convinced the hash solution isn't reversible and also isn't > unique. Great! > how is the mysql statement is going to find the 'pin' to update the > specific record. The simplest way is to execute a SELECT just after the insertion, doing a SELECT pin FROM c

Re: The best, friendly and easy use Python Editor.

2013-01-24 Thread Chris Angelico
On Thu, Jan 24, 2013 at 8:43 PM, Hazard Seventyfour wrote: > Hello, > > I new in this python and decided to learn more about it, so i can make an own > script :), > > for all senior can you suggest me the best, friendly and easy use with nice > GUI editor for me, and have many a good features su

Re: Retrieving the full command line

2013-01-24 Thread Tim Golden
On 24/01/2013 10:56, Tim Golden wrote: > if the package which is reconstructing the command line the package > which was the target of the original command line. Sorry: if the package which is reconstructing the command line *is not* the package which was the target of the original command l

Re: mysql solution

2013-01-24 Thread Chris Angelico
On Thu, Jan 24, 2013 at 10:04 PM, Ferrous Cranus wrote: > I;am now convinced the hash solution isn't reversible and also isn't unique. > I'am trying the database oriented solution. Glad you've listened to at least some of what you've been told. But if you want to be taken seriously on this list,

Re: using split for a string : error

2013-01-24 Thread inshu chauhan
On Thu, Jan 24, 2013 at 11:55 AM, Tobias M. wrote: > Hi, > > do a "print sp" after the split and you might see that the strings don't > look as you expected. There might be leading or trailing whitespaces in the > splitted strings and in sp[10] there probably is a line break "\n" at the > end. >

mysql solution

2013-01-24 Thread Ferrous Cranus
# insert new page record in table counters or update it if already exists try: cursor.execute( '''INSERT INTO counters(page, hits) VALUES(%s, %s) ON DUPLICATE KEY UPDATE hits = hits + 1''', (htmlpage, 1) )

Re: using split for a string : error

2013-01-24 Thread Chris Angelico
On Thu, Jan 24, 2013 at 9:37 PM, inshu chauhan wrote: > For me I think the programme is logically correct, but its giving me results > which are strange. > It is Printing " Different Class" even when sp[9] is equal to sp[10] and > "Same class" when sp[9] is not equal to sp[10]. and sp[9] and sp

Re: Retrieving the full command line

2013-01-24 Thread Tim Golden
On 24/01/2013 10:06, Oscar Benjamin wrote: > On 24 January 2013 04:49, Steven D'Aprano > wrote: > [SNIP] >> >> Contrariwise, I don't believe that there is currently *any* way to >> distinguish between running a script with or without -m. That should be >> fixed. > > As I said earlier in the threa

Re: using split for a string : error

2013-01-24 Thread Tobias M.
Hi, do a "print sp" after the split and you might see that the strings don't look as you expected. There might be leading or trailing whitespaces in the splitted strings and in sp[10] there probably is a line break "\n" at the end. To remove those unwanted characters you could use the strip()

Re: Any algorithm to preserve whitespaces?

2013-01-24 Thread Peter Otten
Santosh Kumar wrote: > But I can; see: http://pastebin.com/ZGGeZ71r You have messed with your cat command -- it adds line numbers. Therefore the output of cat somefile | ./argpa.py differs from ./argpa.py somefile Try ./argpa.py < somefile to confirm my analysis. As to why your capitalisati

Re: Python to send Midi commands to iPad via USB

2013-01-24 Thread Chris Angelico
On Thu, Jan 24, 2013 at 9:31 PM, wrote: > What I have to do is to write a Python application that will send MIDI > commands to an iPad application. > All I know is that the iPad application can be connected to an external Midi > deck through a usb cable and be controlled. > So I think I would c

Re: The best, friendly and easy use Python Editor.

2013-01-24 Thread mikprog
On Thursday, January 24, 2013 9:43:31 AM UTC, Hazard Seventyfour wrote: > Hello, > > > > I new in this python and decided to learn more about it, so i can make an own > script :), > > > > for all senior can you suggest me the best, friendly and easy use with nice > GUI editor for me, and ha

using split for a string : error

2013-01-24 Thread inshu chauhan
Here I have a code which basically reads a csv file, tries to compare the last 2 items in each line of the file. f = open(r"Z:\modules\Feature_Vectors_300_Pclass.arff") for l in f: sp = l.split(",") if len(sp) != 11: print >> of, l, else: #print sp[9], sp[10] i

Python to send Midi commands to iPad via USB

2013-01-24 Thread mikprog
Dear all, I am asking for a design/strategy suggestion. What I have to do is to write a Python application that will send MIDI commands to an iPad application. All I know is that the iPad application can be connected to an external Midi deck through a usb cable and be controlled. So I think I w

Re: Memory error with quadratic interpolation

2013-01-24 Thread Oscar Benjamin
On 23 January 2013 17:33, Isaac Won wrote: > On Wednesday, January 23, 2013 10:51:43 AM UTC-6, Oscar Benjamin wrote: >> On 23 January 2013 14:57, Isaac Won wrote: >> >> > On Wednesday, January 23, 2013 8:40:54 AM UTC-6, Oscar Benjamin wrote: >> >> Unless I've misunderstood how this function is su

Re: Any algorithm to preserve whitespaces?

2013-01-24 Thread Santosh Kumar
But I can; see: http://pastebin.com/ZGGeZ71r On 1/24/13, Peter Otten <__pete...@web.de> wrote: > Santosh Kumar wrote: > >> On 1/24/13, Peter Otten <__pete...@web.de> wrote: >>> Santosh Kumar wrote: >>> Yes, Peter got it right. Now, how can I replace: script, givenfile

Re: Retrieving the full command line

2013-01-24 Thread Oscar Benjamin
On 24 January 2013 04:49, Steven D'Aprano wrote: [SNIP] > > Contrariwise, I don't believe that there is currently *any* way to > distinguish between running a script with or without -m. That should be > fixed. As I said earlier in the thread, the __package__ module global distinguishes the two ca

The best, friendly and easy use Python Editor.

2013-01-24 Thread Hazard Seventyfour
Hello, I new in this python and decided to learn more about it, so i can make an own script :), for all senior can you suggest me the best, friendly and easy use with nice GUI editor for me, and have many a good features such as auto complete/auto correct. any recommend? Thanks ^_^ -- http://

Re: Any algorithm to preserve whitespaces?

2013-01-24 Thread Peter Otten
Santosh Kumar wrote: > On 1/24/13, Peter Otten <__pete...@web.de> wrote: >> Santosh Kumar wrote: >> >>> Yes, Peter got it right. >>> >>> Now, how can I replace: >>> >>> script, givenfile = argv >>> >>> with something better that takes argv[1] as input file as well as >>> reads input from stdin

Re: Any algorithm to preserve whitespaces?

2013-01-24 Thread Santosh Kumar
On 1/24/13, Peter Otten <__pete...@web.de> wrote: > Santosh Kumar wrote: > >> Yes, Peter got it right. >> >> Now, how can I replace: >> >> script, givenfile = argv >> >> with something better that takes argv[1] as input file as well as >> reads input from stdin. >> >> By input from stdin, I mea

Flatten an email Message with a non-ASCII body using 8bit CTE

2013-01-24 Thread W. Trevor King
Hello list! I'm trying to figure out how to flatten a MIMEText message to bytes using an 8bit Content-Transfer-Encoding in Python 3.3. Here's what I've tried so far: # -*- encoding: utf-8 -*- import email.encoders from email.charset import Charset from email.generator import BytesGenerat

  1   2   >