Re: Does Python allow variables to be passed into function for dynamic screen scraping?

2015-11-28 Thread ryguy7272
On Saturday, November 28, 2015 at 8:59:04 PM UTC-5, Steven D'Aprano wrote: > On Sun, 29 Nov 2015 09:03 am, ryguy7272 wrote: > > > I'm looking at this URL. > > https://en.wikipedia.org/wiki/Wikipedia:Unusual_place_names > > Don't screen-scrape Wikipedia. Just don't. They have an official API for >

Re: python response slow when running external DLL

2015-11-28 Thread jfong
Laura Creighton at 2015/11/28 UTC+8 6:52:25PM wrote: > I never saw the reply that Peter is replying to. > The threading module constructs a higher level interface on top of the > low level thread module. Thus it is the preferred way to go for > standard Python code -- and even Fredrik's recipe con

Re: python response slow when running external DLL

2015-11-28 Thread jfong
Peter Otten at 2015/11/28 UTC+8 6:14:09PM wrote: > No, the point of both recipes is that tkinter operations are only ever > invoked from the main thread. The main thread has polling code that > repeatedly looks if there are results from the helper thread. As far I > understand the polling method

Re: Does Python allow variables to be passed into function for dynamic screen scraping?

2015-11-28 Thread Steven D'Aprano
On Sun, 29 Nov 2015 09:03 am, ryguy7272 wrote: > I'm looking at this URL. > https://en.wikipedia.org/wiki/Wikipedia:Unusual_place_names Don't screen-scrape Wikipedia. Just don't. They have an official API for downloading content, use it. There's even a Python library for downloading from Wikipedi

Re: Generate config file from template using Python search and replace.

2015-11-28 Thread Peter Otten
Mr Zaug wrote: > I need to generate a config file based on an existing "template" file. I > need to replace a set of strings with other strings globally in the > generated file. > > Here is a snippet of the template file, where CONTENT_PATH and DAMPATH are > two "placeholders" or variables. There

Re: Does Python allow variables to be passed into function for dynamic screen scraping?

2015-11-28 Thread Laura Creighton
In a message of Sat, 28 Nov 2015 14:37:26 -0800, ryguy7272 writes: >On Saturday, November 28, 2015 at 5:28:55 PM UTC-5, Laura Creighton wrote: >> In a message of Sat, 28 Nov 2015 14:03:10 -0800, ryguy7272 writes: >> >I'm looking at this URL. >> >https://en.wikipedia.org/wiki/Wikipedia:Unusual_place

Re: Does Python allow variables to be passed into function for dynamic screen scraping?

2015-11-28 Thread ryguy7272
On Saturday, November 28, 2015 at 5:28:55 PM UTC-5, Laura Creighton wrote: > In a message of Sat, 28 Nov 2015 14:03:10 -0800, ryguy7272 writes: > >I'm looking at this URL. > >https://en.wikipedia.org/wiki/Wikipedia:Unusual_place_names > > > >If I hit F12 I can see tags such as these: > > > >And so

Re: Does Python allow variables to be passed into function for dynamic screen scraping?

2015-11-28 Thread Laura Creighton
In a message of Sat, 28 Nov 2015 14:03:10 -0800, ryguy7272 writes: >I'm looking at this URL. >https://en.wikipedia.org/wiki/Wikipedia:Unusual_place_names > >If I hit F12 I can see tags such as these: >And so on and so forth. > >I'm wondering if someone can share a script, or a function, that will

Re: Generate config file from template using Python search and replace.

2015-11-28 Thread Mr Zaug
I should mention the template file is small, just 98 lines long and the working config file will be the same size. -- https://mail.python.org/mailman/listinfo/python-list

Does Python allow variables to be passed into function for dynamic screen scraping?

2015-11-28 Thread ryguy7272
I'm looking at this URL. https://en.wikipedia.org/wiki/Wikipedia:Unusual_place_names If I hit F12 I can see tags such as these: https://en.wikipedia.org/wiki/Wikipedia:Unusual_place_names"; r = requests.get(url) soup=BeautifulSoup(r.content,"lxml") #set up a function to parse the "soup" for each

