Re: SSL certification fails / tweepy [SOLVED]
"K. Elo" writes: > ... > I still wonder why openSuSE certificates are not working out-of-box > with python. Maybe some of the packages were not correctly installed... Certificates have a validity period -- usually, they need to be renewed from time to time (to get a new vality period). -- https://mail.python.org/mailman/listinfo/python-list
Re: Vebnest Offers - VPS Hosting with 25% Discount on Monthly Plans
VEBNEST offer reliable and scalable reseller web hosting solution for its resellers which includes free website builder, 100s of free scripts, whm/cpanel and cloud linux VEBNEST serving lots of resellers around the world 24/7. We offer Reseller hosting with powerfull cloud linux based servers, whm/cpanel, free Website builder and free scripts. VEBNEST offer 24/7 web solutions since 2007 to its customers around the world. We own and manage more than 1000 Dedicated Servers and hosting over 10 Domains at our servers located in USA and EU Data Centers. We have experienced and qualified staff which work 24/7 to help our customers. Vebnest is providing different reliable web services to its customers like: Website development,Email Marketing,Online marketing,seo and etc Vebnest is providing a different affordable and reliable packages for its customer Packages we offers are : Economy: $9.99 / per month Specifications: 100 GB Disk Space 100 GB Bandwidth Monthly Free Domain Registration Host Unlimited Domains FREE Website Builder WHM/Cpanel FREE 24/7 Support Standard $14.99 / per month Specifications: 200 GB Disk Space 200 GB Bandwidth Monthly Free Domain Registration Host Unlimited Domains FREE Website Builder WHM/Cpanel FREE 24/7 Support Professional $19.99 / per month Specifications: 500 GB Disk Space 500 GB Bandwidth Monthly Free Domain Registration Host Unlimited Domains FREE Website Builder WHM/Cpanel FREE 24/7 Support For more information : Contact us: Website: http://www.vebnest.com Email Address: i...@vebnest.com -- https://mail.python.org/mailman/listinfo/python-list
Python and Word OLE
Hi All I am trying to change the active printer using win32com.client with the following code wordapp = win32com.client.Dispatch('Word.Application') worddoc = wordapp.Documents.Open(mypathfile) print(wordapp.ActivePrinter) "\\server\queries" wordapp.ActivePrinter = "\\server\letters" //fails on this line File "C:\Anaconda3\lib\site-packages\win32com\client\dynamic.py", line 544, in __setattr__ self._oleobj_.Invoke(entry.dispid, 0, invoke_type, 0, value) pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft Word', 'There is a printer error.', 'wdmain11. chm', 24696, -2146823072), None) If I don't try to change printers - it prints too the default printer. Cheers Colin -- https://mail.python.org/mailman/listinfo/python-list
Re: virtualenv: help me decide
On 15Jan2016 03:37, Paulo da Silva wrote: I am about to install tensorflow and I am considering to use virtualenv. Unfortunately I don't know anything about this. It makes a directory tree with its own libraries and "python" and "pip" executables. When you run the "python" executable it invokes the "real" python (that used to make the virtualenv) with the right settings to use the virtualenv's library etc. Likewise the "pip" will automatically install into the virtualenv. Great to experiments, isolation or simply "python like this" setups. So, a couple of questions before I dig more ... 1. Are all already installed python stuff visible inside virtualenv? If you build the virtualenv with --system-site-packages, yes. Otherwise it is standalone. I like --system-site-packages myself - if I use the OS vendor's package management to obtain somethings then they're available for free in the virtualenv. So my make a virtualenv incanation runs: mkdir the-virtualenv-dir virtualenv -p /path/to/chosen/python --system-site-packages the-virtualenv-dir 2. I used to use eclipse for development. Is it usable within virtualenv? I imagine so. I'm not an eclipse user, but I've never seen a complaint on the list about this. Virtualenv is so easy to use that i suggest you just try it and see. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list
Re: Stop writing Python 4 incompatible code
On Fri, Jan 15, 2016 at 2:08 PM, Gregory Ewing wrote: > Steven D'Aprano wrote: > >> Maybe Guido will change his mind and we'll have 3.10. 3.11, 3.12, ... > > > Who says that version numbers have to be base 10? After > 3.9 we could have 3.A, 3.B, ... 3.Z, and then we have > a long list of Unicode characters to work through before > we're forced to bump the major number up... We would have to skip a few - 3.I and 3.O are too confusing, and 3.X would wreak havoc with people's heads. But then, so would 3.A... Let's do this. Wreak the havoc. Unleash the folly. Dispel the sanity! ChrisA -- https://mail.python.org/mailman/listinfo/python-list
virtualenv: help me decide
Hi all! I am about to install tensorflow and I am considering to use virtualenv. Unfortunately I don't know anything about this. So, a couple of questions before I dig more ... 1. Are all already installed python stuff visible inside virtualenv? 2. I used to use eclipse for development. Is it usable within virtualenv? Thanks for any help -- https://mail.python.org/mailman/listinfo/python-list
Re: Stop writing Python 4 incompatible code
Steven D'Aprano wrote: Maybe Guido will change his mind and we'll have 3.10. 3.11, 3.12, ... Who says that version numbers have to be base 10? After 3.9 we could have 3.A, 3.B, ... 3.Z, and then we have a long list of Unicode characters to work through before we're forced to bump the major number up... -- Greg -- https://mail.python.org/mailman/listinfo/python-list
Re: problem
On Jan 14, 2016 10:58 PM, "Shivam Gupta" wrote: > > Hello, > > I am using python 3.5.1 on my windows 8.1. The problem is that whenever i > save any file any after that when i run it the screen just close > immediately after i double click on python file. > > Thank you. Hi there, Try opening the file in Python IDLE, and run it there. Or, open a command line in the directory that contains your file, and type python filename.py At least, this way, the cmd doesn't close by itself. Cheers, Andrew -- https://mail.python.org/mailman/listinfo/python-list
Re: Stop writing Python 4 incompatible code
On Thursday, January 14, 2016 at 4:53:42 PM UTC-6, Ian wrote: > On Thu, Jan 14, 2016 at 8:52 AM, Rick Johnson > > [...] > > > I wonder if he's considered the possibility that Google may > > swoop in an purchase Dropbox at some time in the near > > future, and he could find himself working for google once > > again. > > Google already has a cloud storage service. Yeah, and it sucks donkey balls! But, when you have almost infinitely deep pockets, like Google, you don't need to create *everything* yourself, no, you simply wait for someone else to build it, then wait a little longer for them to market it successfully, and when it's jt starting to turn a profit, you swoop in, purchase it, and then you drive that "money train" at full speed until its wheels fall off! And if the owners refuse to sell, no problem, you offer their customers the same services at bargain basement discounts -- then they'll have no choice but to sell, or face bankruptcy. Yep, just another tactic of economic warfare. -- https://mail.python.org/mailman/listinfo/python-list
Re: Stop writing Python 4 incompatible code
On Thursday, January 14, 2016 at 4:04:48 PM UTC-6, Steven D'Aprano wrote: > Into the sin-bin you go for another three months. Enjoy your time in > the kill-file. https://www.youtube.com/watch?v=CuDEP6eFkeA -- https://mail.python.org/mailman/listinfo/python-list
Re: Stop writing Python 4 incompatible code
On Thu, Jan 14, 2016 at 8:52 AM, Rick Johnson wrote: > So you're suggesting that GvR *WILLINGLY* left a global, and > well established giant, to work for a tiny start-up because > his bosses refused to switch from Python2 to (his new baby) > Pyhton3? > > So, let me get this strait: he wasn't fired, *HE QUIT*??? It's even still plausible if you just cut everything after the "because" from that first sentence. People leave large companies like Google to go work at start-ups where they believe they'll be able to have more impact all the time. It's certainly much more likely than your speculation that he was fired because of Python 3. Google isn't in the habit of firing talented engineers for idiotically trivial reasons so they can be scooped up by the competition. > I wonder if he's considered the possibility that Google may > swoop in an purchase Dropbox at some time in the near > future, and he could find himself working for google once > again. Google already has a cloud storage service. > And you know what would be the ultimate form of > irony, if they forced him to migrate Dropbox *BACK* to > Python2! What a ridiculous waste of programmer time that would be. -- https://mail.python.org/mailman/listinfo/python-list
Re: Post processing contour plot, how?
Sorry for the short response, but check out this Stack Overflow question/answer http://stackoverflow.com/q/5666056/1612701 On Thu, Jan 14, 2016 at 3:42 PM, Martin Schöön wrote: > I am interested in creating contours but not for printing or > including in a report as an illustration. I want to go on > working on a numerical representation of the contours. > > Creating contour plots using matplotlib is a breeze but I fail > to find a way to export the contours thus created in a numerical > format. Scilab has such a function but I try to reduce the number > of tools I use and I try to focus on Python. > > So, I could write my own find-contours algorithm but I think > there should be a way of extracting the contours created by > matplotlib even if I have failed to find out how. > > Does anyone know how to do this? > > I have found one very manually involved way starting with > saving the figure in svg format and the open that file in > a text editor. > > /Martin > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list
Re: me, my arm, my availability ...
Just get better Laura... -- https://mail.python.org/mailman/listinfo/python-list
Re: Stop writing Python 4 incompatible code
On Fri, 15 Jan 2016 02:30 am, Rick Johnson wrote: > I represent Absolutely nobody except yourself. The entertainment value of your trolling has now dipped below the annoyance value. Into the sin-bin you go for another three months. Enjoy your time in the kill-file. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Post processing contour plot, how?
I am interested in creating contours but not for printing or including in a report as an illustration. I want to go on working on a numerical representation of the contours. Creating contour plots using matplotlib is a breeze but I fail to find a way to export the contours thus created in a numerical format. Scilab has such a function but I try to reduce the number of tools I use and I try to focus on Python. So, I could write my own find-contours algorithm but I think there should be a way of extracting the contours created by matplotlib even if I have failed to find out how. Does anyone know how to do this? I have found one very manually involved way starting with saving the figure in svg format and the open that file in a text editor. /Martin -- https://mail.python.org/mailman/listinfo/python-list
Re: problem
On Thu, Jan 14, 2016 at 3:10 PM, Chris Angelico wrote: > On Fri, Jan 15, 2016 at 6:01 AM, Irmen de Jong wrote: >> Either put something like this at the end of your python scripts, to keep >> the console open: >> >> raw_input("press enter to exit...") > > Small qualification: This is 3.5, so you should use input instead of > raw_input. > > input("Press enter to exit...") You can also make the interpreter enter the REPL by setting PYTHONINSPECT, which works for the current process since this gets checked at exit. import os os.environ['PYTHONINSPECT'] = '1' Or use subprocess.Popen to start a new cmd shell attached to the current console: import subprocess subprocess.Popen('cmd.exe') -- https://mail.python.org/mailman/listinfo/python-list
Re: problem
On Fri, Jan 15, 2016 at 6:01 AM, Irmen de Jong wrote: > Either put something like this at the end of your python scripts, to keep the > console open: > > raw_input("press enter to exit...") > > Small qualification: This is 3.5, so you should use input instead of raw_input. input("Press enter to exit...") ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: ignoring or replacing white lines in a diff
Adriaan Renting wrote: > > Maybe someone here has a clue what is going wrong here? Any help is > appreciated. > > I'm writing a regression test for a module that generates XML. > > I'm using diff to compare the results with a pregenerated one from an > earlier version. > > I'm running into two problems: > > The diff doesn't seem to behave properly with the -B option. (diff (GNU > diffutils) 2.8.1 on OSX 10.9) > > Replacing -B with -I '^[[:space:]]*$' fixes it on the command line, > which should be exactly the same according to: > http://www.gnu.org/software/diffutils/manual/html_node/Blank-Lines.html#Blank-Lines > > (for Python problem continue below) > > MacRenting 21:00-159> diff -w -B test.xml xml/Ticket_6923.xml > 3,5c3,5 > < 2.15.0 >> < XML Template generator version 2.15.0 > --- >> 2.6.0 >>changedBy="Alwin de Jong"> >> XML Template generator version > 2.6.0 > 113d112 > < > 163d161 > < > 213d210 > < > 258d254 > < > 369d364 > < > 419d413 > < > 469d462 > < > 514d506 > < > 625d616 > < > 675d665 > < > 725d714 > < > 770d758 > < > 881d868 > < > 931d917 > < > 981d966 > < > 1026d1010 > < > 1137d1120 > < > 1187d1169 > < > 1237d1218 > < > 1282d1262 > < > > /Users/renting/src/CEP4-DevelopClusterModel-Story-Task8432- SAS/XML_generator/test > MacRenting 21:00-160> diff -w -I '^[[:space:]]*$' test.xml > xml/Ticket_6923.xml > 3,5c3,5 > < 2.15.0 > > < XML Template generator version 2.15.0 > --- >> 2.6.0 >>changedBy="Alwin de Jong"> >> XML Template generator version > 2.6.0 > > > Now I try to use this in Python: > > cmd = ["diff", "-w", "-I '^[[:space:]]*$'", "./xml/%s.xml" % > name, "test.xml"] Instead of ..., "-I '^[[:space:]]*$'", ... try two separate arguments ..., "-I", "^[[:space:]]*$", ... > ## -w ignores differences in whitespace > ## -I '^[[:space:]]*$' because -B doesn't work for blank lines > (on OSX?) > p = subprocess.Popen(cmd, stdin=open('/dev/null'), > stdout=subprocess.PIPE, stderr=subprocess.PIPE) I don't think you need to specify stdin. > logs = p.communicate() > diffs = logs[0].splitlines() #stdout > print "diff reply was %i lines long" % len(diffs) > > This doesn't work. I've tried escaping the various bits, like the * and > $, even though with single quotes that should not be needed. > > I tried first removing the blank lines from the file: > > import fileinput > for line in fileinput.FileInput("test.xml",inplace=1): > if line.rstrip(): > print line > > This makes it worse, as it adds and empty line for each line in the > file. Add a trailing comma to suppress the newline: print line, > I've tried various other options. The only thing I can think of, is > ditching Python and trying to rewrite the whole script in Bash. > (It's quite complicated, as it loops over various things and does some > pretty output in between and I'm not very fluent in Bash) > > Any suggestions? Whatever floats your boat ;) -- https://mail.python.org/mailman/listinfo/python-list
Re: ignoring or replacing white lines in a diff
Hello Adriaan, >Maybe someone here has a clue what is going wrong here? Any help is >appreciated. Have you tried out this tool that does precisely what you need? to do yourself? https://pypi.python.org/pypi/xmldiff I can't vouch specifically for it, am simply a user, but I know that I have used it happily in the past. (Other CLI tools, include non-Python tools, such as xmllint, which can produce a predictable, reproducible XML formatting, too.) >I'm writing a regression test for a module that generates XML. Very good. Good == Testing. >I'm using diff to compare the results with a pregenerated one from an >earlier version. [ Interesting. I can only speculate randomly about the whitespace issue. Have you examined (with the CLI tools hexdump, od or your favorite byte dumper) the two different XML outputs? ] Back to the lands of Python > cmd = ["diff", "-w", "-I '^[[:space:]]*$'", "./xml/%s.xml" % name, > "test.xml"] It looks like a quoting issue. I think you are passing the following tokens to your OS. You should be able to run your Python program under a system call tracer to see what is actually getting exec()d. I'm accustomed to using strace, but it seems that Macintosh uses dtruss. Anyway, I think your cmd is turning into this (as for as your kernel is concerned): token 1: diff token 2: -w token 3: -I '^[[:space:]]*$' token 4: ./xml/name.xml token 5: test.xml Try this (untested): > cmd = ["diff", "-w", "-I", "^[[:space:]]*$", "./xml/%s.xml" % name, > "test.xml"] But, perhaps the xmldiff module will be what you want. -Martin -- Martin A. Brown http://linux-ip.net/ -- https://mail.python.org/mailman/listinfo/python-list
Re: ignoring or replacing white lines in a diff
On 01/14/2016 03:22 PM, Adriaan Renting wrote: Maybe someone here has a clue what is going wrong here? Any help is appreciated. I'm writing a regression test for a module that generates XML. I'm using diff to compare the results with a pregenerated one from an earlier version. I'm running into two problems: The diff doesn't seem to behave properly with the -B option. (diff (GNU diffutils) 2.8.1 on OSX 10.9) Replacing -B with -I '^[[:space:]]*$' fixes it on the command line, which should be exactly the same according to: http://www.gnu.org/software/diffutils/manual/html_node/Blank-Lines.html#Blank-Lines (for Python problem continue below) MacRenting 21:00-159> diff -w -B test.xml xml/Ticket_6923.xml 3,5c3,5 < 2.15.0 < < XML Template generator version 2.15.0 --- 2.6.0 changedBy="Alwin de Jong"> XML Template generator version 2.6.0 113d112 < 163d161 < 213d210 < 258d254 < 369d364 < 419d413 < 469d462 < 514d506 < 625d616 < 675d665 < 725d714 < 770d758 < 881d868 < 931d917 < 981d966 < 1026d1010 < 1137d1120 < 1187d1169 < 1237d1218 < 1282d1262 < /Users/renting/src/CEP4-DevelopClusterModel-Story-Task8432-SAS/XML_generator/test MacRenting 21:00-160> diff -w -I '^[[:space:]]*$' test.xml xml/Ticket_6923.xml 3,5c3,5 < 2.15.0 < < XML Template generator version 2.15.0 --- 2.6.0 changedBy="Alwin de Jong"> XML Template generator version 2.6.0 Now I try to use this in Python: cmd = ["diff", "-w", "-I '^[[:space:]]*$'", "./xml/%s.xml" % name, "test.xml"] ## -w ignores differences in whitespace ## -I '^[[:space:]]*$' because -B doesn't work for blank lines (on OSX?) p = subprocess.Popen(cmd, stdin=open('/dev/null'), stdout=subprocess.PIPE, stderr=subprocess.PIPE) logs = p.communicate() diffs = logs[0].splitlines() #stdout print "diff reply was %i lines long" % len(diffs) This doesn't work. I've tried escaping the various bits, like the * and $, even though with single quotes that should not be needed. I tried first removing the blank lines from the file: import fileinput for line in fileinput.FileInput("test.xml",inplace=1): if line.rstrip(): print line This makes it worse, as it adds and empty line for each line in the file. I've tried various other options. The only thing I can think of, is ditching Python and trying to rewrite the whole script in Bash. (It's quite complicated, as it loops over various things and does some pretty output in between and I'm not very fluent in Bash) Any suggestions? Thanks for any help provided. Adriaan Renting. Adriaan Renting| Email: rent...@astron.nl Software Engineer Radio Observatory ASTRON | Phone: +31 521 595 100 (797 direct) P.O. Box 2 | GSM: +31 6 24 25 17 28 NL-7990 AA Dwingeloo | FAX: +31 521 595 101 The Netherlands| Web: http://www.astron.nl/~renting/ Without having the files handy to test with, I would suggest that you try replacing "-I '^[[:space:]]*$'" with r"-I '^[[:space:]]*$'" as a starting point. Nathan -- https://mail.python.org/mailman/listinfo/python-list
Re: ignoring or replacing white lines in a diff
On Thu, Jan 14, 2016 at 2:22 PM, Adriaan Renting wrote: > Any suggestions? Instead of trying to make diff behave through subprocess, have a look at Python's difflib: https://docs.python.org/3/library/difflib.html In particular, I think `difflib.ndiff(first_list_of_strings, second_list_of_strings, linejunk=difflib.IS_LINE_JUNK)` might be what you're looking for (you may not even need to specify linejunk). -- Zach -- https://mail.python.org/mailman/listinfo/python-list
ignoring or replacing white lines in a diff
Maybe someone here has a clue what is going wrong here? Any help is appreciated. I'm writing a regression test for a module that generates XML. I'm using diff to compare the results with a pregenerated one from an earlier version. I'm running into two problems: The diff doesn't seem to behave properly with the -B option. (diff (GNU diffutils) 2.8.1 on OSX 10.9) Replacing -B with -I '^[[:space:]]*$' fixes it on the command line, which should be exactly the same according to: http://www.gnu.org/software/diffutils/manual/html_node/Blank-Lines.html#Blank-Lines (for Python problem continue below) MacRenting 21:00-159> diff -w -B test.xml xml/Ticket_6923.xml 3,5c3,5 < 2.15.0 < < XML Template generator version 2.15.0 --- > 2.6.0 > > XML Template generator version 2.6.0 113d112 < 163d161 < 213d210 < 258d254 < 369d364 < 419d413 < 469d462 < 514d506 < 625d616 < 675d665 < 725d714 < 770d758 < 881d868 < 931d917 < 981d966 < 1026d1010 < 1137d1120 < 1187d1169 < 1237d1218 < 1282d1262 < /Users/renting/src/CEP4-DevelopClusterModel-Story-Task8432-SAS/XML_generator/test MacRenting 21:00-160> diff -w -I '^[[:space:]]*$' test.xml xml/Ticket_6923.xml 3,5c3,5 < 2.15.0 < < XML Template generator version 2.15.0 --- > 2.6.0 > > XML Template generator version 2.6.0 Now I try to use this in Python: cmd = ["diff", "-w", "-I '^[[:space:]]*$'", "./xml/%s.xml" % name, "test.xml"] ## -w ignores differences in whitespace ## -I '^[[:space:]]*$' because -B doesn't work for blank lines (on OSX?) p = subprocess.Popen(cmd, stdin=open('/dev/null'), stdout=subprocess.PIPE, stderr=subprocess.PIPE) logs = p.communicate() diffs = logs[0].splitlines() #stdout print "diff reply was %i lines long" % len(diffs) This doesn't work. I've tried escaping the various bits, like the * and $, even though with single quotes that should not be needed. I tried first removing the blank lines from the file: import fileinput for line in fileinput.FileInput("test.xml",inplace=1): if line.rstrip(): print line This makes it worse, as it adds and empty line for each line in the file. I've tried various other options. The only thing I can think of, is ditching Python and trying to rewrite the whole script in Bash. (It's quite complicated, as it loops over various things and does some pretty output in between and I'm not very fluent in Bash) Any suggestions? Thanks for any help provided. Adriaan Renting. Adriaan Renting| Email: rent...@astron.nl Software Engineer Radio Observatory ASTRON | Phone: +31 521 595 100 (797 direct) P.O. Box 2 | GSM: +31 6 24 25 17 28 NL-7990 AA Dwingeloo | FAX: +31 521 595 101 The Netherlands| Web: http://www.astron.nl/~renting/ -- https://mail.python.org/mailman/listinfo/python-list
ANN: Wing IDE 5.1.9 released
Hi, Wingware has released version 5.1.9 of Wing IDE, our cross-platform integrated development environment for the Python programming language. Wing IDE features a professional code editor with vi, emacs, visual studio, and other key bindings, auto-completion, call tips, context-sensitive auto-editing, goto-definition, find uses, refactoring, a powerful debugger, version control, unit testing, search, project management, and many other features. This release includes the following minor improvements: Added --settings= and --cache= command line options for changing the location of the settings and cache directories Added Mercurial resolve command French localization updates (thanks to Jean Sanchez) Fix failure to enable Stack Data and Watch lists in some cases when using multi-process debugging Fix failure to call atexit functions when debug ends on Windows Fix auto-spacing in PEP484 type annotations Fix several problems with text rewrapping Fix Run As Package Module in Testing properties Fix debugger when using external console and Python 3.x Partially fixed Django 1.9 template debugging (complete fix requires changes to Django; see see https://code.djangoproject.com/ticket/25848 ) Fix failure to goto base class in browser after switching projects Fix defining custom keys with modifiers other than Alt and Ctrl in non-English locales About 10 other minor bug fixes For details see http://wingware.com/news/2016-01-13 and http://wingware.com/pub/wingide/5.1.9/CHANGELOG.txt What's New in Wing 5.1: Wing IDE 5.1 adds multi-process and child process debugging, syntax highlighting in the shells, support for pytest, Find Symbol in Project, persistent time-stamped unit test results, auto-conversion of indents on paste, an XCode keyboard personality, support for Flask, Django 1.7, 1.8, and 1.9, Python 3.5 and recent Google App Engine versions, improved auto-completion for PyQt, recursive snippet invocation, and many other minor features and improvements. Free trial: http://wingware.com/wingide/trial Downloads: http://wingware.com/downloads Feature list: http://wingware.com/wingide/features Sales: http://wingware.com/store/purchase Upgrades: https://wingware.com/store/upgrade Questions? Don't hesitate to email us at supp...@wingware.com. Thanks, -- Stephan Deibel Wingware | Python IDE The Intelligent Development Environment for Python Programmers wingware.com -- https://mail.python.org/mailman/listinfo/python-list
Re: issues
Hi Gert, just upgrade to 5.03. Best, Sven On 13.01.2016 18:38, Gert Förster wrote: Ladies, Gentlemen, using the PyCharm Community Edition 4.5.4, with Python-3-5-1-amd64.exe, there is constantly a “Repair”-demand. This is “successful” when executed. Without execution, there results an “Error code 1602” error. Please help me? Sincerely Yours, Gert Förster -- https://mail.python.org/mailman/listinfo/python-list
Re: Stop writing Python 4 incompatible code
I am confident that in a few years there will be sufficient new developments in language design that some degree of backward compatibility would be worth dropping in order to provide greater capabilities. If it needs to fork and become another language, that's OK. -- https://mail.python.org/mailman/listinfo/python-list
Re: problem
On 14-1-2016 16:53, Shivam Gupta wrote: > Hello, > > I am using python 3.5.1 on my windows 8.1. The problem is that whenever i > save any file any after that when i run it the screen just close > immediately after i double click on python file. > > Thank you. > That's not a python thing, it's the way the windows console behaves. As soon as any script or console command it executes finishes, it closes. Either put something like this at the end of your python scripts, to keep the console open: raw_input("press enter to exit...") or run them from an existing console prompt instead of clicking on them. Irmen -- https://mail.python.org/mailman/listinfo/python-list
Re: Stop writing Python 4 incompatible code
On Thursday, January 14, 2016 at 11:41:21 AM UTC-6, Chris Angelico wrote: > Prove this. Find "general public consensus" that Python is > dead. And then, imitate rats and abandon this sinking > ship. I don't need to "imitate" anything, it has already begun. > I decided to give 3D modelling a go, after watching some > amazing work done on Twitch.tv. A lot of people recommend > Maya, but I'd rather use GPL software than proprietary > (particularly when the latter has a thousands-of-dollars > price tag), so I grabbed Blender. Anyone want to hazard a > guess as to the language Blender uses for scripting, > expression evaluation, and so on? Blender is a nice freeware modeling program, and is great for organic modeling, animations, photo realistic rendering, game creation, and yes, exposes a Pyhton API -- but what is your point? The Python scripting features have been a part of Blender for many years, back when Python3 was just a "innocent mis-folded programming protein" rotting holes in the BDFL's pre-frontal cortex. The existence of Python3 in the wild, is merely evidence that the original PrP has replicated exponentially. -- https://mail.python.org/mailman/listinfo/python-list
Re: When I need classes?
On Tuesday, January 12, 2016 at 11:27:23 PM UTC-6, Steven D'Aprano wrote: > On Wednesday 13 January 2016 14:36, Rustom Mody wrote: > > > 1. Python the LANGUAGE, is rather even-handed in paradigm choice: > > Choose OO, imperative, functional or whatever style pleases/suits > > you 2. Python LIBRARIES however need to make committing choices. > > Users of those then need to align with these. > > I don't think that second one is necessarily correct. Look at the > random module: it is based on an OOP design, with classes > random.Random and random.SystemRandom doing the real work. But most > people don't use them directly, they use the procedural interface > random.random, random.choice, random.seed etc. Of course, because these "procedural interfaces" are the most convenient (in this case). Obviously that's what Rustom was pointing out: "utilize the most convenient aspects of the interface" to get the job done. If you juxtapose the "interface of starting an automobile engine" with the "interface of the random module", you could say that the convenience of the ignition switch is like the convenience of the three functions "random.random, random.choice, and random.seed", and that, the inconvenience of crawling under the vehicle and utilizing a metal *OBJECT* (like a screwdriver) to arc the two contacts on the starter, is much the same as utilizing the random.Random object -- both may achieve the same end goal, but one "interface" happens to be more convenient than the other. In this case, the procedural interface, and not the OOP interface -- but this is not always the case! Some functionalities cannot be reduced to the "gleeful convenience" of a single procedure, at least, not without sacrificing too much control! Not only will you need to wield the power of OOP to *EXTEND* a "general functionally" into a more "specific form", but also when you need a "reusable package" of procedures and (their shared data) which can *ONLY* be modeled "sanely" by utilizing the OOP paradigm! For instance, you can write Tkinter[1] GUI code in a procedural form, utilizing the classes that are made available to you, but for anything more than the most simplistic "toy GUI", i would highly suggest against it! REFERENCES: [1] Tkinter is used as an example here because it is a primitive GUI library that does not include many of the controls that modern GUI interfaces demand. For any advanced usage, a programmer would be forced to create his *OWN* controls, and to do so "proceduraly", would result in an unmanageable nightmare. In order to achieve maintainability, inevitably, you end up utilizing the *SAME* modular design techniques of OOP! So the question begs: Why not use OOP in the first place? I am never without amazement as to the lengths people will go to excuse their "nostalgic clinging"! -- https://mail.python.org/mailman/listinfo/python-list
Re: me, my arm, my availability ...
On Jan 13, 2016, at 3:47 PM, Laura Creighton wrote: > > I fell recently. Ought to be nothing, but a small chip of bone, either an > existing one or one I just made is nicely wedged in the joint taking away > a whole lot of the ability of my arm to rotate in the elbow joint. Or > hold my arm in a position that is usual for typing. Plus, now that the > sprain/swelling is more or less over, the pain, unfortunately is not. > > The real downside is that my typing speed is down from 135-140 wpm > to 5-10 wmp. At this rate, just getting my usual work done takes > overtime. > > Seems like surgery is needed to fix this. > > So I wanted you all to know, no, I haven't forgotten you and no haven't > stopped caring. I have just stopped being as __capable__ if you know > what I mean. > > Please take care of yourselves and each other. I will often be reading > even if typing is more than I can do right now. > > Laura > > ps -- (recent tutor discussion) I am with Alan and not with Mark. I > am happy as anything when people post their not-quite-working code for > homework assignments here to tutor. They aren't lazy bastards wanting > somebody to do their assignments for them, they want to learn why what > they are trying to do isn't working. Sounds perfect for tutor to me. Good luck healing! Hope you get better soon. Surgery has gotten a WHOLE lot better recently, they did wonders for my knee a few years back. With luck, it'll be more or less outpatient surgery. Good luck, Cem Karan -- https://mail.python.org/mailman/listinfo/python-list
Re: Stop writing Python 4 incompatible code
On Fri, Jan 15, 2016 at 2:30 AM, Rick Johnson wrote: > (3) After Python3 came along, the Python community has > become fractured, and the Python code base has become > fractured, and the general public consensus is that Python > is on its way to extinction (FACT!) Prove this. Find "general public consensus" that Python is dead. And then, imitate rats and abandon this sinking ship. I decided to give 3D modelling a go, after watching some amazing work done on Twitch.tv. A lot of people recommend Maya, but I'd rather use GPL software than proprietary (particularly when the latter has a thousands-of-dollars price tag), so I grabbed Blender. Anyone want to hazard a guess as to the language Blender uses for scripting, expression evaluation, and so on? ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Stop writing Python 4 incompatible code
D'Arcy J.M. Cain wrote: > On Thu, 14 Jan 2016 16:32:46 +0100 > Peter Otten <__pete...@web.de> wrote: >> >> > Or we'll be hit by a big rock from space. >> >> Sounds like a plan. >> > Which one? Number 9? >> >> Hm, I didn't expect this question... >> >> plans[-1], most certainly. > > Hmm. Am I being too subtle or...? AOL > from OuterSpace import plan > print(plan[9]) > > If that's still too subtle: > https://en.wikipedia.org/wiki/Plan_9_from_Outer_Space OK -- this joke is no more. It has ceased to be. It's expired and gone to meet its maker. This is a late joke. It's a stiff. Bereft of life, it rests in peace. If you hadn't nailed it to the perch, it would be pushing up the daisies. It's rung down the curtain and joined the choir invisible. This is an ex-joke. ;) -- https://mail.python.org/mailman/listinfo/python-list
Convert timeseries GDAL raster format (vrt) to NetCDF
I tried to package a timeseries for vrt file to NetCDF. The problem is, it converts layer by layer and save it to NetCDF which it took much time (also with memory allocation). I wanted to do is to save it chunk by chunk which I do not have any idea how to do it ! Does someone have any solution for that !? it take for 1Gb (25 images) around 90 second !! here is my code: def tiff_to_netcdf(imagesPath, output, chunksize=None): img_txt = open('img_path.txt', 'w') for paths, subdirs, files in os.walk(imagesPath): for name in files: if name.endswith('.tif'): img_txt.write(os.path.join(paths, name) + '\n') img_txt.close() # Build vrt files os.system('gdalbuildvrt -separate -input_file_list img_path.txt images.vrt') ds = gdal.Open('images.vrt') band1 = ds.GetRasterBand(1) a = band1.ReadAsArray() nlat, nlon = np.shape(a) b = ds.GetGeoTransform() # bbox, interval lon = np.arange(nlon)*b[1]+b[0] lat = np.arange(nlat)*b[5]+b[3] basedate = dt.datetime(2006, 01, 11, 0, 0, 0) # Create NetCDF file # Clobber- Overwrite any existing file with the same name nco = netCDF4.Dataset(output+'.nc', 'w', clobber=True) # Create dimensions, variables and attributes: nco.createDimension('lon', nlon) nco.createDimension('lat', nlat) nco.createDimension('time', None) timeo = nco.createVariable('time', 'f4', ('time',)) timeo.units = 'days since 2006-01-11 00:00:00' timeo.standard_name = 'time' lono = nco.createVariable('lon', 'f4', ('lon',)) lono.standard_name = 'longitude' lato = nco.createVariable('lat', 'f4', ('lat',)) lato.standard_name = 'latitude' # Create container variable for CRS: lon/lat WGS84 datum crso = nco.createVariable('crs', 'i4') crso.long_name = 'Lon/Lat Coords in WGS84' crso.grid_mapping_name = 'latitude_longitude' crso.longitude_of_prime_meridian = 0.0 crso.semi_major_axis = 6378137.0 crso.inverse_flattening = 298.257223563 # Create short integer variable with chunking tmno = nco.createVariable('tmn', 'i2', ('time', 'lat', 'lon'), zlib=True, chunksizes=chunksize, fill_value=-) tmno.scale_factor = 0.01 tmno.add_offset = 0.00 tmno.grid_mapping = 'crs' tmno.set_auto_maskandscale(False) nco.Conventions = 'CF-1.6' # Write lon,lat lono[:] = lon lato[:] = lat pat = re.compile(r'^(\w{1})(\d{4})(\d{2})(\d{2})_\d{6}___SIG0.*.tif$') itime = 0 written = 0 data = np.empty((3, 8000, 8000), dtype=np.float) # Step through data, writing time and data to NetCDF for root, dirs, files in os.walk(imagesPath): dirs.sort() files.sort() for f in files: match = re.match(pat, f) if match: if itime % 3 == 0 and itime != 0: tmno[written:itime, :, :] = data written = itime # read the time values by parsing the filename year = int(match.group(2)) mon = int(match.group(3)) day = int(match.group(4)) date = dt.datetime(year, mon, day, 0, 0, 0) print(date) dtime = (date-basedate).total_seconds()/86400. timeo[itime] = dtime tmn_path = os.path.join(root, f) print(tmn_path) tmn = gdal.Open(tmn_path) a = tmn.ReadAsArray() # data data[itime%3, :, :] = a itime = itime+1 nco.close() -- https://mail.python.org/mailman/listinfo/python-list
problem
Hello, I am using python 3.5.1 on my windows 8.1. The problem is that whenever i save any file any after that when i run it the screen just close immediately after i double click on python file. Thank you. -- https://mail.python.org/mailman/listinfo/python-list
Re: Stop writing Python 4 incompatible code
On Wednesday, January 13, 2016 at 11:46:30 PM UTC-6, Terry Reedy wrote: > On 1/13/2016 8:02 PM, Rick Johnson wrote: > > and a leader who lost his cushy job at Google > > Unless you have access to facts that I do not, 'lost' is > impolite speculation. But lets move on. Well i admit my speculation may be leading to an undesirable conclusion, but i can *ONLY* speculate utilizing the facts that are publicly available to me. If we want to prevent rumors, then we need to ensure that *ALL THE FACTS* are available for review. > I have a contrary hypothesis based on the facts quoted > below. As far as I know, Google is somewhat stuck on 2.7. So you're suggesting that GvR *WILLINGLY* left a global, and well established giant, to work for a tiny start-up because his bosses refused to switch from Python2 to (his new baby) Pyhton3? So, let me get this strait: he wasn't fired, *HE QUIT*??? I wonder if he's considered the possibility that Google may swoop in an purchase Dropbox at some time in the near future, and he could find himself working for google once again. And you know what would be the ultimate form of irony, if they forced him to migrate Dropbox *BACK* to Python2! And here is the sign that they will post on his new office door: AND YOU WILL *KNOW* THAT GOOGLE IS THE *LORD*, WHEN WE TRANSFORM YOU FROM A PETULANT LITTLE ENGINEER, INTO AN OBEDIENT LITTLE CODE MONKEY! -- https://mail.python.org/mailman/listinfo/python-list
PyDev 4.5.1 Released
Release Highlights: --- * Debugger * Cython speedup modules are now available for the debugger (see performance improvements at: https://www.speedtin.com/reports/7_pydevd_cython). * It is considerably faster even without the speedup modules (see performance improvements at: https://www.speedtin.com/reports/8_pydevd_pure_python). * When debugging multiple processes the console wasn't being updated to the selected stack in the debug view. * Many bug-fixes. * Improved the search to always play safe and update the index so that the matches are always consistent (#PyDev-634). * Fixed issue renaming top-level module on refactoring. * Refactoring has option to rename variable to a standard case style. * Improved the parser that extracted the outline for global tokens to deal with async and consider declarations inside ifs. * Code completion of properties with @property no longer shows arguments parenthesis (#PyDev-453). * Preventing a freeze if some code-analysis takes too much time (#PyDev-636). * Ctrl+1 can be used to wrap/unwrap the contents of brackets (patch by yohell). What is PyDev? --- PyDev is an open-source Python IDE on top of Eclipse for Python, Jython and IronPython development. It comes with goodies such as code completion, syntax highlighting, syntax analysis, code analysis, refactor, debug, interactive console, etc. Details on PyDev: http://pydev.org Details on its development: http://pydev.blogspot.com What is LiClipse? --- LiClipse is a PyDev standalone with goodies such as support for Multiple cursors, theming, TextMate bundles and a number of other languages such as Django Templates, Jinja2, Kivy Language, Mako Templates, Html, Javascript, etc. It's also a commercial counterpart which helps supporting the development of PyDev. Details on LiClipse: http://www.liclipse.com/ Cheers, -- Fabio Zadrozny -- Software Developer LiClipse http://www.liclipse.com PyDev - Python Development Environment for Eclipse http://pydev.org http://pydev.blogspot.com PyVmMonitor - Python Profiler http://www.pyvmmonitor.com/ -- https://mail.python.org/mailman/listinfo/python-list
Re: Stop writing Python 4 incompatible code
On Thu, 14 Jan 2016 16:32:46 +0100 Peter Otten <__pete...@web.de> wrote: > >> > Or we'll be hit by a big rock from space. > >> Sounds like a plan. > > Which one? Number 9? > > Hm, I didn't expect this question... > > plans[-1], most certainly. Hmm. Am I being too subtle or...? from OuterSpace import plan print(plan[9]) If that's still too subtle: https://en.wikipedia.org/wiki/Plan_9_from_Outer_Space -- D'Arcy J.M. Cain Vybe Networks Inc. http://www.VybeNetworks.com/ IM:da...@vex.net VoIP: sip:da...@vybenetworks.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Stop writing Python 4 incompatible code
On Wednesday, January 13, 2016 at 11:19:16 PM UTC-6, Michael Torrie wrote: > The only one speculating is you. Everything I've read points to this > idea of yours about GvR and Google being untrue. Providing speculation is not the same as providing facts. Please provide facts. And enumerate them! > You have presented no evidence for your accusation, so > given the evidence I have seen that contradicts you, I > must conclude that you made it [up]. Here is an enumerated list of the indisputable facts of this case: (1) GvR is no longer employed by Google (FACT!) (2) Before Python3 came along, the Python community was vibrant and growing (FACT!) (3) After Python3 came along, the Python community has become fractured, and the Python code base has become fractured, and the general public consensus is that Python is on its way to extinction (FACT!) Of course these are not *ALL* the facts, but they are *ALL* the facts that publicly available. If you (and your hero GvR) want to prevent rumors from circulation, them i suggest you provide the relevant facts regarding his change of employment, and simply throwing opinions out that "the change suited him well" is not providing any facts. > I don't know who the "we" you're talking about is, I represent the concerns of entire class of Python community members, folks who are fearful to speak out publicly for fear of reprisals (which is a legitimate fear). > but if your livelihood depends on Python's existence and > development in a certain direction, then [...] you should > be able to adapt to any programming language suitable for > your job at hand. Both myself, and the people i represent, write code in *MANY* languages, but to suggest that we should just """be quiet and translate millions of lines of code into another language because our "dear leader" decided to break backwards compatibility for arbitrary reasons"""... is a quite impractical, don't you think? -- https://mail.python.org/mailman/listinfo/python-list
Re: Stop writing Python 4 incompatible code
D'Arcy J.M. Cain wrote: > On Thu, 14 Jan 2016 14:43:51 +0100 > Peter Otten <__pete...@web.de> wrote: >> > Or we'll be hit by a big rock from space. >> >> Sounds like a plan. > > Which one? Number 9? Hm, I didn't expect this question... plans[-1], most certainly. -- https://mail.python.org/mailman/listinfo/python-list
Re: i am having troubles downloading 3.5.1 to my computer
On 13/01/2016 20:42, Crystal Fernandez wrote: Asked and anwsered repeatedly over the last few weeks. Search the archives for the action(s) you need to take. If you are uncertain here are good starting points. http://catb.org/~esr/faqs/smart-questions.html http://www.sscce.org/ -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: Stop writing Python 4 incompatible code
On Thu, 14 Jan 2016 14:43:51 +0100 Peter Otten <__pete...@web.de> wrote: > > Or we'll be hit by a big rock from space. > > Sounds like a plan. Which one? Number 9? -- D'Arcy J.M. Cain Vybe Networks Inc. http://www.VybeNetworks.com/ IM:da...@vex.net VoIP: sip:da...@vybenetworks.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Stop writing Python 4 incompatible code
Steven D'Aprano wrote: > Or we'll be hit by a big rock from space. Sounds like a plan. -- https://mail.python.org/mailman/listinfo/python-list
Re: i am having troubles downloading 3.5.1 to my computer
On Wed, Jan 13, 2016 at 3:42 PM, Crystal Fernandez < cfernande...@franklinvillecsd.org> wrote: > NLT+CRF <3 > -- > https://mail.python.org/mailman/listinfo/python-list > What operating system? What steps did you take? What error messages did your computer return? If you are using an older version of Windows, you can't use python 3.5 -- Joel Goldstick http://joelgoldstick.com/stats/birthdays -- https://mail.python.org/mailman/listinfo/python-list
Observer pattern implementation in Python based on jQuery
Hi, I made an observer/pubsub pattern implementation in Python based on jQuery. It's available in https://github.com/fernandojunior/python-pattern-observer. Take a look! :) Fernando Felix https://br.linkedin.com/in/fernandofnjr -- https://mail.python.org/mailman/listinfo/python-list
Re: Strange behavior
On Thu, Jan 14, 2016 at 3:03 PM, Michal Nalevanko wrote: > I've just installed Python 3.5.1 on my computer and came across somewhat > strange behavior. > > This is a snapshot of a short code that I wrote: https://goo.gl/izYbD0 > > Quite simple, you might say. Obviously, the program should create a new > text file, nothing else. But do you see the numbers it had added to the > output? > > Is this behavior normal or am I overlooking something? Thank you very much > for your help. Hi Michal! When you work with Python interactively, the interpreter prints out the results of expressions automatically. This doesn't happen when you write a script, but it's often helpful with simple tinkering. The numbers getting printed out are the returned values from the .write() method; they're a simple check saying how much stuff got written. You can ignore them - your file has been created correctly. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
issues
Ladies, Gentlemen, using the PyCharm Community Edition 4.5.4, with Python-3-5-1-amd64.exe, there is constantly a Repair-demand. This is successful when executed. Without execution, there results an Error code 1602 error. Please help me? Sincerely Yours, Gert Förster -- https://mail.python.org/mailman/listinfo/python-list
Strange behavior
Hello, I've just installed Python 3.5.1 on my computer and came across somewhat strange behavior. This is a snapshot of a short code that I wrote: https://goo.gl/izYbD0 Quite simple, you might say. Obviously, the program should create a new text file, nothing else. But do you see the numbers it had added to the output? Is this behavior normal or am I overlooking something? Thank you very much for your help. Michal, Slovakia -- https://mail.python.org/mailman/listinfo/python-list
i am having troubles downloading 3.5.1 to my computer
NLT+CRF <3 -- https://mail.python.org/mailman/listinfo/python-list
Re: How to remove item from heap efficiently?
On Jan 13, 2016, at 2:08 PM, Sven R. Kunze wrote: > On 13.01.2016 12:20, Cem Karan wrote: >> On Jan 12, 2016, at 11:18 AM, "Sven R. Kunze" wrote: >> >>> Thanks for replying here. I've come across these types of >>> wrappers/re-implementations of heapq as well when researching this issue. :) >>> >>> Unfortunately, they don't solve the underlying issue at hand which is: >>> "remove item from heap with unknown index" and be efficient at it (by not >>> using _heapq C implementation). >>> >>> >>> So, I thought I did another wrapper. ;) It at least uses _heapq (if >>> available otherwise heapq) and lets you remove items without violating the >>> invariant in O(log n). I am going to make that open-source on pypi and see >>> what people think of it. >> Is that so? I'll be honest, I never tested its asymptotic performance, I >> just assumed that he had a dict coupled with a heap somehow, but I never >> looked into the code. > > My concern about that specific package is a missing C-implementation. I feel > that somewhat defeats the whole purpose of using a heap: performance. I agree with you that performance is less than that of using a C extension module, but there are other costs associated with developing a C module: 1) As the developer of the module, you must be very careful to ensure your code is portable. 2) Distribution becomes somewhat more difficult; you may need to distribute both source and compiled binaries for various platforms. This is somewhat more annoying than pure python scripts. 3) Debugging can become significantly more difficult. My current codebase is python+cython+c, and when something crashes, it is usually easier to use a bunch of printf() statements to figure out what is going on than to use a debugger (others may have different experiences, this is just mine). 4) Not everyone is familiar with C, so writing extensions may be more difficult. 5) Will the extension module work on non-cpython platforms (iron python, jython, etc.)? Finally, without profiling the complete package it may be difficult to tell what impact your C module will have on overall performance. In my code, HeapDict had less than a 2% performance impact on what I was doing; even if I had replaced it with a pure C implementation, my code would not have run much faster. So, while I agree in principle to what you're saying, in practice there may be other factors to consider before rejecting the pure python approach. > Asymptotic performance is still O(log n). So, if the intent is to pop events more often than to peek at them, then in practice, HeapDict is about the same as some clever heap+dict method (which it might be, as I said, I haven't looked at the code). >> That said, IMHO using a dict interface is the way to go for priority queues; >> it really simplified my code using it! This is my not-so-subtle way of >> asking you to adopt the MutableMapping interface for your wrapper ;) > > Could you elaborate on this? What simplified you code so much? > > I have been using heaps for priority queues as well but haven't missed the > dict interface so far. Maybe, my use-case is different. I'm writing an event-based simulator, and as it turns out, it is much easier to tentatively add events than it is to figure out precisely which events will occur in the future. That means that on a regular basis I need to delete events as I determine that they are garbage. HeapDict did a good job of that for me (for completely unrelated reasons I decided to switch to a pure-C codebase, with python hooks to twiddle the simulator at a few, very rare, points in time; hence the python+cython+c comment above). Thanks, Cem Karan -- https://mail.python.org/mailman/listinfo/python-list
Re: Need help on a project To :"Create a class called BankAccount with the following parameters "
hello lee so what was the final answer u gave for the following question.. reate a constructor that takes in an integer and assigns this to a `balance` property. Create a method called `deposit` that takes in cash deposit amount and updates the balance accordingly. Create a method called `withdraw` that takes in cash withdrawal amount and updates the balance accordingly. if amount is greater than balance return `"invalid transaction"` Create a subclass MinimumBalanceAccount of the BankAccount class -- https://mail.python.org/mailman/listinfo/python-list
Re: How to remove item from heap efficiently?
On 7 January 2016 at 22:52, Sven R. Kunze wrote: > > suppose, I need items sorted by two criteria (say timestamp and priority). > For that purpose, I use two heaps (heapq module): > > heapA # items sorted by timestamp > heapB # items sorted by priority > > Now my actual problem. When popping an item of heapA (that's the oldest > item), I need to remove the very same item from heapB, regardlessly where it > is in heapB. And vice versa. > > Is there a datastructure or a simple trick to achieve that in an efficient > matter? Essentially you want a data structure that can efficiently do the following: 1) add an arbitrary item 2) remove an arbitrary item 3) get/pop the minimum element So Python's set object does add/remove in O(1) but min in O(N). A heap does add and min in O(log(N)) but remove in O(N). Self-balancing binary trees can do all of add/remove/min in O(log(N)) so I guess that's better than what you currently have. Google shows many third party implementations for Python. Here's one: https://pypi.python.org/pypi/bintrees/2.0.2 -- Oscar -- https://mail.python.org/mailman/listinfo/python-list
Re: SSL certification fails / tweepy [SOLVED]
Hi! 14.01.2016, 09:59, dieter wrote: "SSL_VERIFICATION_FAILED" is an error which occurs when an SSL ("https") connection is established. It happens when the SSL certificate (of the server and/or client) does not contain expected data - e.g. the certificate is no longer (or not yet) valid or its subject does not reference the connected entity or the certificate chain cannot be verified. Look for Python documentation on SSL verification to learn how to properly set up things for successful verfication. Among others, you will need have somewhere information about trusted root certificates. Thanks, dieter, for your reply. I have now re-installed both certificate packages and (open)ssl related python packages - and now it works! I still wonder why openSuSE certificates are not working out-of-box with python. Maybe some of the packages were not correctly installed... Anyway, thanks for your quick reply - the issue is now solved :) Best, Kimmo -- https://mail.python.org/mailman/listinfo/python-list
Re: [Tutor] me, my arm, my availability ...
On 13 January 2016 at 20:47, Laura Creighton wrote: > > Seems like surgery is needed to fix this. > > So I wanted you all to know, no, I haven't forgotten you and no haven't > stopped caring. I have just stopped being as __capable__ if you know > what I mean. > > Please take care of yourselves and each other. I will often be reading > even if typing is more than I can do right now. I had honestly been wondering where you were. Glad to see that you're not gone (although obviously not glad that you're injured!). Wishing a speedy recovery. -- Oscar -- https://mail.python.org/mailman/listinfo/python-list
Re: Python alternative to Google Groups
Vebnest Ecommerce Online Shopping Services Windows Reseller Hosting is based on the Windows operating system 2008. It is known for support of various programming frameworks, including Asp, ASP.net and TomCat . Windows Hosting also supports SQL Server (MSSQL) and Access, which can be used to build database driven websites. So if your site has pages ending in .asp or .aspx then you need Windows Hosting. Economy $9.99 / per month 500 GB Disk Space 100 Databases List Free Domain Registration 1 Hosting Space FREE Ad Coupons Account Control Panel FREE 24/7 Support http://www.vebnest.com/windows-reseller-hosting -- https://mail.python.org/mailman/listinfo/python-list
Re: Stop writing Python 3.5 incompatible code :-)
"Frank Millman" wrote in message news:n77j78$ld0$1...@ger.gmane.org... cur.execute(...) try: row = next(cur) except StopIteration: # 0 rows returned try: next(cur) except StopIteration: pass else: # >1 rows returned For the record, I just tried this and found an error. It is easier to explain if I change it slightly - cur.execute(...) try: row = next(cur) except StopIteration: # 0 rows returned try: next(cur) except StopIteration: # instead of pass, do something with row else: # >1 rows returned 'do something with row' is reached even if the first next() failed, so row does not exist. Here is the corrected version - cur.execute(...) try: row = next(cur) except StopIteration: # 0 rows returned else: try: next(cur) except StopIteration: # do something with row else: # >1 rows returned Frank -- https://mail.python.org/mailman/listinfo/python-list
The history behind the decision to move Python to GitHub
http://www.snarky.ca/the-history-behind-the-decision-to-move-python-to-github -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: Stop writing Python 4 incompatible code
On Thursday 14 January 2016 14:29, Rick Johnson wrote: > On Wednesday, January 13, 2016 at 9:08:40 PM UTC-6, Chris Angelico wrote: >> You're talking about a very serious matter between two legal entities >> - if someone was *fired* because of social, technological, or other >> problems with Python, that has implications that could matter in a >> court of law. So I put it right back to you: What gives you the right >> to speak against Guido and Google? > > I'm not speaking *AGAINST* anyone, i'm merely trying to > understand what happened. And unless there was some sort of > explicit contract, Google could fire *ANYONE* for *ANY* > reason -- this is not France, Chris! There's no reason to think that Guido was fired. He announced that he was leaving Google to go work for Dropbox -- that sounds to me that he was given a better offer, or perhaps he no longer cared for the toxic work environment which is Google. He wasn't fired, he was poached: http://techcrunch.com/2012/12/07/dropbox-guido-van-rossum-python/ >> And Michael's right: people move around for all sorts of reasons. >> Doesn't necessarily mean anything about the previous job. > > Of course. But when you leave things open for speculation, > you enviably create a situation where rumors can start > circulating. You're the only one trying to circulate rumours about Guido and Google -- and it's old news too, he's been working at Dropbox since Dec 2012: https://blogs.dropbox.com/tech/2012/12/welcome-guido/ [...] > We have a *RIGHT* to be worried Chris, because our > livelihoods are directly dependent on Python. You will be pleased to know that Dropbox are 100% behind Python 3, and spending a lot of time and money on bringing optional static typing to Python 2 and 3 in order to simplify the migration. -- Steve -- https://mail.python.org/mailman/listinfo/python-list
Re: Stop writing Python 3.5 incompatible code :-)
On Thursday 14 January 2016 17:27, Frank Millman wrote: > So my test was - > > except ValueError as e: > if str(e).startswith('need'): > # 0 rows returned > else: > # > 1 rows returned > > This has worked for years, but with 3.5 it stopped working. It took me a > while to figure out why. Lo and behold, the error message has changed! Error message strings have *never* been part of the function API. They are always subject to change without notice. Somebody might localise them to the user's native language, or merely change them on a whim, and they can do that in maintenance releases too, not just minor or major releases. > Now, if 0 rows are returned, the message is 'not enough values to unpack'. > > Luckily the other message has not changed, Note to self: push through a minor change to the error message. Perhaps make it "too many targets for the number of items"? > so now my test is - > > except ValueError as e: > if str(e).startswith('too many'): > # > 1 rows returned > else: > # 0 rows returned > > Now it works with both versions. For now. -- Steve -- https://mail.python.org/mailman/listinfo/python-list
Re: Stop writing Python 3.5 incompatible code :-)
On Thu, Jan 14, 2016 at 6:36 PM, Frank Millman wrote: > I like your first solution. In fact, with sqlite3, 'cur' is already > iterable, so I can just say > > cur.execute(...) > try: >row = next(cur) > except StopIteration: ># 0 rows returned > try: >next(cur) > except StopIteration: pass > else: ># >1 rows returned > > I will have to check if this works with psycopg2 and pyodbc, the other two > adaptors that I use. Not sure that "already iterable" means what you think it does. Since it's iterable, you can call iter() on it (as I do in my example). > Your second solution does not seem to work - if it raises StopIteration, > neither 'row' nor 'extra' is populated. I may be doing it wrong, but no > matter, I prefer the first one anyway. Oops. cur.execute(...) rows = iter(cur) row, extra = next(rows, None), next(rows, None) if row is None: # 0 rows returned if extra is not None: # >1 rows returned Now it's set. > There is one slight downside that I can see. I believe that raising an > exception is a relatively expensive operation in Python. For this reason, a > rule of thumb is to use EAFP when the usual case is to have no exception, > and LBYL otherwise. With my approach, I do not get an exception if exactly > one row is returned. With yours, you rely on raising an exception to > determine the result. Under the hood, they're all doing the same thing. > I can think of two counter-arguments to that. Firstly, it is more important > to ensure that the program is correct than to shave off a few microseconds. > Secondly, as StopIteration is used extensively under the hood in modern > pythons, it is probably highly optimised, and therefore nothing to be > worried about. Thirdly, the cost of raising an exception is WAY lower than the cost of reading anything from a hard disk - probably way lower than reading from an SSD. Unless all your content is getting cached in RAM, there's no way the cost of an exception will be at all significant. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: SSL certification fails / tweepy
"K. Elo" writes: > I have written I small python script for twitter mining utilising the > 'tweepy' library. Since a couple of days I cannot use the script > anymore, due to a "ssl certificate verification failed" error. The > authentication with Twitter API succeess, but when I try to run the > following code: > ... > the execution is broken with an "SSL_VERIFICATION_FAILED" error. Whenever an execution is aborted by an exception, you should always look at the traceback (--> "traceback" module). It tells you where precisely in your code the exception has occured and how you came to that point. This is important information in order to understand the problem. "SSL_VERIFICATION_FAILED" is an error which occurs when an SSL ("https") connection is established. It happens when the SSL certificate (of the server and/or client) does not contain expected data - e.g. the certificate is no longer (or not yet) valid or its subject does not reference the connected entity or the certificate chain cannot be verified. Look for Python documentation on SSL verification to learn how to properly set up things for successful verfication. Among others, you will need have somewhere information about trusted root certificates. -- https://mail.python.org/mailman/listinfo/python-list