Re: Javascript website scraping using WebKit and Selenium tools

2015-07-01 Thread Veek M
dieter wrote: > Once the problems to get the "final" HTML code solved, > I would use "lxml" and its "xpath" support to locate any > relevant HTML information. Hello Dieter, yes - you are correct. (though I don't think there's any auth to browse - nice that you actually tried) He's using jsonP an

Re: Installing Pybison

2015-07-01 Thread dieter
Great Avenger Singh writes: > I am installing Pybison from following Source: > > https://github.com/smvv/pybison > > After installing all required dependencies I am able to run "sodo python > setup.py install" without any errors. > > I am getting following error while Running "python -c import bi

Re: Javascript website scraping using WebKit and Selenium tools

2015-07-01 Thread dieter
Veek M writes: > I tried scraping a javascript website using two tools, both didn't work. The > website link is: http://xdguo.taobao.com/category-499399872.htm The relevant > text I'm trying to extract is 'GY-68...': > > > > > > id="4002-6778075404" data-spm-anchor-i

Re: "normalizing" a value

2015-07-01 Thread Mark Lawrence
On 02/07/2015 01:12, bvdp wrote: Not sure what this is called (and I'm sure it's not normalize). Perhaps "scaling"? Anyway, I need to convert various values ranging from around -50 to 50 to an 0 to 12 range (this is part of a MIDI music program). I have a number of places where I do: whi

Installing Pybison

2015-07-01 Thread Great Avenger Singh
Hello Everyone, I am installing Pybison from following Source: https://github.com/smvv/pybison After installing all required dependencies I am able to run "sodo python setup.py install" without any errors. I am getting following error while Running "python -c import bison" Traceback (most rec

Re: Python 3 resuma a file download

2015-07-01 Thread Tim Chase
On 2015-07-01 21:51, Peter Otten wrote: > use a loop: > > CHUNKSIZE = 16*1024 # for example > while True: >data = response.read(CHUNKSIZE) >if not data: >break >out_file.write(data) > > > This can be simplified: > > shutil.copyfileobj(response, out_file) It's these little

Re: "normalizing" a value

2015-07-01 Thread bvdp
On Wednesday, July 1, 2015 at 7:15:28 PM UTC-7, Steven D'Aprano wrote: > On Thu, 2 Jul 2015 10:12 am, bvdp wrote: > > > Not sure what this is called (and I'm sure it's not normalize). Perhaps > > "scaling"? > > > Could be normalising, could be scaling. > > > Anyway, I need to convert various v

Re: "normalizing" a value

2015-07-01 Thread bvdp
On Wednesday, July 1, 2015 at 7:23:19 PM UTC-7, rand...@fastmail.us wrote: > On Wed, Jul 1, 2015, at 21:49, bvdp wrote: > > Interesting that negative values translate properly. That's an > > non-intuitive result to me. Guess I should have studied that math stuff > > harder way back when! > > There

Re: "normalizing" a value

2015-07-01 Thread random832
On Wed, Jul 1, 2015, at 21:49, bvdp wrote: > Interesting that negative values translate properly. That's an > non-intuitive result to me. Guess I should have studied that math stuff > harder way back when! There are multiple interpretations of the operation, and not all languages behave the same w

Re: "normalizing" a value