Re: Python 3 virtualenvs

2015-11-28 Thread Jon Ribbens
On 2015-11-28, D.M. Procida wrote: > Jon Ribbens wrote: > >> On 2015-11-28, D.M. Procida > wrote: >> > I have a new installation of Debian Jessie, with Python 2.7 and 3.4 >> > installed. >> > >> > I want to use Python 3.4 by default for most things, so I want >> > virtualenv to create Python 3.

Generate config file from template using Python search and replace.

2015-11-28 Thread Mr Zaug
I need to generate a config file based on an existing "template" file. I need to replace a set of strings with other strings globally in the generated file. Here is a snippet of the template file, where CONTENT_PATH and DAMPATH are two "placeholders" or variables. There are several other such pl

Re: An Educational Software Platform written in Python

2015-11-28 Thread Joel Goldstick
On Sat, Nov 28, 2015 at 11:39 AM, Marko Rauhamaa wrote: > Cai Gengyang : > > > Can I create something like this entirely in Python, > > Absolutely. It will only take ten to one hundred years for one person to > create. > > > Marko > -- > https://mail.python.org/mailman/listinfo/python-list > Ca

Re: Python 3 virtualenvs

2015-11-28 Thread D.M. Procida
Jon Ribbens wrote: > On 2015-11-28, D.M. Procida wrote: > > I have a new installation of Debian Jessie, with Python 2.7 and 3.4 > > installed. > > > > I want to use Python 3.4 by default for most things, so I want > > virtualenv to create Python 3.4 virtualenvs unless I ask it to > > otherwise.

Re: Find relative url in mixed text/html

2015-11-28 Thread Paul Rubin
Rob Hills writes: > Personally, I'd rather go with something based on a language I am > reasonably familiar with (eg Python or Java) however it seems the vast > bulk of Forum software is based on PHP :-( It's certainly possible to write good software in PHP, so it's mostly a matter of the design

Re: Find relative url in mixed text/html

2015-11-28 Thread Rob Hills
Hi Grobu, On 28/11/15 15:07, Grobu wrote: > Is it safe to assume that all the relative (cross) links take one of > the following forms? : > > http://www.aeva.asn.au/forums/forum_posts.asp > www.aeva.asn.au/forums/forum_posts.asp > /forums/forum_posts.asp > /forum_posts.asp (are you

Re: Find relative url in mixed text/html

2015-11-28 Thread Rob Hills
Hi Laura, On 29/11/15 01:04, Laura Creighton wrote: > In a message of Sun, 29 Nov 2015 00:25:07 +0800, Rob Hills writes: >> All that said, I'd be interested to see specific (and hopefully >> unbiased) info about phpBB's failings... > People I know of who run different bb software say that the spam

Re: Find relative url in mixed text/html

2015-11-28 Thread Laura Creighton
In a message of Sun, 29 Nov 2015 00:25:07 +0800, Rob Hills writes: >All that said, I'd be interested to see specific (and hopefully >unbiased) info about phpBB's failings... People I know of who run different bb software say that the spammers really prefer phpBB. So keeping it spam free is about

Re: askopenfilename()

2015-11-28 Thread Ulli Horlacher
Christian Gollwitzer wrote: > Am 28.11.15 um 13:48 schrieb Ulli Horlacher: > > Christian Gollwitzer wrote: > >> Many problems would simply go away if you wrote the whole thing as a GUI > >> program. > > > > Too much hassle. > > The predecessor was a Perl/Tk program and I have had to invest 90% o

Re: An Educational Software Platform written in Python

2015-11-28 Thread Marko Rauhamaa
Cai Gengyang : > Can I create something like this entirely in Python, Absolutely. It will only take ten to one hundred years for one person to create. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: Find relative url in mixed text/html

2015-11-28 Thread Rob Hills
Hi Paul, On 28/11/15 13:11, Paul Rubin wrote: > Rob Hills writes: >> Note, in the beginning of this project, I looked at using "Beautiful >> Soup" but my reading and limited testing lead me to believe that it is >> designed for well-formed HTML/XML and therefore was unsuitable for the >> text/htm

Re: askopenfilename()

