Error see image
hello I have this error while trying to re-install the program and it’s still show can you please help me ? Thanks!-- https://mail.python.org/mailman/listinfo/python-list
Re: request
Yes! it is working, and do you have any idea about pylauncher. If possible, could you brief something about it. *UDHAY PRAKASH* Ph:+91-9533787794 udhayprakash.blogspot.com On Wed, Oct 14, 2015 at 1:01 AM, Mathew Carrick wrote: > Hi Uday, > > Pip should support using the pip{version} command to install > version-specific packages. Try using pip2.7 to install 2.7 packages. > > Best, > Mathew Carrick > > On Tue, Oct 13, 2015 at 2:45 AM, Uday Pethakamsetty < > uday.pethakamse...@infor.com> wrote: > >> Hi >> >> >> >> I am working on python 2.x for long time. >> >> >> >> I thought of testing python 3.5 for possible usage. >> >> >> >> The problem is that when I installed python 3.5, all the pip installs are >> directing to python 3.5, instead of my native python 2.7. >> >> >> >> I heard of a feature called pylauancher; but I didn’t find any satisfying >> documentation on it. >> >> >> >> Either pylauncer, or something else Solution—could you help reply the >> possible solution to work comfortably on either versions, without >> interfering, in my windows 64 bit machine. >> >> >> >> >> >> Thanks & regards >> >> >> >> Udhay Prakash >> >> -- >> https://mail.python.org/mailman/listinfo/python-list >> >> > -- https://mail.python.org/mailman/listinfo/python-list
Re: Error see image
In a message of Wed, 14 Oct 2015 03:03:31 -, laverdur...@gmail.com writes: >hello I have this error >while trying to re-install the program and it’s still show >can you please help me ? 1. If you are running XP, you cannot run 3.5. XP is not supported. 2. Otherwise The api-ms-win-crt-runtime-l1-1-0-dll is Microsofts Universal CRT. Get it here http://www.microsoft.com/en-us/download/details.aspx?id=48234 and try again. Laura -- https://mail.python.org/mailman/listinfo/python-list
Python for Dummies exaple
Hello, I have the book Python for Dummies and i downloaden from the Dummiesite some python examples. But with this script i get an error: But i have not so many experience to see what the error is. Good someone help me with this ? #Chapter 3 #Basic Elements and Syntax #= #SHORT EXAMPLES #= #while loop example countdown = 10 while countdown: print countdown, countdown -= 1 print "blastoff!" # # #try statement with input user_input = raw_input("Enter an integer: ") try: number = int(user_input) print "You entered", number except ValueError: print "Integers, please!" #class example class SayMyName: def __init__(self, myname): self.myname = myname def say(self): print "Hello, my name is", self.myname name1 = SayMyName("Aahz") name1.say() # # -- - --- -- - Posted with NewsLeecher v7.0 Beta 2 Web @ http://www.newsleecher.com/?usenet --- - -- - -- https://mail.python.org/mailman/listinfo/python-list
Re: Python for Dummies exaple
On Wed, Oct 14, 2015 at 8:55 PM, NewsLeecher User wrote: > But with this script i get an error: > But i have not so many experience to see what the error is. > Good someone help me with this ? You need to tell us what the error is :) But, looking in my crystal ball, I find a hint that you're using Python 3 and a book that's teaching an older version of Python. Solution: Get a better book. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Python for Dummies exaple
Il giorno mercoledì 14 ottobre 2015 12:04:30 UTC+2, Chris Angelico ha scritto: > On Wed, Oct 14, 2015 at 8:55 PM, NewsLeecher User wrote: > > But with this script i get an error: > > But i have not so many experience to see what the error is. > > Good someone help me with this ? > > You need to tell us what the error is :) > > But, looking in my crystal ball, I find a hint that you're using > Python 3 and a book that's teaching an older version of Python. > Solution: Get a better book. > > ChrisA And using the same cristal ball, assuming you are using python 3.x, put brackets around the arguments of print like: print(countdown) ... print("Hello, my name is", self.myname) etc. forget for the moment about the ending comma. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python for Dummies exaple
On Wed, Oct 14, 2015 at 8:55 PM, NewsLeecher User wrote: > #class example > class SayMyName: > def __init__(self, myname): > self.myname = myname > def say(self): > print "Hello, my name is", self.myname Side point: This is a poor example for _any_ Python. In Py2, that makes an old-style class, which will work fine until you try to use a feature that it can't handle, and then you'll wonder what on earth is wrong. And in Py3, the print calls need their parens. But it's a pointless example of a class, which leaves you wondering why a better example couldn't be found... Definitely look for a better book, preferably one aimed at Python 3.4 or 3.5. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Python for Dummies exaple
In reply to "edmondo.giovanno...@gmail.com" who wrote the following: > Il giorno mercoled=EC 14 ottobre 2015 12:04:30 UTC+2, Chris Angelico ha scr= > itto: > > On Wed, Oct 14, 2015 at 8:55 PM, NewsLeecher User wrote: > > > But with this script i get an error: > > > But i have not so many experience to see what the error is. > > > Good someone help me with this ? > > =20 > > You need to tell us what the error is :) > > =20 > > But, looking in my crystal ball, I find a hint that you're using > > Python 3 and a book that's teaching an older version of Python. > > Solution: Get a better book. > > =20 > > ChrisA > > And using the same cristal ball, assuming you are using python 3.x, put bra= > ckets around the arguments of print like: > > print(countdown) > ... > print("Hello, my name is", self.myname) > > etc. > forget for the moment about the ending comma. Thanks for the reply. Oh i did not look good enough that the examples are written in python 2.7 But there are also good things explaning in the book so i will keep it. Thanks -- - --- -- - Posted with NewsLeecher v7.0 Beta 2 Web @ http://www.newsleecher.com/?usenet --- - -- - -- https://mail.python.org/mailman/listinfo/python-list
Re: Python for Dummies exaple
Chris Angelico wrote: > On Wed, Oct 14, 2015 at 8:55 PM, NewsLeecher User > wrote: >> #class example >> class SayMyName: >> def __init__(self, myname): >> self.myname = myname >> def say(self): >> print "Hello, my name is", self.myname > > Side point: This is a poor example for _any_ Python. In Py2, that > makes an old-style class, which will work fine until you try to use a > feature that it can't handle, and then you'll wonder what on earth is > wrong. And in Py3, the print calls need their parens. But it's a > pointless example of a class, which leaves you wondering why a better > example couldn't be found... > > Definitely look for a better book, preferably one aimed at Python 3.4 or > 3.5. If I were to write a book about Python 2 I would defer the "always inherit from object" mantra until the features that require newstyle classes are introduced. In any way, judging a book from one example you disagree with is premature. Personally I expect to find many minor nits in the most excellent book. OP, the differences between Python 2 and Python 3 are big enough to make the attempt to learn one with a book using the other a rather displeasant experience. Either switch to a book that is geared at Python 3 (recommended, particularly if you speak a language using non-ascii letters) or install Python 2 and run the examples from your current book with the older 2.7 interpreter. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python for Dummies exaple
On Wed, Oct 14, 2015 at 11:47 PM, Peter Otten <__pete...@web.de> wrote: > Chris Angelico wrote: > >> On Wed, Oct 14, 2015 at 8:55 PM, NewsLeecher User >> wrote: >>> #class example >>> class SayMyName: >>> def __init__(self, myname): >>> self.myname = myname >>> def say(self): >>> print "Hello, my name is", self.myname >> >> Side point: This is a poor example for _any_ Python. In Py2, that >> makes an old-style class, which will work fine until you try to use a >> feature that it can't handle, and then you'll wonder what on earth is >> wrong. And in Py3, the print calls need their parens. But it's a >> pointless example of a class, which leaves you wondering why a better >> example couldn't be found... >> >> Definitely look for a better book, preferably one aimed at Python 3.4 or >> 3.5. > > If I were to write a book about Python 2 I would defer the "always inherit > from object" mantra until the features that require newstyle classes are > introduced. In any way, judging a book from one example you disagree with is > premature. Personally I expect to find many minor nits in the most excellent > book. Agreed, which is why I prefixed that part with "Side point". The old-style vs new-style class concern is a very minor one. The reason I recommend looking for a better book is mainly because people should be learning Py3 with a Py3 book. > OP, the differences between Python 2 and Python 3 are big enough to make the > attempt to learn one with a book using the other a rather displeasant > experience. Either switch to a book that is geared at Python 3 (recommended, > particularly if you speak a language using non-ascii letters) or install > Python 2 and run the examples from your current book with the older 2.7 > interpreter. Yeah. Those are the two options, and I definitely recommend the former. The advantages of Py3 over Py2 increase with every new version. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Python printing as a service - migration from WinXP to Win7/8 - issue with Win service privileges?
Dear all, this is my first post to the list, so if I am not sufficiently detailed let me know. Not even sure if this is the best list to send this to as it seems to be an issue with Windows service privileges. We have been running a package of python scripts as services on a Windows XP machine for several years. These scripts include one that checks a mail server, processes mails and then prints to the attachements to the default printer. This is the only part that does not work, as a service, when migrating the package to Win7/8. The printing script works fine when executing it from the console. An odd thing also is that the script runs smoothly through as a service with not error message, but does not print. The inital script was in Python 2.4: print_service.py --- ... printcmd = "C:/Python24/python.exe C:/Application/printpostdelivery.py" ... cmd = "%s %s" % (printcmd ,pdfname ) (stdout, stdin, stderr) = popen2.popen3( cmd ) screen = stdout.read() err_screen = stderr.read() ... --- printpostdelivery.py --- ... win32api.ShellExecute(0, "print", dateiname, None, ".", 0); ... --- I upgraded to Python 2.7 and changed to lines in print_service.py accordingly: print_service.py --- ... printcmd = "C:/Python27/python.exe C:/Application/printpostdelivery.py" ... cmd = "%s %s" % (printcmd ,pdfname ) p = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (child_stdin, child_stdout, child_stderr) = (p.stdin, p.stdout, p.stderr) screen = child_stdout.read() err_screen = child_stderr.read() ... --- I played around with the service settings and ran it as administrator, but that did not help...well, only that initially there was an error message when running the service with Python 2.7: pywintypes.error: (31, 'ShellExecute', 'A device attached to the system is not functioning.') But that disappeared when I ran the service as an administrator. Then it was the same all over again. Script runs through smoothly with no error, but the documents were not printed. Any suggestions? Thanks! All the best Kristof -- https://mail.python.org/mailman/listinfo/python-list
Execute Python Scripts
So I am going through this article on Python for newbies ---http://askpython.com/execute-python-scripts/ Managed to create a file with these contents : 1 #!/usr/bin/env python3 2 3 print('hello world') and saved it as hello.py Next step, I wanted to open the 'command line' so I can type 'python hello.py' to execute the scripts. Where do I find the "command line" ? -- https://mail.python.org/mailman/listinfo/python-list
Re: Execute Python Scripts
> Where do I find the "command line" ? Welcome to Python. Starting a command shell depends on which operating system you are running. If you are on Microsoft Windows, choose the Start button, then type "cmd" into the edit control, then press Enter. -- https://mail.python.org/mailman/listinfo/python-list
Re: Execute Python Scripts
On Thursday, October 15, 2015 at 1:18:27 AM UTC+8, paul.her...@gmail.com wrote: > > Where do I find the "command line" ? > > Welcome to Python. > > Starting a command shell depends on which operating system you are running. > > If you are on Microsoft Windows, choose the Start button, then type "cmd" > into the edit control, then press Enter. Pleasure to meet you ... I am using a Mac OS X Yosemite Version 10.10.2 Operating System. Is the command line on this operating system the "Terminal" (black screen) ? -- https://mail.python.org/mailman/listinfo/python-list
Problem with copy.deepcopy and multiprocessing.Queue
I've got a bit of a problem with copy.deepcopy and using multiprocessing.Queue. I have an HTTPAPI that gets exposed to add objects to a multiprocessing.Qeue. Source code here: https://github.com/jmdevince/cifpy3/blob/master/lib/cif/api/handler.py#L283 The trouble is, even using deepcopy, my debugging shows that it keeps re-using the same address space on every iteration of the loop (and/or fork since it uses the Forking TCP server mixin). This is reflected when the reference to that address space gets removed from the Queue. Source code: https://github.com/jmdevince/cifpy3/blob/master/lib/cif/worker/worker.py So I submit a few objects very rapidly to the HTTP server. It places them in the queue. For some reason on the second iteration copy.deepcopy stops using new address spaces for deepcopied objects. As such the queue processes that object only once (even though Queue.put() is called repeatedly for the same address space). I've tried 'del' the object before reusing it but it still reallocates to the same address space. I'm at a complete loss. 2015-10-14 17:03:30 APIHTTP WARNING Storing object: 2015-10-14 17:03:30 THREAD #1-1 WARNING Got Observable with Object: 2015-10-14 17:03:30 APIHTTP WARNING Storing object: 2015-10-14 17:03:30 THREAD #2-1 WARNING Got Observable with Object: 2015-10-14 17:03:30 APIHTTP WARNING Storing object: 2015-10-14 17:03:30 APIHTTP WARNING Storing object: 2015-10-14 17:03:30 APIHTTP WARNING Storing object: 2015-10-14 17:03:30 APIHTTP WARNING Storing object: 2015-10-14 17:03:30 APIHTTP WARNING Storing object: 2015-10-14 17:03:30 APIHTTP WARNING Storing object: 2015-10-14 17:03:30 APIHTTP WARNING Storing object: -- https://mail.python.org/mailman/listinfo/python-list
Problem with copy.deepcopy and multiprocessing
I've got a bit of a problem with copy.deepcopy and using multiprocessing.Queue. I have an HTTPAPI that gets exposed to add objects to a multiprocessing.Qeue. Source code here: https://github.com/jmdevince/cifpy3/blob/master/lib/cif/api/handler.py#L283 The trouble is, even using deepcopy, my debugging shows that it keeps re-using the same address space on every iteration of the loop (and/or fork since it uses the Forking TCP server mixin). This is reflected when the reference to that address space gets removed from the Queue. Source code: https://github.com/jmdevince/cifpy3/blob/master/lib/cif/worker/worker.py So I submit a few objects very rapidly to the HTTP server. It places them in the queue. For some reason on the second iteration copy.deepcopy stops using new address spaces for deepcopied objects. As such the queue processes that object only once (even though Queue.put() is called repeatedly for the same address space). I've tried 'del' the object before reusing it but it still reallocates to the same address space. I'm at a complete loss. 2015-10-14 17:03:30 APIHTTP WARNING Storing object: 2015-10-14 17:03:30 THREAD #1-1 WARNING Got Observable with Object: 2015-10-14 17:03:30 APIHTTP WARNING Storing object: 2015-10-14 17:03:30 THREAD #2-1 WARNING Got Observable with Object: 2015-10-14 17:03:30 APIHTTP WARNING Storing object: 2015-10-14 17:03:30 APIHTTP WARNING Storing object: 2015-10-14 17:03:30 APIHTTP WARNING Storing object: 2015-10-14 17:03:30 APIHTTP WARNING Storing object: 2015-10-14 17:03:30 APIHTTP WARNING Storing object: 2015-10-14 17:03:30 APIHTTP WARNING Storing object: 2015-10-14 17:03:30 APIHTTP WARNING Storing object: -- https://mail.python.org/mailman/listinfo/python-list
Re: Execute Python Scripts
On Wed, Oct 14, 2015 at 11:04 AM, Cai Gengyang wrote: > So I am going through this article on Python for newbies > ---http://askpython.com/execute-python-scripts/ That looks like a terrible resource. There are plenty of tutorials and books out there that are actually good. I suggest starting with the tutorial from the Python docs: https://docs.python.org/3/tutorial/index.html > Pleasure to meet you ... I am using a Mac OS X Yosemite Version 10.10.2 > Operating System. > > Is the command line on this operating system the "Terminal" (black screen) ? Yes. You will also need to "cd" to the same directory where you saved the script. For example, if you saved it to your Documents directory, then type "cd Documents" at the command line. You might also want to read a tutorial on the Mac OS X command line, e.g.: http://blog.teamtreehouse.com/introduction-to-the-mac-os-x-command-line -- https://mail.python.org/mailman/listinfo/python-list
Re: Python for Dummies exaple
On Wed, 14 Oct 2015 12:32:33 GMT, NewsLeecher User wrote: >In reply to "edmondo.giovanno...@gmail.com" who wrote the following: > >> Il giorno mercoled=EC 14 ottobre 2015 12:04:30 UTC+2, Chris Angelico ha scr= >> itto: >> > On Wed, Oct 14, 2015 at 8:55 PM, NewsLeecher User wrote: >> > > But with this script i get an error: >> > > But i have not so many experience to see what the error is. >> > > Good someone help me with this ? >> > =20 >> > You need to tell us what the error is :) >> > =20 >> > But, looking in my crystal ball, I find a hint that you're using >> > Python 3 and a book that's teaching an older version of Python. >> > Solution: Get a better book. >> > =20 >> > ChrisA >> >> And using the same cristal ball, assuming you are using python 3.x, put bra= >> ckets around the arguments of print like: >> >> print(countdown) >> ... >> print("Hello, my name is", self.myname) >> >> etc. >> forget for the moment about the ending comma. > >Thanks for the reply. >Oh i did not look good enough that the examples are written in python 2.7 >But there are also good things explaning in the book so i will keep it. I found all the Python books available dealt with version 2.x, so eventually I installed that for the purpose of learning Python. It's much easier, and you don't have to spend hours searching online for differences between 3.x and 2.x just to find what caused an error in an example script. Once you've l;earnt it, then you can start learning the differences, and maybe by that time there will be a book that deals with 3.x, but until there is, it's just not worth the hassle unless you're seriously into Unicode. -- Steve Hayes from Tshwane, South Africa Web: http://www.khanya.org.za/stevesig.htm Blog: http://khanya.wordpress.com E-mail - see web page, or parse: shayes at dunelm full stop org full stop uk --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus -- https://mail.python.org/mailman/listinfo/python-list
Re: Execute Python Scripts
Ok thanks ... this --- https://docs.python.org/3/tutorial/index.html looks like a way more comprehensive resource. Paul Graham has written an excellent essay called "The Python Paradox" : http://www.paulgraham.com/pypar.html. Putting it here for sharing and discussion ... On Thursday, October 15, 2015 at 1:47:50 AM UTC+8, Ian wrote: > On Wed, Oct 14, 2015 at 11:04 AM, Cai Gengyang wrote: > > So I am going through this article on Python for newbies > > ---http://askpython.com/execute-python-scripts/ > > That looks like a terrible resource. There are plenty of tutorials and > books out there that are actually good. I suggest starting with the > tutorial from the Python docs: > > https://docs.python.org/3/tutorial/index.html > > > Pleasure to meet you ... I am using a Mac OS X Yosemite Version 10.10.2 > > Operating System. > > > > Is the command line on this operating system the "Terminal" (black screen) ? > > Yes. You will also need to "cd" to the same directory where you saved > the script. For example, if you saved it to your Documents directory, > then type "cd Documents" at the command line. > > You might also want to read a tutorial on the Mac OS X command line, > e.g.: http://blog.teamtreehouse.com/introduction-to-the-mac-os-x-command-line -- https://mail.python.org/mailman/listinfo/python-list
Installed 3.5.0 successfully on Windows 10, but where is DDLs, Doc, Lib, etc?
I installed 3.5.0 today and it's working fine -- either from the command prompt, or running a .py script. But the Python 3.4 that was previously installed on the computer had a Python34 folder, which contained DDLs, Doc, include, Lib, and various other folders and files. I haven't found a comparable Python35 folder anywhere. I'd like to find the 3.5 Doc folder at least. I looked for the installation directory using the command prompt, but at c:\Users\(my name)\ there is no AppData. Where can I find that folder? Or can I just ignore it for now (and get the documentation elsewhere)? -- https://mail.python.org/mailman/listinfo/python-list
Re: Problem with copy.deepcopy and multiprocessing.Queue
On 2015-10-14 18:41, James DeVincentis wrote: I’ve got a bit of a problem with copy.deepcopy and using multiprocessing.Queue. I have an HTTPAPI that gets exposed to add objects to a multiprocessing.Qeue. Source code here: https://github.com/jmdevince/cifpy3/blob/master/lib/cif/api/handler.py#L283 The trouble is, even using deepcopy, my debugging shows that it keeps re-using the same address space on every iteration of the loop (and/or fork since it uses the Forking TCP server mixin). This is reflected when the reference to that address space gets removed from the Queue. Source code: https://github.com/jmdevince/cifpy3/blob/master/lib/cif/worker/worker.py So I submit a few objects very rapidly to the HTTP server. It places them in the queue. For some reason on the second iteration copy.deepcopy stops using new address spaces for deepcopied objects. As such the queue processes that object only once (even though Queue.put() is called repeatedly for the same address space). I’ve tried ‘del’ the object before reusing it but it still reallocates to the same address space. I’m at a complete loss. 2015-10-14 17:03:30 APIHTTP WARNING Storing object: 2015-10-14 17:03:30 THREAD #1-1 WARNING Got Observable with Object: 2015-10-14 17:03:30 APIHTTP WARNING Storing object: 2015-10-14 17:03:30 THREAD #2-1 WARNING Got Observable with Object: 2015-10-14 17:03:30 APIHTTP WARNING Storing object: 2015-10-14 17:03:30 APIHTTP WARNING Storing object: 2015-10-14 17:03:30 APIHTTP WARNING Storing object: 2015-10-14 17:03:30 APIHTTP WARNING Storing object: 2015-10-14 17:03:30 APIHTTP WARNING Storing object: 2015-10-14 17:03:30 APIHTTP WARNING Storing object: 2015-10-14 17:03:30 APIHTTP WARNING Storing object: Could it just be re-using space that it has recently freed? -- https://mail.python.org/mailman/listinfo/python-list
Re: Python for Dummies exaple
I found all the Python books available dealt with version 2.x, I searched "python 3 book" and immediately come up with Programming in Python 3 Dive Into Python 3 Python 3 for Absolute Beginners + 'free' Non-Programmer's Tutorial for Python 3 https://en.wikibooks.org/wiki/Non-Programmer's_Tutorial_for_Python_3 http://www.onlineprogrammingbooks.com/python/ has Learning to Program Using Python (2&3) Python Cookbook Third Edition (py 3) http://www.openbookproject.net/thinkcs/python/english3e/ How to Think Like a Computer Scientist:Learning with Python 3 Many of these are updated versions (2 or 3 years old) of well known py2 books. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Installed 3.5.0 successfully on Windows 10, but where is DDLs, Doc, Lib, etc?
On Wed, Oct 14, 2015 at 2:05 PM, John S. James wrote: > I installed 3.5.0 today and it's working fine -- either from the command > prompt, or running a .py script. > > But the Python 3.4 that was previously installed on the computer had a > Python34 folder, which contained DDLs, Doc, include, Lib, and various other > folders and files. I haven't found a comparable Python35 folder anywhere. I'd > like to find the 3.5 Doc folder at least. > > I looked for the installation directory using the command prompt, but at > c:\Users\(my name)\ there is no AppData. > > Where can I find that folder? Or can I just ignore it for now (and get the > documentation elsewhere)? Python 3.5 changed the default install directory on Windows to better fit in with other Windows software and to alleviate security concerns (C:\Python34, for example, is world-writable, whereas C:\Program Files\Python 3.5\, which is the new default all-users install location, can only be written to by administrators). True per-user installs are now also possible, and install to your user directory. You can find where Python is installed using Python itself: try `py -3.5 -c "import sys, os;os.system('explorer ' + sys.prefix)"` at the Command Prompt, which uses the Python Launcher for Windows to start Python 3.5 and execute a command to start a Windows Explorer instance in the directory containing Python. By the way, C:\Users\(your name)\AppData does exist, but is hidden by default. It will tab-complete, though; at Command Prompt do `dir C:\Users\(your name)\App`. You can also get always-up-to-date documentation from https://docs.python.org/3.5/. There's also a download page at https://docs.python.org/3.5/download.html if you prefer a local copy of one of the various formats available there. Hope this helps, -- Zach -- https://mail.python.org/mailman/listinfo/python-list
Re: Installed 3.5.0 successfully on Windows 10, but where is DDLs, Doc, Lib, etc?
> Where can I find that folder? Or can I just ignore it for now (and get the documentation elsewhere)? If the install was done for "all users" on the machine, then the Python installation directory will be under " %SystemRoot%\Program Files\" for 64-bit or "%SystemRoot%\Program Files (x86)\" for 32-bit Python. -- https://mail.python.org/mailman/listinfo/python-list
Re: Installed 3.5.0 successfully on Windows 10, but where is DDLs, Doc, Lib, etc?
On 2015-10-14 20:05, John S. James wrote: I installed 3.5.0 today and it's working fine -- either from the command prompt, or running a .py script. But the Python 3.4 that was previously installed on the computer had a Python34 folder, which contained DDLs, Doc, include, Lib, and various other folders and files. I haven't found a comparable Python35 folder anywhere. I'd like to find the 3.5 Doc folder at least. I looked for the installation directory using the command prompt, but at c:\Users\(my name)\ there is no AppData. Where can I find that folder? Or can I just ignore it for now (and get the documentation elsewhere)? The AppData folder probably _is_ there, but hidden. There's a checkbox to show hidden items. It's on the View menu in Windows 10. -- https://mail.python.org/mailman/listinfo/python-list
Sets vs lists loop behaviour if size changes
If set size changes during a for loop, a runtime exception is raised: ~~ S = {2015} for z in S: S.add(42) ~~ ~~ Traceback (most recent call last): File "_.py", line 2, in for z in S: RuntimeError: Set changed size during iteration ~~ Surprisingly, if a for loop changes the size of a list it is iterating on, no exception is raised : ~~ L = [2015] for z in L: L.append(42) print(len(L)) ~~ The code above falls into an infinite loop, printing : 2 3 4 5 6 7 8 9 ... 198435 198436 198437 ^Z So why lists and sets don't react the same way? -- https://mail.python.org/mailman/listinfo/python-list
Re: Sets vs lists loop behaviour if size changes
On Wed, Oct 14, 2015 at 3:11 PM, candide via Python-list wrote: > If set size changes during a for loop, a runtime exception is raised: > > [SNIP] > > Surprisingly, if a for loop changes the size of a list it is iterating on, no > exception is raised : > > [SNIP] > > So why lists and sets don't react the same way? Because the behavior of iteration over a set (or dict) that changes while it's being iterated over is much more difficult to predict. Though you shouldn't insert or delete items in a list before the current iteration point, it's generally safe to append items while iterating. With a set or dict, *any* items that are added or deleted [1] during iteration could cause the entire data structure to be rebuilt, changing the buckets that everything is in and fundamentally altering the order of iteration. If that happens, all bets are off as to which items will be iterated over multiple times, which will not be iterated at all, or how the number of items iterated over will compare to the actual size of the set or dict. [1] Merely changing the value of a particular key in a dict is perfectly safe, however. -- https://mail.python.org/mailman/listinfo/python-list
Re: Sets vs lists loop behaviour if size changes
> On 14 Oct 2015, at 23:11, candide via Python-list > wrote: > > If set size changes during a for loop, a runtime exception is raised A set is a kind of dictionary (without values). And why it can't be resized, is explained by Brandon Rhodes in his excellent talk 'The Mighty Dictionary', https://www.youtube.com/watch?v=C4Kc8xzcA68 , starting at 21:24 "Because of resizing, a dictionary (or set) can completely reorder during an otherwise innocent insert". Greetings, -- https://mail.python.org/mailman/listinfo/python-list
Re: Sets vs lists loop behaviour if size changes
Thanks for the response and the reference, indeed sets and lists behave differently... -- https://mail.python.org/mailman/listinfo/python-list
Re: Installed 3.5.0 successfully on Windows 10, but where is DDLs, Doc, Lib, etc?
On 10/14/15, Zachary Ware wrote: > > You can find where Python is installed using Python itself: try `py > -3.5 -c "import sys, os;os.system('explorer ' + sys.prefix)"` at the > Command Prompt, Here's a slightly simpler way to open the folder: py -3.5 -c "import os, sys; os.startfile(sys.prefix)" > By the way, C:\Users\(your name)\AppData does exist, but is hidden by > default. It will tab-complete, though; at Command Prompt do `dir > C:\Users\(your name)\App`. You can list all files and directories using the /a switch of cmd's dir command, and just directories (including hidden ones) using /ad, e.g. dir /ad %userprofile% -- https://mail.python.org/mailman/listinfo/python-list
Re: Execute Python Scripts
On 10/14/2015 10:04 AM, Cai Gengyang wrote: So I am going through this article on Python for newbies ---http://askpython.com/execute-python-scripts/ Managed to create a file with these contents : 1 #!/usr/bin/env python3 2 3 print('hello world') and saved it as hello.py You did write that file _without_ the line numbers, I hope. Line numbers are sometimes used in text to discuss a Python program, but they are _NOT_ used in an actual program. -=- Larry -=- -- https://mail.python.org/mailman/listinfo/python-list
Stylistic question regarding no-op code and tests
Hi everyone, I'd like to get some opinions about some coding constructs that may seem at first glance to serve no purpose, but does have *some* non-negligible purpose, and I think I've come to the right place :). The construct is this: def my_function(arg1, arg2, filename=None): """ Some function. If a file is given, it is processed """ # Some code that performs my_function if filename is not None: process_file(filename) else: pass My question is, what do you think of the "else: pass" statement? It is a complete no-op and is syntactically equivalent to the same code with those lines removed. Up until earlier today, I would look at that and cringe (I still do, a little). What I recently realized, though, that what this construct allows is for the coverage testing package (which I have recently started employing for my project... thanks Ned and others!) to detect whether or not both code paths are covered in the test suite. I think my opinion here is that this construct is useful to use when the two code paths are very different operationally from each other, one is an unusual path that you are not >100% sure is well-covered in your test suite, but that your first instinct should be to avoid such code. What do you think? Thanks! Jason -- Jason M. Swails BioMaPS, Rutgers University Postdoctoral Researcher -- https://mail.python.org/mailman/listinfo/python-list
Re: Stylistic question regarding no-op code and tests
On Thu, Oct 15, 2015 at 12:49 PM, Jason Swails wrote: > My question is, what do you think of the "else: pass" statement? It is a > complete no-op and is syntactically equivalent to the same code with those > lines removed. Up until earlier today, I would look at that and cringe (I > still do, a little). > > What I recently realized, though, that what this construct allows is for the > coverage testing package (which I have recently started employing for my > project... thanks Ned and others!) to detect whether or not both code paths > are covered in the test suite. If that's the case, it absolutely MUST have some acknowledgement in the code. Maybe a comment, or maybe replace the 'pass' with an 'assert', or (a neat trick I've used in a few places) a statistical counter: if filename is not None: process_file(filename) files_processed += 1 else: nonfiles_not_processed += 1 Your coverage tester should be just as happy with that, and it doesn't look pointless. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Stylistic question regarding no-op code and tests
Jason Swails writes: > What I recently realized, though, that what this construct allows is > for the coverage testing package (which I have recently started > employing for my project... thanks Ned and others!) to detect whether > or not both code paths are covered in the test suite. Coverage.py has, for many releases now, had good measurement of branch coverage by your tests. Enable it with the ‘--branch’ option to ‘run’ https://coverage.readthedocs.org/en/latest/branch.html>. -- \ “They who can give up essential liberty to obtain a little | `\temporary safety, deserve neither liberty nor safety.” | _o__) —Benjamin Franklin, 1775-02-17 | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Re: Python for Dummies exaple
On Wed, 14 Oct 2015 15:23:25 -0400, Terry Reedy wrote: > >> I found all the Python books available dealt with version 2.x, > >I searched "python 3 book" and immediately come up with >Programming in Python 3 >Dive Into Python 3 >Python 3 for Absolute Beginners > >+ 'free' >Non-Programmer's Tutorial for Python 3 >https://en.wikibooks.org/wiki/Non-Programmer's_Tutorial_for_Python_3 > >http://www.onlineprogrammingbooks.com/python/ has >Learning to Program Using Python (2&3) >Python Cookbook Third Edition (py 3) > >http://www.openbookproject.net/thinkcs/python/english3e/ >How to Think Like a Computer Scientist:Learning with Python 3 > >Many of these are updated versions (2 or 3 years old) of well known py2 >books. That may be so, but I've not seen any of them in any bookshops or libraries. -- Steve Hayes from Tshwane, South Africa Web: http://www.khanya.org.za/stevesig.htm Blog: http://khanya.wordpress.com E-mail - see web page, or parse: shayes at dunelm full stop org full stop uk --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus -- https://mail.python.org/mailman/listinfo/python-list
write csv to object and read into pandas
I have a csv file I have to make some changes to before I read it into pandas. Currently I open the csv read each row, make changes and save it to a new file. Then read it into pandas with pandas.read_csv(). How do I skip writing the file to disk? Using python3.5. This is what I am doing now. with open(infile,"r") as fin: with open(outfile,"w") as fout: writer=csv.writer(fout) for row in csv.reader(fin): #do stuff to the row writer.writerow(row) df = pandas.csv_reader(outfile) Vincent Davis 720-301-3003 -- https://mail.python.org/mailman/listinfo/python-list