2015-07-01 Thread Steven D'Aprano
On Thu, 2 Jul 2015 10:12 am, bvdp wrote: > Not sure what this is called (and I'm sure it's not normalize). Perhaps > "scaling"? Could be normalising, could be scaling. > Anyway, I need to convert various values ranging from around -50 to 50 to > an 0 to 12 range (this is part of a MIDI music p

Re: Python programming classes for children

2015-07-01 Thread Great Avenger Singh
On Thursday, 2 July 2015 07:20:03 UTC+5:30, Great Avenger Singh wrote: > On Wednesday, 1 July 2015 18:33:06 UTC+5:30, beli...@aol.com wrote: > > > Are there other groups offering Python courses for pre-college students? > > Some months ago I took one course from Edx, They provide very good mat

Re: Python programming classes for children

2015-07-01 Thread Great Avenger Singh
On Wednesday, 1 July 2015 18:33:06 UTC+5:30, beli...@aol.com wrote: > Are there other groups offering Python courses for pre-college students? Some months ago I took one course from Edx, They provide very good material and every each topic assignment is given, You can try following: https://

Re: "normalizing" a value

2015-07-01 Thread bvdp
On Wednesday, July 1, 2015 at 6:27:57 PM UTC-7, rand...@fastmail.us wrote: > On Wed, Jul 1, 2015, at 20:12, bvdp wrote: > > Not sure what this is called (and I'm sure it's not normalize). Perhaps > > "scaling"? > > > > Anyway, I need to convert various values ranging from around -50 to 50 to > > a

Re: "normalizing" a value

2015-07-01 Thread random832
On Wed, Jul 1, 2015, at 20:12, bvdp wrote: > Not sure what this is called (and I'm sure it's not normalize). Perhaps > "scaling"? > > Anyway, I need to convert various values ranging from around -50 to 50 to > an 0 to 12 range (this is part of a MIDI music program). I have a number > of places whe

Re: how to fix TypeError: format requires a mapping

2015-07-01 Thread Denis McMahon
On Wed, 01 Jul 2015 14:57:14 -0700, hinaimran.mehr wrote: > I am pulling my hair with this problem right now, > > I have the following Data structure > > [ u'resource_id': u'id', u'timestamp': u'2015-06-30T15:53:55', > u'counter_volume': 0.043}] This isn't a print out of any python

Javascript website scraping using WebKit and Selenium tools

2015-07-01 Thread Veek M
I tried scraping a javascript website using two tools, both didn't work. The website link is: http://xdguo.taobao.com/category-499399872.htm The relevant text I'm trying to extract is 'GY-68...': I'm trying to match the class="

Re: "normalizing" a value

2015-07-01 Thread Denis McMahon
On Wed, 01 Jul 2015 17:12:36 -0700, bvdp wrote: > Not sure what this is called (and I'm sure it's not normalize). Perhaps > "scaling"? > > Anyway, I need to convert various values ranging from around -50 to 50 > to an 0 to 12 range (this is part of a MIDI music program). I have a > number of plac

Re: "normalizing" a value

2015-07-01 Thread Paul Rubin
bvdp writes: >while x < 0: x += 12 >while x >= 12: x -= 12 > Okay, that works. Just wondering if there is an easier (or faster) way > to accomplish this. x = x % 12 should be the same as the above. But are you sure that's really what you want? -- https://mail.python.org/mailman/listinf

Re: "normalizing" a value

2015-07-01 Thread MRAB
On 2015-07-02 01:12, bvdp wrote: Not sure what this is called (and I'm sure it's not normalize). Perhaps "scaling"? Anyway, I need to convert various values ranging from around -50 to 50 to an 0 to 12 range (this is part of a MIDI music program). I have a number of places where I do: whi

"normalizing" a value

2015-07-01 Thread bvdp
Not sure what this is called (and I'm sure it's not normalize). Perhaps "scaling"? Anyway, I need to convert various values ranging from around -50 to 50 to an 0 to 12 range (this is part of a MIDI music program). I have a number of places where I do: while x < 0: x += 12 while x >= 12:

Re: Python 3 resuma a file download

2015-07-01 Thread Cameron Simpson
On 01Jul2015 21:51, Peter Otten <__pete...@web.de> wrote: zljubi...@gmail.com wrote: But how to read chunks? Instead of data = response.read() # a `bytes` object out_file.write(data) use a loop: CHUNKSIZE = 16*1024 # for example while True: data = response.read(CHUNKSI

Re: Pure Python Data Mangling or Encrypting

