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

[issue24528] Misleading exeption for await in comprehensions.

2015-07-01 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: Yury, thank you for the patch, the error message is much clearer now. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24528 ___

[issue24129] Incorrect (misleading) statement in the execution model documentation

2015-07-01 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: What holds the patch now? Should I do something or just wait? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24129 ___

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 of

[issue24545] Issue with ssl package

2015-07-01 Thread Antoine Pitrou
Antoine Pitrou added the comment: We should probably change the default value for the *ssl_version* parameter. In the meantime, you can workaround this simply with: cert = ssl.get_server_certificate((, 443), ssl.PROTOCOL_SSLv23) -- ___ Python

[issue24547] What’s New In Python 3.4: stray (

2015-07-01 Thread Jakub Wilk
New submission from Jakub Wilk: https://docs.python.org/3/whatsnew/3.4.html#multiprocessing reads: On Unix two new start methods, (spawn and forkserver, have been added for starting processes using multiprocessing. This stray ( should be removed. -- assignee: docs@python components:

[issue24127] Fatal error in launcher: Job information querying failed

2015-07-01 Thread Zachary Ware
Changes by Zachary Ware zachary.w...@gmail.com: -- stage: - resolved ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24127 ___ ___ Python-bugs-list

[issue24544] Race condition and crash when embedding multi-thread script

2015-07-01 Thread Oleksiy Markovets
Oleksiy Markovets added the comment: attached file -- Added file: http://bugs.python.org/file39841/main.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24544 ___

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?

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

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 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

[issue24545] Issue with ssl package

2015-07-01 Thread Christian Heimes
Changes by Christian Heimes li...@cheimes.de: -- nosy: +alex, christian.heimes, dstufft, giampaolo.rodola, janssen, pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24545 ___

[issue24545] Issue with ssl package

2015-07-01 Thread Kayne
New submission from Kayne: I tried to use cert = ssl.get_server_certificate((, 443)) and it crashed with following error: Traceback (most recent call last): File PeerCertChainQuery.py, line 107, in module cert = ssl.get_server_certificate((options.host, 443)) File

[issue24544] Race condition and crash when embedding multi-thread script

2015-07-01 Thread Oleksiy Markovets
New submission from Oleksiy Markovets: INTRODUCTION While embedding python script in c++ application I faced random crashes with error: Fatal Python error: Py_EndInterpreter: not the last thread

[issue24543] Configure script wrongly detects mc68881 with -flto option passed

2015-07-01 Thread marxin
New submission from marxin: I've just tried to build Python with {C,CXX,LD}FLAGS set to '-flto'. Unfortunately following conftest source file is fragile: cat /tmp/mc.c int main () { unsigned int fpcr; __asm__ __volatile__ (fmove.l %%fpcr,%0 : =g (fpcr)); __asm__ __volatile__ (fmove.l

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

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

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

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

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:

[issue24533] Increased Test Coverage for Lib/random.py

2015-07-01 Thread Charles Nodell
Charles Nodell added the comment: Sounds fine! I look forward to seeing how to do this properly! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24533 ___

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

[issue24543] Configure script wrongly detects mc68881 with -flto option passed

2015-07-01 Thread Stefan Krah
Changes by Stefan Krah ste...@bytereef.org: -- nosy: +schwab ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24543 ___ ___ Python-bugs-list mailing

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

[issue24127] Fatal error in launcher: Job information querying failed

2015-07-01 Thread Henrik Heimbuerger
Henrik Heimbuerger added the comment: Happy to report that in build 10159 of Windows 10 64-bit, this just started to work again. No reinstallation of pip needed! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24127

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 which looks

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: ***

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

[issue24545] Issue with ssl package

2015-07-01 Thread Stefan Krah
Changes by Stefan Krah ste...@bytereef.org: -- type: crash - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24545 ___ ___ Python-bugs-list

[issue24546] sequence index bug in random.choice

2015-07-01 Thread Serge Anuchin
New submission from Serge Anuchin: It seems there is minor bug in random.choice. I've got traceback from my server with IndexError from random.choice, but sequence wasn't empty (seq value was: u'\u0411\u0413\u0414\u0416\u0418\u041b\u0426\u042b\u042d\

Re: Python 3 resuma a file download

2015-07-01 Thread Ian Kelly
On Wed, Jul 1, 2015 at 8:18 AM, zljubi...@gmail.com 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 =

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

[issue24548] Broken link in the unittest documentation

2015-07-01 Thread Dmitry Kazakov
New submission from Dmitry Kazakov: The Simple Smalltalk Testing: With Patterns link from https://docs.python.org/3.5/library/unittest.html is dead. I found 2 mirrors but I don't think any of them should replace the broken link. 1.

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 Chris Angelico
On Thu, Jul 2, 2015 at 5:24 AM, zljubi...@gmail.com 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

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))

