Re: [Tutor] A couple of somewhat esoteric questions

2014-10-22 Thread Dave Angel
Dave Angel Wrote in message: > "Clayton Kirkwood" Wrote in message: >> >> >> !-Original Message- >> !From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On >> !Behalf Of Steven D'Aprano > ... >> >> For clarification, a key only has one value which can be changed. > > No

Re: [Tutor] Passing Data to .DLL

2014-10-22 Thread eryksun
On Wed, Oct 22, 2014 at 6:05 PM, eryksun wrote: > from_buffer_copy is similar, accept instead of sharing the buffer That should be ex-cept (conjunction for an exception clause), not ac-cept (verb, to receive). I missed that in my initial proofread. It takes a while to clear my mental buffer enoug

Re: [Tutor] A couple of somewhat esoteric questions

2014-10-22 Thread Dave Angel
"Clayton Kirkwood" Wrote in message: > > > !-Original Message- > !From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On > !Behalf Of Steven D'Aprano ... > > For clarification, a key only has one value which can be changed. No, because the key has to be immutable, like a

Re: [Tutor] Python sqlite3 issue

2014-10-22 Thread Alan Gauld
On 22/10/14 23:30, Juan Christian wrote: The only thing left now is that the topics in this forum has a one/two weeks lifespan, and I think Steam reuses the same ID for new topics that was used in, lets say a 1 month-old topic In that case I'd go back to using a primary key ID set by SQLite an

Re: [Tutor] Passing Data to .DLL

2014-10-22 Thread eryksun
On Wed, Oct 22, 2014 at 3:50 PM, Wilson, Pete wrote: > I don't understand the line > rx_buf = (c_uint8 * rx_buf_size).from_buffer_copy(string_buf) A buffer is a block of memory used to pass data between functions, processes, or systems. Specifically its use as a 'buffer' comes from using a block

Re: [Tutor] Python sqlite3 issue

2014-10-22 Thread Juan Christian
On Wed, Oct 22, 2014 at 4:37 PM, Alan Gauld wrote: > > Incidentally you don't need the semi-colon inside the execute. It can only > execute the entire string so if there's only one command you > don't need the terminator. Ok, thanks! Note that this makes no checks for unique ID so you put the

Re: [Tutor] Insert time into email

2014-10-22 Thread Albert-Jan Roskam
On Mon, Oct 20, 2014 6:02 PM CEST Chris “Kwpolska” Warrick wrote: >On Mon, Oct 20, 2014 at 2:34 PM, Bo Morris wrote: >> hello all, hope everyone is doing well. >> >> The below code works, however I am going back and trying to enter the time >> and date and I cant qui

Re: [Tutor] Python sqlite3 issue

