Re: [Tutor] instantiate and name a class from / with a string

2019-08-09 Thread ingo
get from data base setattr(root.channel, name, SSE(name)) is what I was looking for, time to read up on attributes, Thanks, Ingo ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] instantiate and name a class from / with a string

2019-08-09 Thread ingo
s') ... http://example.com/channel/weather/ will then become the emitter of the weather event stream. I'd like create the instances of SSE programmatically by pulling the string 'weather', 'energy' etc. from a database. Ingo ___

Re: [Tutor] path

2019-06-29 Thread ingo
On 29-6-2019 15:42, Mats Wichmann wrote: > > Most people don't use pathlib, and that's kind of sad, since it tries to > mitigate the kinds of questions you just asked. Kudos for trying. In the end, it works, Ingo ---%<--%<--%<--- # set up some default

Re: [Tutor] path

2019-06-29 Thread ingo
On 29-6-2019 16:33, ingo wrote: > > What I'm looking for is c:/test/this/path After further testing, the other tools in the chain accept paths like c:\\test\\dir c:\/test/dir c:/test/dir anything except standard windows, the top two I can gene

Re: [Tutor] path

2019-06-29 Thread ingo
On 29-6-2019 15:52, Mats Wichmann wrote: > Sigh... something dropped my raw string, so that was a really bad sample :( > > inp = r"c:\test\drive\this" > > > On Sat, Jun 29, 2019, at 07:44, Mats Wichmann wrote: >> >> For your example, when you define inp as a string, it needs to be a raw >> strin

[Tutor] path

2019-06-29 Thread ingo
st/drive his >>> inp 'c:\test\\drive\this' >>> import os >>> print(os.path.normpath(inp)) c: est\drive his >>> print(pathlib.Path(inp)) c: est\drive his >>> how to go from a string to a path, how to append to a path (os.path.join or / with Path

Re: [Tutor] File extension against File content

2019-05-31 Thread ingo
Many file formats have "magic bytes" that you can use for that purpose. https://en.wikipedia.org/wiki/List_of_file_signatures Ingo On 31-5-2019 12:03, Sunil Tech wrote: > Hi Tutor, > > Is there any way that I can actually programmatically compare the file > extension with

Re: [Tutor] tweeting from python

2019-05-26 Thread ingo
google are for creating one use apps. > Nathan, you may want to give twython a look https://github.com/ryanmcgrath/twython it has Oauth etc. There are tutorials for writing twitter bots with it that you could adapt to your purpose, for example: https://geekswipe.net/techn

Re: [Tutor] properly propagate problems

2019-03-24 Thread ingo janssen
so answered the question that I thought of right after posting, what if it is a library and knows nothing about its use? I'll certainty have a look at Pfx. Thank you Cameron, ingo ___ Tutor maillist - Tutor@python.org To unsubscribe or change

[Tutor] properly propagate problems

2019-03-23 Thread ingo janssen
follow in such cases ingo ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] type hint woes regex

2019-03-02 Thread ingo
output type, type of m and specified output type don't match. Ingo ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] text processing lines variable content

2019-02-07 Thread ingo janssen
very simple: for points, line in enumerate(open("vorodat.txt.vol",'r'), 1): line = line.strip() line = line.split(" ") slices = calculate_slices(line) function[action](content[action],slices[action]) thanks for your time and insight, I'll try a few diff

Re: [Tutor] text processing lines variable content

2019-02-07 Thread ingo janssen
On 07/02/2019 11:08, Peter Otten wrote: replace the sequence of tests with dictionary lookups updated the gist a few times, now I could pre calculate the slices to be taken per line, but will there be much gain compared to the copping from the left side of the list? ingo

Re: [Tutor] text processing lines variable content

2019-02-07 Thread ingo janssen
code up here: https://gist.github.com/ingoogni/e99c561f23777e59a5aa6b4ef5fe37c8 I will study yours, ingo ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] text processing lines variable content

2019-02-07 Thread ingo janssen
On 07/02/2019 10:40, Alan Gauld via Tutor wrote: Just saves a little typing is all. Sensei, be lazy, I will study current state of code is at https://gist.github.com/ingoogni/e99c561f23777e59a5aa6b4ef5fe37c8 ingo ___ Tutor maillist - Tutor

Re: [Tutor] text processing lines variable content

2019-02-07 Thread ingo janssen
On 07/02/2019 09:58, ingo janssen wrote: On 07/02/2019 09:29, Peter Otten wrote: Where will you get the order from? Ahrg, that should have been: #all output formatting options order = "%i %q %r %w %p %P %o %m %g %E %s %e %F %a %A %f %t %l %n %v %c %C" order = re.findall(&quo

Re: [Tutor] text processing lines variable content

2019-02-07 Thread ingo janssen
ng %p, %P and %o will be. This varies per line. I'll look into what you wrote, thanks, ingo ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] text processing lines variable content

2019-02-06 Thread ingo janssen
147>,<-0.869981,0,0.493086>,<-0.904528,-0.0477043,0.423738>,<0.75639,-5.72053e-15,0.654121>,<-0,-1,0>,<0.950875,4.0561e-18,-0.309575>,<-5.99268e-17,1,-1.44963e-16>,<-0.849681,0.21476,0.481581> } } #declare Neighbours = array[0]{ //label: 0 array[9]{92

Re: [Tutor] text processing lines variable content

2019-02-06 Thread ingo janssen
e A, b2 to file B etc. When all lines are processed combine the files A,B,C ... to a single file. Or is there a more practical way? Speed is not important. ingo ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] text processing lines variable content