2015-11-28 Thread Ulli Horlacher
Ulli Horlacher wrote: > One of my Windows test users reports, that the file dialog window of > askopenfilename() starts behind the console window and has no focus. I have got a followup: this happens only with Windows XP, not with Windows 7. Therefore I will ignore this problem :-) -- Ullrich

Re: askopenfilename()

2015-11-28 Thread Laura Creighton
Maybe Wei Li Jiang's hack will work for you? http://stackoverflow.com/questions/3375227/how-to-give-tkinter-file-dialog-focus But then see if it works under MacOS. I fear it will not. Laura -- https://mail.python.org/mailman/listinfo/python-list

An Educational Software Platform written in Python

2015-11-28 Thread Cai Gengyang
So after reading YCombinator's new RFS, I have decided I want to build an educational software platform written in Python (mostly, if not entirely). Here is the description from YCombinator's RFS : If we can fix education, we can eventually do everything else on this list. The first attempts to

Re: askopenfilename()

2015-11-28 Thread Christian Gollwitzer
Am 28.11.15 um 13:48 schrieb Ulli Horlacher: Christian Gollwitzer wrote: Many problems would simply go away if you wrote the whole thing as a GUI program. Too much hassle. The predecessor was a Perl/Tk program and I have had to invest 90% of the programming work into the GUI handling. No fun

Re: Python 3 virtualenvs

2015-11-28 Thread Jon Ribbens
On 2015-11-28, D.M. Procida wrote: > I have a new installation of Debian Jessie, with Python 2.7 and 3.4 > installed. > > I want to use Python 3.4 by default for most things, so I want > virtualenv to create Python 3.4 virtualenvs unless I ask it to > otherwise. > > It turns out that this seems t

Re: askopenfilename()

2015-11-28 Thread Ulli Horlacher
Christian Gollwitzer wrote: > Am 28.11.15 um 11:29 schrieb Ulli Horlacher: > > One of my Windows test users reports, that the file dialog window of > > askopenfilename() starts behind the console window and has no focus. > > On Linux (XFCE) I do not have this problem. > > > > I start it with: > >

Re: askopenfilename()

2015-11-28 Thread Christian Gollwitzer
Am 28.11.15 um 11:29 schrieb Ulli Horlacher: One of my Windows test users reports, that the file dialog window of askopenfilename() starts behind the console window and has no focus. On Linux (XFCE) I do not have this problem. I start it with: Tk().withdraw() file = askopenfilename(title=

Re: Looking for ideas to improve library API

2015-11-28 Thread Devin Jeanpierre
Documentation is all you can do. -- Devin On Thu, Nov 26, 2015 at 5:35 AM, Chris Lalancette wrote: > On Thu, Nov 26, 2015 at 7:46 AM, Devin Jeanpierre > wrote: >> Why not take ownership of the file object, instead of requiring users >> to manage lifetimes? > > Yeah, I've kind of been coming to

Re: python response slow when running external DLL

2015-11-28 Thread Laura Creighton
In a message of Sat, 28 Nov 2015 11:13:38 +0100, Peter Otten writes: >jf...@ms4.hinet.net wrote: >> Using thread is obviously more logical. I think my mistake was the "while >> busy: pass" loop which makes no sense because it blocks the main thread, >> just as the time.sleep() does. That's why in

askopenfilename() (was: Re: non-blocking getkey?)

2015-11-28 Thread Ulli Horlacher
Ulli Horlacher wrote: > eryksun wrote: > > On Thu, Nov 19, 2015 at 10:31 AM, Michael Torrie wrote: > > > One windows it might be possible to use the win32 api to enumerate the > > > windows, find your console window and switch to it. > > > > You can call GetConsoleWindow [1] and then SetForegro

Re: python response slow when running external DLL

2015-11-28 Thread Peter Otten
jf...@ms4.hinet.net wrote: > Peter Otten at 2015/11/27 UTC+8 8:20:54PM wrote: > >> Quick-fix example: >> def download(): >> var.set("Starting download...") >> root.update_idletasks() >> time.sleep(3) >> var.set("... done") > > Thanks, Peter, The update_idletasks() works. In my tr