[issue24543] Configure script wrongly detects x64/x87/mc68881 with -flto option passed

2015-07-01 Thread Andreas Schwab
Changes by Andreas Schwab sch...@linux-m68k.org: -- title: Configure script wrongly detects mc68881 with -flto option passed - Configure script wrongly detects x64/x87/mc68881 with -flto option passed ___ Python tracker rep...@bugs.python.org

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 ian.g.ke...@gmail.com 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

[issue23992] multiprocessing: MapResult shouldn't fail fast upon exception

2015-07-01 Thread Charles-François Natali
Charles-François Natali added the comment: Barring any objections, I'll commit within the next few days. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23992 ___

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 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(rfile)

[issue24543] Configure script wrongly detects mc68881 with -flto option passed

2015-07-01 Thread Andreas Schwab
Andreas Schwab added the comment: That means these tests are broken as well: AC_MSG_CHECKING(for x64 gcc inline assembler) AC_MSG_CHECKING(whether we can use gcc inline assembler to get and set x87 control word) -- ___ Python tracker

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 [OldSample {u'counter_name': u'cpu_util', u'user_id': u'id', u'resource_id': u'id', u'timestamp': u'2015-06-30T15:53:55', u'counter_volume': 0.043}] I need to make it something like this to put in EON

[issue24549] string.format() should have a safe_substitute equivalent, to be run consecutively

2015-07-01 Thread R. David Murray
R. David Murray added the comment: Why not use string.Template? -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24549 ___

[issue24549] string.format() should have a safe_substitute equivalent, to be run consecutively