2015-07-01 Thread Gregory Ewing
Randall Smith wrote: Worse case, something that looks like this would land on the disk. crc32 checksum + translation table + malware It would be safer to add something to both the beginning *and* end of the file. Some file formats, e.g. zip, pdf, are designed to be read starting from the end

how to fix TypeError: format requires a mapping

2015-07-01 Thread hinaimran . mehr
I am pulling my hair with this problem right now, I have the following Data structure [http://www.pubnub.com/developers/eon/chart/spline/) message: { columns: [ ["y": 0.043, "x": "2015-06-30T15:53:55"], ["y": 0.045, "x": "2015-06-30T15:53:55"]

Re: Python programming classes for children

2015-07-01 Thread John Ladasky
On Wednesday, July 1, 2015 at 6:03:06 AM UTC-7, beli...@aol.com wrote: > My 11yo son is taking the online class "Intermediate Programming with Python" > http://www.artofproblemsolving.com/school/course/catalog/python2 offered by > the Art of Problem Solving company (AoPS). Classes meet for 1.5 ho

Re: Python 3 resuma a file download

2015-07-01 Thread Peter Otten
zljubi...@gmail.com wrote: > New version with chunks: > > import os > import urllib.request > > def Download(rfile, lfile): > > retval = False > > if os.path.isfile(lfile): > lsize = os.stat(lfile).st_size > else: > lsize = 0 > > req = urllib.request.Request(rf

Re: Python 3 resuma a file download

2015-07-01 Thread zljubisic
New version with chunks: import os import urllib.request def Download(rfile, lfile): retval = False if os.path.isfile(lfile): lsize = os.stat(lfile).st_size else: lsize = 0 req = urllib.request.Request(rfile) req.add_header('Range', "bytes={}-".format(lsize)

Re: Python 3 resuma a file download

2015-07-01 Thread Peter Otten
zljubi...@gmail.com wrote: > But how to read chunks? Instead of > data = response.read() # a `bytes` object > out_file.write(data) use a loop: CHUNKSIZE = 16*1024 # for example while True: data = response.read(CHUNKSIZE) if not data: break out_file.write(data)

Re: Python 3 resuma a file download

2015-07-01 Thread zljubisic
But how to read chunks? -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3 resuma a file download

2015-07-01 Thread Chris Angelico
On Thu, Jul 2, 2015 at 5:24 AM, wrote: > with urllib.request.urlopen(req) as response, open(lfile, 'ab') as > out_file: > data = response.read() # a `bytes` object > out_file.write(data) > If a file is big enough to want to resume the download once, you almost certainly want

Re: Python 3 resuma a file download

2015-07-01 Thread zljubisic
Currently I am executing the following code: import os import urllib.request def Download(rfile, lfile): retval = False if os.path.isfile(lfile): lsize = os.stat(lfile).st_size else: lsize = 0 req = urllib.request.Request(rfile) req.add_header('Range', "byte

Re: Datetime timezone trouble (was: Matplotlib X-axis timezone trouble)

2015-07-01 Thread Peter Pearson
On Wed, 1 Jul 2015 10:55:02 -0600, Ian Kelly wrote: > On Wed, Jul 1, 2015 at 10:36 AM, Peter Pearson [wrote]: [snip] >> Here's a very simple demonstration that either something is wrong >> or I don't understand how datetime and tzinfo are supposed to work: >> >> $ python >> Python 2.7.3 (default,

Re: Recreate file associations?

2015-07-01 Thread random832
On Mon, Jun 29, 2015, at 14:25, Terry Reedy wrote: > Registry => Windows. > Did you check [X] Make this my default python? I didn't see any such checkbox, in any of installers I ran. (And, yes, I assumed windows was implied by my subject - other systems python runs on either don't have a notion o

Re: Datetime timezone trouble (was: Matplotlib X-axis timezone trouble)

2015-07-01 Thread Chris Angelico
On Thu, Jul 2, 2015 at 2:36 AM, Peter Pearson wrote: > On Wed, 1 Jul 2015 17:15:38 +1000, Chris Angelico wrote: >> >> Interestingly, when I tried this (pytz version 2015.4, Python 2.7.9, >> Debian Jessie), I saw utcoffset() showing (-1, 58020) for both. That >> seems... odd. And I can't fault you

Re: Datetime timezone trouble (was: Matplotlib X-axis timezone trouble)

2015-07-01 Thread Ian Kelly
On Wed, Jul 1, 2015 at 10:36 AM, Peter Pearson wrote: > On Wed, 1 Jul 2015 17:15:38 +1000, Chris Angelico wrote: >> >> Interestingly, when I tried this (pytz version 2015.4, Python 2.7.9, >> Debian Jessie), I saw utcoffset() showing (-1, 58020) for both. That >> seems... odd. And I can't fault yo

Datetime timezone trouble (was: Matplotlib X-axis timezone trouble)

2015-07-01 Thread Peter Pearson
On Wed, 1 Jul 2015 17:15:38 +1000, Chris Angelico wrote: > > Interestingly, when I tried this (pytz version 2015.4, Python 2.7.9, > Debian Jessie), I saw utcoffset() showing (-1, 58020) for both. That > seems... odd. And I can't fault your dates - those definitely ought to > be easily inside and e

Re: Python programming classes for children

2015-07-01 Thread Tim Golden
On 01/07/2015 14:02, beliavsky--- via Python-list wrote: My 11yo son is taking the online class "Intermediate Programming with Python" http://www.artofproblemsolving.com/school/course/catalog/python2 offered by the Art of Problem Solving company (AoPS). Classes meet for 1.5 hours a week for 12 we

Py_InitializeEx() in CygWin64's Python2.7

2015-07-01 Thread Gisle Vanem
I've written a C-program that embeds Python 2.7. It has worked fine for several years using MingW or MSVC. Now I'd like to support the python2.7.exe that comes with CygWin64. But it seems to fail inside 'Py_InitializeEx(0)' where it just prints: ImportError: No module named site What? Does rea

Re: EuroPython 2015 Keynote: Carrie Anne Philbin

2015-07-01 Thread Alister
On 01/07/15 13:00, M.-A. Lemburg wrote: We are pleased to introduce our next keynote speaker for EuroPython 2015: *Carrie Anne Philbin*. She will be giving her keynote on Thursday, July 23, to start the EuroPython Educational Summit: *** https://ep2015.europython.eu/en/events/educational-summi

Re: Python 3 resuma a file download

2015-07-01 Thread Ian Kelly
On Wed, Jul 1, 2015 at 8:18 AM, wrote: > if I understood you correctly (I am not sure about which example you are > refering), I should do the following: > 1. check already downloaded file size in bytes = downloaded > 2. url = 'http://video.hrt.hr/2906/otv296.mp4' > 3. req = urllib.request.Reque

Re: Pure Python Data Mangling or Encrypting

2015-07-01 Thread Randall Smith
On 06/30/2015 01:33 PM, Chris Angelico wrote: From the software's point of view, it has two distinct modes: server, in which it listens on a socket and receives data, and client, in which it connects to other people's sockets and sends data. As such, the "server" mode is the only one that receiv

Re: Python 3 resuma a file download

2015-07-01 Thread zljubisic
On Wednesday, 1 July 2015 01:43:19 UTC+2, Cameron Simpson wrote: > On 30Jun2015 08:34, zljubi...@gmail.com wrote: > >I would like to download a file (http://video.hrt.hr/2906/otv296.mp4) > >If the connection is OK, I can download the file with: > > > >import urllib.request > >urllib.request.urlre

Re: win32print

2015-07-01 Thread BartC
On 01/07/2015 12:28, Tim Golden wrote: On 01/07/2015 12:02, BartC wrote: Yes, I ended up there at one point, but didn't see a win32print.py file, Presumably, nowhere on the internet is there a ready-to-use copy of win32print.py that someone else could just download with little effort? If

Python programming classes for children

2015-07-01 Thread beliavsky--- via Python-list
My 11yo son is taking the online class "Intermediate Programming with Python" http://www.artofproblemsolving.com/school/course/catalog/python2 offered by the Art of Problem Solving company (AoPS). Classes meet for 1.5 hours a week for 12 weeks. During the classes the instructor "lectures" (types

EuroPython 2015 Keynote: Carrie Anne Philbin

2015-07-01 Thread M.-A. Lemburg
We are pleased to introduce our next keynote speaker for EuroPython 2015: *Carrie Anne Philbin*. She will be giving her keynote on Thursday, July 23, to start the EuroPython Educational Summit: *** https://ep2015.europython.eu/en/events/educational-summit/ *** About Carrie Anne Philbin

Re: win32print

2015-07-01 Thread Tim Golden
On 01/07/2015 12:02, BartC wrote: > On 01/07/2015 11:15, Mark Lawrence wrote: >> On 01/07/2015 09:59, BartC wrote: >>> I need to print a text file to whatever printer in Windows is called >>> 'Generic/Text Only'. I looked for a Python solution and come across Tim >>> Golden's win32print module whic

Re: win32print

2015-07-01 Thread BartC
On 01/07/2015 11:15, Mark Lawrence wrote: On 01/07/2015 09:59, BartC wrote: I need to print a text file to whatever printer in Windows is called 'Generic/Text Only'. I looked for a Python solution and come across Tim Golden's win32print module which looks perfect, eg: http://timgolden.me.uk/pyw

Can't get it to download

2015-07-01 Thread thesneakercop
I’ve made several attempts to download python to my laptop, but every time I open it, it ask to repair or uninstall. Can you assist me with downloading it? Sent from Windows Mail-- https://mail.python.org/mailman/listinfo/python-list

Capturing PyRun_String stdout

2015-07-01 Thread Chris Moller
I sent this to the wrong list a few hours ago. I hope I've gotten it right this time... = I expect this has been asked before, but I can't find out much about it... I'm trying to embed Python in a GTK+/C app as a scripting language and I n

Capturing PyRun_String stdout

2015-07-01 Thread Chris Moller
I sent this to the wrong list a few hours ago. I hope I've gotten it right this time... = I expect this has been asked before, but I can't find out much about it... I'm trying to embed Python in a GTK+/C app as a scripting language and I n

Re: win32print

2015-07-01 Thread Mark Lawrence
On 01/07/2015 09:59, BartC wrote: I need to print a text file to whatever printer in Windows is called 'Generic/Text Only'. I looked for a Python solution and come across Tim Golden's win32print module which looks perfect, eg: http://timgolden.me.uk/pywin32-docs/win32print.html However, that te

win32print

2015-07-01 Thread BartC
I need to print a text file to whatever printer in Windows is called 'Generic/Text Only'. I looked for a Python solution and come across Tim Golden's win32print module which looks perfect, eg: http://timgolden.me.uk/pywin32-docs/win32print.html However, that tells me everything I need to know

Re: Pure Python Data Mangling or Encrypting

2015-07-01 Thread alister
On Tue, 30 Jun 2015 23:25:01 +, Jon Ribbens wrote: > On 2015-06-30, Steven D'Aprano wrote: >> I don't think there has been much research into keeping at least *some* >> security even when keys have been compromised, apart from as it relates >> to two-factor authentication. > > That's because

Re: Matplotlib X-axis timezone trouble

2015-07-01 Thread Chris Angelico
On Wed, Jul 1, 2015 at 3:50 PM, Peter Pearson wrote: > But look: > > >>> from datetime import datetime > >>> import pytz > >>> pacific = pytz.timezone("US/Pacific") > >>> dt1 = datetime(2006, 11, 21, 16, 30, tzinfo=pacific) # no DST > >>> dt2 = datetime(2006, 6, 14, 13, 0, tzin