2019-02-06 Thread ingo janssen
but some have 10. Then I can get at max 22 lists with 10 items. Not fun. I tried writing the data to a file "out of sequence", not fun either. What would be the way to do this? I thought about writing each data chunk to a proper temporary file

[Tutor] automatic setting of class property when another one changes

2016-09-15 Thread ingo
Rather stuck with this one, I'd like to automatically (re)set the propery "relaystate" when one of the others (Tm, Tset, Th) is set, regardless of wether their value has changed. Ingo My code so far: from collections import namedtuple import logging logger = lo

Re: [Tutor] turn a path into nested list

2011-01-14 Thread ingo
s/pygame/examples/macosx/aliens_app_example/aliens.pyo'), ('README.txt', 'Audio/site-packages/pygame/examples/macosx/aliens_app_example/README.txt'), ('setup.py', 'Audio/site-packages/pygame/examples/macosx/aliens_app_example/setup.py'), ('setup.pyc', 'Audio/site-packages/pygame/examples/macosx/aliens_app_example/setup.pyc'), ('setup.pyo', 'Audio/site-packages/pygame/examples/macosx/aliens_app_example/setup.pyo')] ingo ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] turn a path into nested list

2011-01-13 Thread ingo
but I'm not confident with it (the more reason to use it you will say :) ). Below the script I'm working on, rather unstable still. It will be put to work in Cherrypy so I browse through my media directories and send playlists to my media player(s). Very preliminary still. ingo --- %< ---

Re: [Tutor] turn a path into nested list

2011-01-13 Thread ingo
On Thu, Jan 13, 2011 at 1:51 PM, Christian Witts wrote: > First split your path into segments, then iterate over those segments and > build your new list (item one being the current segment, and part two a > joined string of previous segments). > thanks Christian, path = 'Audio/site-packages/py

[Tutor] turn a path into nested list

2011-01-13 Thread ingo
to a list with a certain structure and order: [['Audio', 'Audio'], ['site-packages', ''Audio/site-packages'], ['pygame', 'Audio/site-packages/pygame'], ['examples', 'Audio/site-packages/

Re: [Tutor] python at midnight

2010-11-17 Thread ingo
On Sun, Nov 14, 2010 at 11:48 PM, Steven D'Aprano wrote: >> How to get this functionality added to Python? > > Make a feature request on the Python bug tracker: > > http://bugs.python.org/ done: http://bugs.python.org/issue10427 i. ___ Tutor maillist

Re: [Tutor] python at midnight

2010-11-14 Thread ingo
On Sun, Nov 14, 2010 at 11:48 PM, Steven D'Aprano wrote: > > Write a wrapper function: > Thanks Steve, with this in hand I think I can solve the main problems for now i. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription opt

[Tutor] python at midnight

2010-11-14 Thread ingo
While processing weather data from the http://www.knmi.nl/ and building a small domotica system I ran into the following 'shortcomming' from the python doc: "class datetime.datetime(year, month, day[, hour[, minute[, second[, microsecond[, tzinfo]) The year, month and day arguments are requir

Re: [Tutor] two way dictionary

2007-11-28 Thread ingo janssen
On Nov 28, 2007 8:16 PM, Kent Johnson <[EMAIL PROTECTED]> wrote: > ingo janssen wrote: > > Is there a dict that works "both ways"? > > another implementation here: > http://www.radlogic.com/releases/two_way_dict.py > Perfect, never thought to actually search f

[Tutor] two way dictionary

2007-11-28 Thread ingo janssen
f fetch_alias(path, home_dict): path = os.path.normpath(path) pathlist = path.split(os.sep) if pathlist[0] in home_dict: pathlist[0] = home_dict[pathlist[0]] newpath = os.sep.join(pathlist) return os.path.normpath(newpath) else: print &qu

Re: [Tutor] Python related mags

2006-06-13 Thread ingo
in news:[EMAIL PROTECTED] Evans Anyokwu wrote: > But then again, who is going to initiate the first move?? > Here's a name: Monthly Python ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] how to get the return value?

2006-03-06 Thread Ingo
for windows there's the great videocapture module http://videocapture.sourceforge.net/ >This follows my motto of keeping things as simple as possible! :-) I try, I'm trying to try God knows I try Thanks Alan, Ingo ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] how to get the return value?

2006-03-05 Thread Ingo
nvalid syntax > >It's very helpful to show the actual error and traceback. Sorry, here it is File "D:\Ingo\PyScript\VIDEOC~1.9\_ij\_time_lapse.py", line 23 def main(printtime(strf=None)): ^ SyntaxError: invalid syntax Ingo ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] how to get the return value?

2006-03-05 Thread ingo
in news:[EMAIL PROTECTED] Kent Johnson wrote: >>>>[...] >>> >>>main(printtime(strf=None)) >>> >>>[...] >> >> Anna, >> >> that results in an syntax error / invalid syntax > > It's very helpful to show the actual

Re: [Tutor] how to get the return value?

2006-03-05 Thread Ingo
On 2006/3/04, Anna Ravenscroft wrote: >>[...] > >main(printtime(strf=None)) > >should do it. Alternately: > >tt = printtime(strf=None) >main(tt) > Anna, that results in an syntax error / invalid syntax Ingo ___ Tutor

[Tutor] how to get the return value?

2006-03-04 Thread Ingo
To make a time lapse video I've been playing with the sched module. There is one problem I run into, in the code below, how do I get the returned value t from printtime into main? import time from sched import scheduler class time_lapse(scheduler): def time_lapse(self, start_time, stop