Re: Extract items from string in db

2017-03-15 Thread Steve D'Aprano
On Wed, 15 Mar 2017 09:26 am, DFS wrote: > I have a SQLite database with TEXT columns containing strings of the > format: > > ['Item1: Value1 has,comma','Item2: has'apostrophe','Item3: Value3'] > > The brackets are part of the string. So in Python format, you have something like this: s = "['I

Re: Extraction of model and date created tag from own picture/video recordings

2017-03-15 Thread zljubisic
On Tuesday, 14 March 2017 19:54:18 UTC+1, MRAB wrote: > It might be worth trying "ImageMagick". ImageMagick is only for pictures. :( Do you have a suggestion for videos? -- https://mail.python.org/mailman/listinfo/python-list

Re: Extraction of model and date created tag from own picture/video recordings

2017-03-15 Thread Chris Angelico
On Wed, Mar 15, 2017 at 7:31 PM, wrote: > On Tuesday, 14 March 2017 19:54:18 UTC+1, MRAB wrote: >> It might be worth trying "ImageMagick". > > ImageMagick is only for pictures. :( > Do you have a suggestion for videos? What format are they in? Search the web for "read media info" and see what

Re: Extraction of model and date created tag from own picture/video recordings

2017-03-15 Thread zljubisic
I have done that. The best article I have found is: https://getpocket.com/a/read/1651596570 So far I have tried exifread, exiftool, mediainfo, but looks like I will have to combine several tools in order to get the information that I need. Major problem is with the model. Looks like every manufac

Re: python and databases

2017-03-15 Thread Sibylle Koczian
Am 15.03.2017 um 01:23 schrieb Michael Torrie: On 03/14/2017 01:59 PM, Xristos Xristoou wrote: I have a database in microsoft ACCESS with about 150 records.. if I want to get some data from this database using a query in python and i want to store in some variables in python that will do this

Dynamically replacing an objects __class__; is it safe?

2017-03-15 Thread marco . nawijn
Dear All, Summary of the question: Is it generally safe to dynamically change an objects class; if not under which conditions can it be considered safe. Context: Given the code below, I have no direct control over Base and M1. M1 is a instantiated by 'calling' the read-only property of Base. I

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-15 Thread Peter Otten
marco.naw...@colosso.nl wrote: > Dear All, > > Summary of the question: > Is it generally safe to dynamically change an objects class; if not > under which conditions can it be considered safe. > > Context: > Given the code below, I have no direct control over Base and M1. M1 > is a instantiated

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-15 Thread marco . nawijn
On Wednesday, March 15, 2017 at 11:33:56 AM UTC+1, Peter Otten wrote: > marco.naw...@colosso.nl wrote: > > > Dear All, > > > > Summary of the question: > > Is it generally safe to dynamically change an objects class; if not > > under which conditions can it be considered safe. > > > > Context: >

How to make selected row visible in GTK TreeView?

2017-03-15 Thread Chris Green
I have a GTK TreeView with scrollbars which enables me to scroll through the values OK. Clicking on a row selects it and highlights it. However if one uses 'down arrow' to move the selection/highlight down the list then the selected row disappears from the visibble window. How can I scroll the w

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-15 Thread Steve D'Aprano
On Wed, 15 Mar 2017 08:54 pm, marco.naw...@colosso.nl wrote: > Dear All, > > Summary of the question: > Is it generally safe to dynamically change an objects class; if not > under which conditions can it be considered safe. *Generally* safe? No. You cannot expect to take an arbitrary object and

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-15 Thread gst
Hi, You can subclass M2 from M1 and override only what you need. Regards, -- https://mail.python.org/mailman/listinfo/python-list

numpy indexing performance

2017-03-15 Thread Olaf Dietrich
This is a simplified example of a Monte Carlo simulation where random vectors (here 2D vectors, which are all zero) are summed (the result is in r1 and r2 or r, respectively): def case1(): import numpy as np M = 10 N = 1 r1 = np.zeros(M) r2 = np.zeros(M) s1 = np.zer

Re: Extract items from string in db

2017-03-15 Thread Tobiah
On 03/14/2017 03:26 PM, DFS wrote: > I have a SQLite database with TEXT columns containing strings of the format: > > ['Item1: Value1 has,comma','Item2: has'apostrophe','Item3: Value3'] > > The brackets are part of the string. > > How can I unpack and access each item? > Item1: Value1 has,comma

Re: python and databases

2017-03-15 Thread Xristos Xristoou
Τη Τρίτη, 14 Μαρτίου 2017 - 9:59:42 μ.μ. UTC+2, ο χρήστης Xristos Xristoou έγραψε: first thx for response second i cant use additional packate because i build tool for other python program and that use standar python only, sqlite is in standar python 2.7 @Irmen de Jong ? can use quyries in CSV @

Re: python and databases

2017-03-15 Thread Michael Torrie
On 03/15/2017 08:45 AM, Xristos Xristoou wrote: > first thx for response second i cant use additional packate because i > build tool for other python program and that use standar python > only, I don't see how you can retrieve data from MS Access without a tool that is not part of the standard Pyt

crc method for a serial driver for fiscal cash register

2017-03-15 Thread Bogdan Radu Bolchis
hi, i'm developing a Point Of Sale app in python for my company, and we need to integrate the fiscal cash register driver in python. The original driver is only for windows and no longer supported, we want to switch to Linux. We managed to find the serial protocol, but the sent data is followe

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-15 Thread Gregory Ewing
Steve D'Aprano wrote: You probably can't make a whale fly just by changing the class to bird. It will need wings, and feathers, at the very least. Some things succeed in flying with neither wings nor feathers. Helicopters, for example. -- Greg -- https://mail.python.org/mailman/listinfo/python

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-15 Thread Chris Angelico
On Thu, Mar 16, 2017 at 9:03 AM, Gregory Ewing wrote: > Steve D'Aprano wrote: >> >> You probably can't make a whale fly just by changing the class to bird. It >> will need wings, and feathers, at the very least. > > > Some things succeed in flying with neither wings nor feathers. > Helicopters, fo

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-15 Thread MRAB
On 2017-03-15 22:03, Gregory Ewing wrote: Steve D'Aprano wrote: You probably can't make a whale fly just by changing the class to bird. It will need wings, and feathers, at the very least. Some things succeed in flying with neither wings nor feathers. Helicopters, for example. Could you argue

Re: Dynamically replacing an objects __class__; is it safe?

2017-03-15 Thread Chris Angelico
On Thu, Mar 16, 2017 at 9:19 AM, MRAB wrote: > On 2017-03-15 22:03, Gregory Ewing wrote: >> >> Steve D'Aprano wrote: >>> >>> You probably can't make a whale fly just by changing the class to bird. >>> It >>> will need wings, and feathers, at the very least. >> >> >> Some things succeed in flying w

Re: crc method for a serial driver for fiscal cash register

2017-03-15 Thread MRAB
On 2017-03-15 18:18, Bogdan Radu Bolchis wrote: hi, i'm developing a Point Of Sale app in python for my company, and we need to integrate the fiscal cash register driver in python. The original driver is only for windows and no longer supported, we want to switch to Linux. We managed to find

Re: crc method for a serial driver for fiscal cash register

2017-03-15 Thread Chris Angelico
On Thu, Mar 16, 2017 at 9:31 AM, MRAB wrote: >> 3.2. If the carry bit from S1 is 1, the MSB of S1 and LSB of S0 are >> inverted. >> Points 2 and 3 are executed for all bytes, included in the calculation of >> the CRC - from the first byte after BEG up to and including byte END. >> 4. TR is loaded

SimpleHTTPServer and CgiHTTPServer in practice

2017-03-15 Thread Paul Rubin
Sometimes I have a short term requirement to serve some data by http, so I've been using those modules rather than setting up a full featured web server. Some Python users have told me that isn't a good idea, but without any specifics. Are there any known problems with them such as security bugs,

Re: crc method for a serial driver for fiscal cash register

2017-03-15 Thread MRAB
On 2017-03-16 00:08, Chris Angelico wrote: On Thu, Mar 16, 2017 at 9:31 AM, MRAB wrote: 3.2. If the carry bit from S1 is 1, the MSB of S1 and LSB of S0 are inverted. Points 2 and 3 are executed for all bytes, included in the calculation of the CRC - from the first byte after BEG up to and inclu

RE: Dynamically replacing an objects __class__; is it safe?

2017-03-15 Thread Deborah Swanson
MRAB wrote, on Wednesday, March 15, 2017 3:19 PM > > On 2017-03-15 22:03, Gregory Ewing wrote: > > Steve D'Aprano wrote: > >> You probably can't make a whale fly just by changing the class to > >> bird. It will need wings, and feathers, at the very least. > > > > Some things succeed in flying wit

how to embed non-tkinter VLC player into grid of tkinter with python?

2017-03-15 Thread Ho Yeung Lee
we have many TV that would like to be monitored, how to embed non-tkinter VLC player into grid of tkinter with python? below code can embeded xterm but not for VLC player import vlc from Tkinter import * import os root = Tk() for r in range(2): for c in range(1): termf = Frame(root

Re: how to embed non-tkinter VLC player into grid of tkinter with python?

2017-03-15 Thread Ho Yeung Lee
martin@ubuntu:~/Downloads/python-vlc/examples$ xdg-screensaver: Window 0x0900 does not exist error when run after inherit a frame which put in a grid import vlc from Tkinter import * import os import Tkinter as tk class SampleApp(tk.Frame): def __init__(self, parent, title=None):

Re: how to embed non-tkinter VLC player into grid of tkinter with python?

2017-03-15 Thread Ho Yeung Lee
after several trial, still can not put the player into grid import vlc from Tkinter import * import os import sys import ttk import Tkinter as tk class SampleApp(tk.Frame): def __init__(self, parent, title=None): #def __init__(self, *args, **kwargs): #tk.Tk.__init__(self, *ar