2014-10-22 Thread Alan Gauld
On 22/10/14 18:38, Juan Christian wrote: def ini_db(): db.execute(''' CREATE TABLE IF NOT EXISTS TOPICS( ID INTEGER NOT NULL, URL VARCHAR NOT NULL, AUTHOR VARCHAR NOT NULL, MESSAGE VARCHAR NOT N

Re: [Tutor] A couple of somewhat esoteric questions

2014-10-22 Thread Clayton Kirkwood
!-Original Message- !From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On !Behalf Of Steven D'Aprano !Sent: Wednesday, October 22, 2014 4:40 AM !To: tutor@python.org !Subject: Re: [Tutor] A couple of somewhat esoteric questions ! !On Tue, Oct 21, 2014 at 04:54:33PM -0700, C

Re: [Tutor] Python sqlite3 issue

2014-10-22 Thread Juan Christian
So guys, now I have this code that is fully working: import sqlite3 db = sqlite3.connect('db.sqlite') def ini_db(): db.execute(''' CREATE TABLE IF NOT EXISTS TOPICS( ID INTEGER NOT NULL, URL VARCHAR NOT NULL, AUTHOR VAR

Re: [Tutor] Question on a select statement with ODBC

2014-10-22 Thread Alan Gauld
On 22/10/14 16:06, Al Bull wrote: I don't think I explained the problem properly. I have several hundred thousand records in the ORD table. There are many instances of records with identical ORD_DBASUB values. Where duplicates exist, I only want to keep the most current record. Ah, OK th

Re: [Tutor] Question on a select statement with ODBC

2014-10-22 Thread Al Bull
-Original Message- From: Tutor [mailto:tutor-bounces+a.bull=pubdmgroup@python.org] On Behalf Of Alan Gauld Sent: Tuesday, October 21, 2014 6:42 PM To: tutor@python.org Subject: Re: [Tutor] Question on a select statement with ODBC On 21/10/14 19:57, Al Bull wrote: > have multiple reco

[Tutor] Insert time into email...final code

2014-10-22 Thread Bo Morris
Just in case anyone else can benefit from this, here is my working code up to this point #!/usr/bin/python import smtplib from email.MIMEMultipart import MIMEMultipart from email.MIMEText import MIMEText from email.MIMEImage import MIMEImage import time strFrom = "HourlyReport.com" strTo = "mye

Re: [Tutor] A couple of somewhat esoteric questions

2014-10-22 Thread Steven D'Aprano
On Tue, Oct 21, 2014 at 04:54:33PM -0700, Clayton Kirkwood wrote: > As I've contemplated the usage of dictionaries, I face the question of > efficiency. Going back before most of you were probably born;<)) if I > remember correctly dictionaries(assoc. arrays), having hashes, are efficient > for st

Re: [Tutor] Passing Data to .DLL

2014-10-22 Thread eryksun
On Tue, Oct 21, 2014 at 7:04 PM, Wilson, Pete wrote: > > ProcessIncomingSerialData_t = CFUNCTYPE(None, POINTER(c_uint8), c_uint16) > process_incoming_serial_data = pt_dll.ProcessIncomingSerialData > process_incoming_serial_data.argtypes = [ProcessIncomingSerialData_t] ProcessIncomingSerialData ta

Re: [Tutor] yet another misunderstanding on my part

2014-10-22 Thread Steven D'Aprano
On Tue, Oct 21, 2014 at 09:54:49PM -0700, Clayton Kirkwood wrote: > col_position, code, description = 0, [], [] > key_name = raw_table.replace('\t','\n') > for each_line in key_name.splitlines(): > if ':' in each_line: >code[col_position], description.append() = each_line.split(':') >

Re: [Tutor] yet another misunderstanding on my part

2014-10-22 Thread Alan Gauld
On 22/10/14 05:54, Clayton Kirkwood wrote: __author__ = 'SYSTEM' Its best not to invent your own dunder names. You might run into a problem if a future Python release decided to use the same name under the covers. import string Do you need this? Its very unusual these days to use the string

Re: [Tutor] A couple of somewhat esoteric questions

2014-10-22 Thread Alan Gauld
On 22/10/14 00:54, Clayton Kirkwood wrote: As I’ve contemplated the usage of dictionaries, I face the question of efficiency. Don;t worry about it. Python dictionaries are highly efficient and used throughout the language. namespaces and classes are both effectively dictionaries so every time

Re: [Tutor] Passing Data to .DLL

2014-10-22 Thread Alan Gauld
On 22/10/14 01:04, Wilson, Pete wrote: The python code is below.. ''' read_bat.py ''' You are using triple quoted strings as a commenting feature. Thats good practice where you want a docstring to appear in the help() screen but its not so good for comments like the above or where you are comm

[Tutor] yet another misunderstanding on my part

2014-10-22 Thread Clayton Kirkwood
__author__ = 'SYSTEM' import string #PricingDividends raw_table = (''' a: Asky: Dividend Yield b: Bid d: Dividend per Share b2: Ask (Realtime) r1: Dividend Pay Date b3: Bid (Realtime)q: Ex-Dividend Date p: Previous Close o: Open import re,

[Tutor] A couple of somewhat esoteric questions

2014-10-22 Thread Clayton Kirkwood
As I've contemplated the usage of dictionaries, I face the question of efficiency. Going back before most of you were probably born;<)) if I remember correctly dictionaries(assoc. arrays), having hashes, are efficient for storing sparse arrays with the added benefit of hiding the traversal of the d

[Tutor] Passing Data to .DLL

2014-10-22 Thread Wilson, Pete
I am having problems passing a pointer and uint8 to a .DLL. I have been successful registering call -backs with this .DLL. So it is all 32-bit and ctypes are working. Everything is working up to the line #set-up ProcessingIncomingSerialData. I tried the direct approach and then morphing the cal