2015-07-01 Thread azrdev
New submission from azrdev: {1} {0}.format('one').format('two') should return two one, but throws IndexError: tuple index out of range This would allow partial replacements, similar to string.Template.safe_substitute() I suggest an analog construction (e.g. a method string.safe_format()

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 hours

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

[issue24546] sequence index bug in random.choice

2015-07-01 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- assignee: - rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24546 ___ ___

[issue24400] Awaitable ABC incompatible with functools.singledispatch

2015-07-01 Thread Roundup Robot
Roundup Robot added the comment: New changeset a9d38701536d by Yury Selivanov in branch '3.5': Issue #24400: Add one more unittest for CoroutineType.__await__ https://hg.python.org/cpython/rev/a9d38701536d -- ___ Python tracker rep...@bugs.python.org

[issue24400] Awaitable ABC incompatible with functools.singledispatch

2015-07-01 Thread Roundup Robot
Roundup Robot added the comment: New changeset b2a3baa1c2b0 by Yury Selivanov in branch '3.5': Issue #24400: Mention that __instancecheck__ is used in abc.Awaitable and Coroutine https://hg.python.org/cpython/rev/b2a3baa1c2b0 New changeset 4bf1d332fe73 by Yury Selivanov in branch 'default':

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 pkpearson@nowhere.invalid wrote: On Wed, 1 Jul 2015 17:15:38 +1000, Chris Angelico ros...@gmail.com 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

[issue24508] Backport 3.5's Windows build project files to 2.7

2015-07-01 Thread Zachary Ware
Zachary Ware added the comment: Thanks for testing this, Steve! It sounds like PCbuild/readme.txt will need a significant update in the setup portion to cover the different ways to get what is needed (and to mention PC/VS9.0 as a simpler setup). I use third-party extension modules rarely

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 pkpearson@nowhere.invalid wrote: On Wed, 1 Jul 2015 17:15:38 +1000, Chris Angelico ros...@gmail.com 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

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 ros...@gmail.com 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

[issue24536] os.pipe() should return a structsequence (or namedtuple.)

2015-07-01 Thread Ethan Furman
Ethan Furman added the comment: Nowhere else in the stdlib is 'readfd' defined, and 'writefd' is only used once in a test. I think tacking on the 'fd' is both too low level as well as misleading since these are not file descriptors. If there is no agreement on read/write (understandable

[issue24536] os.pipe() should return a structsequence (or namedtuple.)

2015-07-01 Thread Ethan Furman
Ethan Furman added the comment: Okay, scratch the not file descriptors part of my comment, but the rest still stands. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24536 ___

Re: Matplotlib X-axis timezone trouble

2015-07-01 Thread Chris Angelico
On Wed, Jul 1, 2015 at 3:50 PM, Peter Pearson pkpearson@nowhere.invalid 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,

[issue24536] os.pipe() should return a structsequence (or namedtuple.)

2015-07-01 Thread Ethan Furman
Ethan Furman added the comment: As for Niki's example: - -- src = os.pipe() -- src (3, 4) -- if not hasattr(src, 'read'): src = open(src) ... Traceback (most recent call last): File stdin, line 1, in module TypeError: invalid file: (3, 4)

[issue24195] Add `Executor.filter` to concurrent.futures

2015-07-01 Thread Ethan Furman
Ethan Furman added the comment: Brian, given my comments in msg245016 are you willing to add the Executor.filter() function? -- versions: +Python 3.6 -Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24195

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 st...@pearwood.info 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.

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 recent

[issue24550] maxint on 64 bit platforms breaks os.read

2015-07-01 Thread Brian Mingus
New submission from Brian Mingus: The lower range for this bug may be anything greater than 32 bit maxint. Other modules such as multiprocessing are limited passing objects of size 32 bit maxint, even on 64 bit systems, likely due to this issue. I have demonstrated this by modifying

[issue24546] sequence index bug in random.choice

2015-07-01 Thread Tim Peters
Tim Peters added the comment: random() may return 1.0 exactly That shouldn't be possible. Although the code does assume C doubles have at least 53 bits of mantissa precision (in which case it does arithmetic that's exact in at least 53 bits - cannot round up to 1.0; but _could_ round up if

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:

[issue24546] sequence index bug in random.choice

2015-07-01 Thread Tim Peters
Tim Peters added the comment: FYI, where x = 1.0 - 2.**-53, I believe it's easy to show this under IEEE double precision arithmetic: For every finite, normal, double y 0.0, IEEE_multiply(x, y) y under the default (nearest/even) rounding mode. That implies int(x*i) i for every

[issue24547] What’s New In Python 3.4: stray (

2015-07-01 Thread Roundup Robot
Roundup Robot added the comment: New changeset 74e75a9aa562 by Benjamin Peterson in branch '3.4': remove stray '(' (closes #24547) https://hg.python.org/cpython/rev/74e75a9aa562 -- nosy: +python-dev resolution: - fixed stage: - resolved status: open - closed

[issue24515] docstring of isinstance

2015-07-01 Thread Steven D'Aprano
Steven D'Aprano added the comment: Closing. If anyone thinks the docs aren't clear enough, and has an alternate version they would like to suggest, you can re-open it. -- resolution: - rejected status: open - closed ___ Python tracker

[issue24537] Py_Initialize unable to load the file system codec

2015-07-01 Thread Ned Deily
Changes by Ned Deily n...@acm.org: -- components: +Windows -Extension Modules nosy: +paul.moore, steve.dower, tim.golden, zach.ware ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24537 ___

Re: Javascript website scraping using WebKit and Selenium tools

2015-07-01 Thread dieter
Veek M vek.m1...@gmail.com 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...': div class=item3line1 dl class=item

[issue24546] sequence index bug in random.choice

2015-07-01 Thread Steven D'Aprano
Steven D'Aprano added the comment: Your example of int(0.5) returning 1 is misleading, because 0.999...95 is already 1.0. (1.0 - 1/2**53) = 0. is the nearest float distinguishable from 1.0. It seems to me that either random() may return 1.0 exactly (although

[issue24548] Broken link in the unittest documentation

2015-07-01 Thread Ned Deily
Changes by Ned Deily n...@acm.org: -- nosy: +ezio.melotti, michael.foord, rbcollins stage: - needs patch type: enhancement - versions: +Python 2.7, Python 3.4, Python 3.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24548

[issue24540] Documentation about skipkeys parameter for json.dumps is incorrect

2015-07-01 Thread Ned Deily
Ned Deily added the comment: Can you say where you are seeing this? The current 2.7 documentation for json reads: If skipkeys is True (default: False), then dict keys that are not of a basic type (str, unicode, int, long, float, bool, None) will be skipped instead of raising a TypeError.

Re: Installing Pybison

2015-07-01 Thread dieter
Great Avenger Singh arsh...@gmail.com 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

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',

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:

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 an 0 to 12

[issue18597] On Windows sys.stdin.readline() doesn't handle Ctrl-C properly

2015-07-01 Thread eryksun
eryksun added the comment: In Windows 10 ReadFile doesn't set ERROR_OPERATION_ABORTED (995) for Ctrl+C when reading console input, but ReadConsole does. from ctypes import * kernel32 = WinDLL('kernel32', use_last_error=True) buf = (c_char * 1)() n = c_uint()

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 material

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

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 way

[issue24549] string.format() should have a safe_substitute equivalent, to be run consecutively

2015-07-01 Thread Eric V. Smith
Eric V. Smith added the comment: So let's say your function would be named safe_format. Then: {1} {0}.safe_format('one') would give: {1} one. Then: {1} one.safe_format('two') would be an error, because there's no index 1 in the args tuple. I can't imagine how you'd implement this function

[issue24549] string.format() should have a safe_substitute equivalent, to be run consecutively

2015-07-01 Thread Steven D'Aprano
Steven D'Aprano added the comment: I don't think that this behaviour is desirable, certainly not by default. If I write {1} {0}.format('one') that's clearly a programming error and I should get an exception. Chaining a second .format method call afterwards does not make the first one any less

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 values ranging

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 are

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 corners of

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 =

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

[issue23517] datetime.utcfromtimestamp parses timestamps incorrectly

2015-07-01 Thread Timothy Cardenas
Timothy Cardenas added the comment: We are seeing this behavior influencing other libraries in python 3.4. This should never fail if timestamp and fromtimestamp are implemented correctly: from datetime import datetime t = datetime.utcnow().timestamp() t2 = datetime.utcfromtimestamp(t) assert t

[issue23630] support multiple hosts in create_server/start_server

2015-07-01 Thread STINNER Victor
STINNER Victor added the comment: I reviewed multibind.patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23630 ___ ___ Python-bugs-list

Re: normalizing a value

2015-07-01 Thread Paul Rubin
bvdp b...@mellowood.ca 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? --

[issue24400] Awaitable ABC incompatible with functools.singledispatch

2015-07-01 Thread Martin Panter
Martin Panter added the comment: The last change to /Doc/conf.py seems to have screwed up my docs build. Was that an accident? $ make -C Doc/ htmlsphinx-build -b html -d build/doctrees -D latex_paper_size= . build/html Running Sphinx v1.2.3 loading pickled environment... done Theme error:

[issue24400] Awaitable ABC incompatible with functools.singledispatch

2015-07-01 Thread Roundup Robot
Roundup Robot added the comment: New changeset 68996acdec6f by Yury Selivanov in branch '3.5': docs/conf: Undo changes in b2a3baa1c2b0; issue #24400 https://hg.python.org/cpython/rev/68996acdec6f -- ___ Python tracker rep...@bugs.python.org

[issue24400] Awaitable ABC incompatible with functools.singledispatch

2015-07-01 Thread Yury Selivanov
Yury Selivanov added the comment: Thanks, Martin, it was indeed something that shouldn't been committed. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24400 ___

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 places

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...': div class=item3line1 dl class=item data-id=38952795780 dt class=photo a

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: x

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:

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 [OldSample {u'counter_name': u'cpu_util', u'user_id': u'id', u'resource_id': u'id', u'timestamp': u'2015-06-30T15:53:55',

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 where I