From psimon at sonic.net Wed Nov 1 00:30:11 2017 From: psimon at sonic.net (Paul Simon) Date: Tue, 31 Oct 2017 21:30:11 -0700 Subject: [Tutor] missing idlelib and pip Message-ID: The python distribution for the Mageia 6 update does not include idlelib or pip. Please tell me where to find them to add. This seems to be a constant issue with linux distributions of python. I tried to have idlelib added to the Mageia 6 update and all I got was vague noise and nothing done. Paul Simon From hemantsain55 at gmail.com Wed Nov 1 02:02:15 2017 From: hemantsain55 at gmail.com (Hemant Sain) Date: Wed, 1 Nov 2017 11:32:15 +0530 Subject: [Tutor] Help regarding creating tags Message-ID: i want to tag categories to its menuname. i have a csv containing menu item name and in other csv i have a column containing some strings, i want to pick that strings from categories and look into menu items if any menu item containing that string i want to create a new column next to menu item name flagged as 1 otherwise 0 and the only condition is once a menu item flagged as 1 i don't need to consider that menu item again to tag further in case of redundant strings in categories only i want to search which are flagged as 0. please help me with the python script. *Menu Name* 9\ bobbie" 9\ chz steak" 9\ tuna" provolone 20\ bobbie" bottled soda 20oz cran-slam ww american small chips medium drink 9\ meatball" capriotti's water 20'' chicken cheese steak 9\ veg turkey" medium chips 9\ capastrami" 12\ bobbie" 12'' chicken cheese steak cookie 12\ chz steak" 9\ cole turkey" kid grilled cheese white 12\ italian" 12\ meatball" 12\ capastrami" turkey sand w 20\ slaw be jo" swiss 12\ cole turkey" large drink 9\ ham&chz" 9'' chicken cheese steak 9\ slaw be jo" turkey sand ww stuffing 12\ turkey" 9\ italian" 12\ slaw be jo" 9\ grld italian" 12\ veg burger w/chz" extra american black&bleu salad 9\ turkey" 20\ turkey" 20\ capastrami" ham sand w 12\ mushroom" 12\ grld italia" italian salad tuna sand ww 9\ roast beef" 20\ chz steak" 20\ mushroom" 9\ veg chzstk" ham genoa 12\ veg turkey" 12\ veggie cole turkey" 9\ mushroom" cap's creation mushrooms salad chicken 20\ cole turkey" 1 pack chicken kr veg burger w/chz 12\ roast beef" kid turkey n cheese white 20\ italian" 12\ ham&chz" 9\ employee sub" roast beef kr 9\ veggie cole turkey" 12\ sausage" tea turkey sand kr salad turkey tuna sand kr brownie slice american cheese 1 oz pastrami 9\ cheese" 12\ italian up" 12\ capastrami up" 1 pack steak delaware's finest small the sampler sm side ranch dressing 12\ veg turkey up" 20\ roast beef" roast beef w 1oz turkey 12\ tuna" 20\ veg turkey" 12\ veg chzstk" 9\ sausage" kid ham n cheese white side italian dressing salad provolone 20\ grld italia" sample item 6 sample item 9 turkey 12\ slaw be jo up" 12\ meatball up" 1 oz roast beef ham sand ww delaware's finest large side cole slaw large large chips 20\ meatball" 12'' chick cheese stk up 12\ chz steak up" 12\ grld italia up" cran-slam w 12\ bobbie up" 20\ cheese" slice provolone the sampler lg meatball bar slice ham wise large chips small side sm soup 12\ tuna up" 12\ cole turkey up" prosciutini 20\ veggie cole turkey" soup roast beef 20\ italian up" 20'' chick cheese stk up 20\ chz steak up" 20\ bobbie up" 20\ veg turkey up" slice swiss 20\ capastrami up" sample item 7 12\ ham&chz up" salad swiss 12\ veggie cheese stk up" california omelet orange juice exteme bac boy dinner salad chef salad 12\ turkey up" the big cheese combo it fries cmb sm pepsi km cheese burger #NAME? #NAME? kid grilled cheese wheat kids ham cheese white box calif. blt bacon turkey melt coffee 1-pc pancake fries tuna sand biscuits & gravy s-1/3 patty x avocado x chez s-bacon #NAME? xtra egg lg bev upcharge sm ice tea small soup roast beef ww salad tuna med pepsi 20\ veg chzstk up" day nm egg san s-chkn brest bell pepper fruit 1 slice veggie turkey s-toast x sausage 1 pack sausage chicken salad lg pepsi x dressing large side 9\ firecracker turkey" 20\ sausage up" 20\ turkey up" 20\ veg chzstk" lg ice tea 12\ roast beef up" sample item 8 catering cap creation sal the turkey lover sm little italy sm cookie tray sd chk avo san sm fry / 2 pc zucch kid turkey n cheese wheat junior chz burger extra italian meat chili chz fries sm fry / 2 pc o ring extra turkey *CATEGORIES* non-veg chix salmon ch chkn brisket brskt bacon bcn chse mahi dog shk clam parmesan asiago prosciutto prosciutti salami Angus hicken chk chick wings prk pork ham bacon ribs fish shrimp tuna beef steak stk meatball -------------- next part -------------- non-veg chix salmon ch chkn brisket brskt bacon bcn chse mahi dog shk clam parmesan asiago prosciutto prosciutti salami Angus hicken chk chick wings prk pork ham bacon ribs fish shrimp tuna beef steak stk meatball -------------- next part -------------- i want to tag categories to its menuname. i have a csv containing menu item name and in other csv i have a colunmn containing some strings, i want to pick that strings from categories and look into menu items if any menu item containing that string i want to create a new column next to menu item name flagged as 1 otherwise 0 and the only condition is once a menu item flagged as 1 i dont need to consider that menu item again to tag further in case of redudant strings in categories only i want to search which are flagged as 0. please help me with the r script. Menu Name 9\ bobbie" 9\ chz steak" 9\ tuna" provolone 20\ bobbie" bottled soda 20oz cran-slam ww american small chips medium drink 9\ meatball" capriotti's water 20'' chicken cheese steak 9\ veg turkey" medium chips 9\ capastrami" 12\ bobbie" 12'' chicken cheese steak cookie 12\ chz steak" 9\ cole turkey" kid grilled cheese white 12\ italian" 12\ meatball" 12\ capastrami" turkey sand w 20\ slaw be jo" swiss 12\ cole turkey" large drink 9\ ham&chz" 9'' chicken cheese steak 9\ slaw be jo" turkey sand ww stuffing 12\ turkey" 9\ italian" 12\ slaw be jo" 9\ grld italian" 12\ veg burger w/chz" extra american black&bleu salad 9\ turkey" 20\ turkey" 20\ capastrami" ham sand w 12\ mushroom" 12\ grld italia" italian salad tuna sand ww 9\ roast beef" 20\ chz steak" 20\ mushroom" 9\ veg chzstk" ham genoa 12\ veg turkey" 12\ veggie cole turkey" 9\ mushroom" cap's creation mushrooms salad chicken 20\ cole turkey" 1 pack chicken kr veg burger w/chz 12\ roast beef" kid turkey n cheese white 20\ italian" 12\ ham&chz" 9\ employee sub" roast beef kr 9\ veggie cole turkey" 12\ sausage" tea turkey sand kr salad turkey tuna sand kr brownie slice american cheese 1 oz pastrami 9\ cheese" 12\ italian up" 12\ capastrami up" 1 pack steak delaware's finest small the sampler sm side ranch dressing 12\ veg turkey up" 20\ roast beef" roast beef w 1oz turkey 12\ tuna" 20\ veg turkey" 12\ veg chzstk" 9\ sausage" kid ham n cheese white side italian dressing salad provolone 20\ grld italia" sample item 6 sample item 9 turkey 12\ slaw be jo up" 12\ meatball up" 1 oz roast beef ham sand ww delaware's finest large side cole slaw large large chips 20\ meatball" 12'' chick cheese stk up 12\ chz steak up" 12\ grld italia up" cran-slam w 12\ bobbie up" 20\ cheese" slice provolone the sampler lg meatball bar slice ham wise large chips small side sm soup 12\ tuna up" 12\ cole turkey up" prosciutini 20\ veggie cole turkey" soup roast beef 20\ italian up" 20'' chick cheese stk up 20\ chz steak up" 20\ bobbie up" 20\ veg turkey up" slice swiss 20\ capastrami up" sample item 7 12\ ham&chz up" salad swiss 12\ veggie cheese stk up" california omelet orange juice exteme bac boy dinner salad chef salad 12\ turkey up" the big cheese combo it fries cmb sm pepsi km cheese burger #NAME? #NAME? kid grilled cheese wheat kids ham cheese white box calif. blt bacon turkey melt coffee 1-pc pancake fries tuna sand biscuits & gravy s-1/3 patty x avocado x chez s-bacon #NAME? xtra egg lg bev upcharge sm ice tea small soup roast beef ww salad tuna med pepsi 20\ veg chzstk up" day nm egg san s-chkn brest bell pepper fruit 1 slice veggie turkey s-toast x sausage 1 pack sausage chicken salad lg pepsi x dressing large side 9\ firecracker turkey" 20\ sausage up" 20\ turkey up" 20\ veg chzstk" lg ice tea 12\ roast beef up" sample item 8 catering cap creation sal the turkey lover sm little italy sm cookie tray sd chk avo san sm fry / 2 pc zucch kid turkey n cheese wheat junior chz burger extra italian meat chili chz fries sm fry / 2 pc o ring extra turkey From alan.gauld at yahoo.co.uk Wed Nov 1 06:39:50 2017 From: alan.gauld at yahoo.co.uk (Alan Gauld) Date: Wed, 1 Nov 2017 10:39:50 +0000 Subject: [Tutor] missing idlelib and pip In-Reply-To: References: Message-ID: On 01/11/17 04:30, Paul Simon wrote: > The python distribution for the Mageia 6 update does not include idlelib > or pip. Please tell me where to find them to add. IDLE should be in your package manager - along with zillions of other Python packages. You should just need to select it and install it. The caveat is that I don't use Mageia but that's how it works on every other Linux Python I've used. On my Mint system I use Synaptic as a package manager and typing idle into the search box brings up a long list in the form idle-pythonX.Y Where X.Y represent every version from 2.3 through to 3.6 Just select the version corresponding to your installed Python. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos From alan.gauld at yahoo.co.uk Wed Nov 1 06:52:38 2017 From: alan.gauld at yahoo.co.uk (Alan Gauld) Date: Wed, 1 Nov 2017 10:52:38 +0000 Subject: [Tutor] Help regarding creating tags In-Reply-To: References: Message-ID: On 01/11/17 06:02, Hemant Sain wrote: > i want to tag categories to its menuname. Your description below does not explain how you will tag them together, you simply identify which menu items have a category, but no way to determine which category goes with which menu item? > i have a csv containing menu item name and in other > csv i have a column containing some strings, > i want to pick that strings from categories and look into menu items if > any menu item containing that string i want to create a new column next to > menu item name flagged as 1 otherwise 0 > and the only condition is once a menu item flagged > as 1 i don't need to consider that menu item again > to tag further in case of redundant strings That sounds like what you think the solution should be rather than your actual requirement. I'd suggest it might be easier to create two lists and move the found results into the second list. this has the advantage of reducing the number of items to be searched without having to do any extra tests But at the end you will simply have identified which items have a category and which have not, you will not have identified which category each item belongs to. Maybe you need to store the category alongside the items once you find a match? Or better still use a dictionary keyed by category? In pseudo code it might look like: results = {} for category in categories: results[category] = [ item for item in menuitems if category in item ] But maybe a dictionary is not what you need for your output format? And what to do with menuitems that don't match any category? That take us back to a dual list approach. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos From mats at wichmann.us Wed Nov 1 12:08:15 2017 From: mats at wichmann.us (Mats Wichmann) Date: Wed, 1 Nov 2017 10:08:15 -0600 Subject: [Tutor] missing idlelib and pip In-Reply-To: References: Message-ID: On 11/01/17 04:39, Alan Gauld via Tutor wrote: > On 01/11/17 04:30, Paul Simon wrote: >> The python distribution for the Mageia 6 update does not include idlelib >> or pip. Please tell me where to find them to add. > > IDLE should be in your package manager - along with zillions of > other Python packages. You should just need to select it and > install it. The caveat is that I don't use Mageia but that's > how it works on every other Linux Python I've used. > > On my Mint system I use Synaptic as a package manager and typing > idle into the search box brings up a long list in the form > > idle-pythonX.Y > > Where X.Y represent every version from 2.3 through to 3.6 > Just select the version corresponding to your installed > Python. > Mageia is a descendant of Mandrake, which once upon a time (should be over a decade ago by now) I used as my main system. If they haven't changed away, that means you would search using urpmi... but you've indicated you have asked them for things and not gotten a satisfactory answer. You can _always_ just install your own Python environment. I have used this to simplify management/installation: https://github.com/pyenv/pyenv Once you are running in a Python you have installed and are not messing up the system version, you should be able to install whatever you want, however you want, outside of whatever you think the distribution isn't doing right. Installing from source the way pyenv does means you have a full build, not one that's been segmented into sub-packages the way Linux distributions do. Note: IDLE would require a properly working tkinter, which requires a working tk library, which should not actually be a problem, it's not a tough thing to do, but has managed to trip up many people (for example, the system-provided tk on MacOS is not functional for this use so a lot of people have had IDLE problems there). Don't feel you _have_ to use IDLE as your interactive programming environment, there are tons of other choices - the python.org website has a page of links. From psimon at sonic.net Wed Nov 1 13:51:35 2017 From: psimon at sonic.net (Paul Simon) Date: Wed, 1 Nov 2017 10:51:35 -0700 Subject: [Tutor] missing idlelib and pip In-Reply-To: References: Message-ID: On 11/1/2017 9:08 AM, Mats Wichmann wrote: > On 11/01/17 04:39, Alan Gauld via Tutor wrote: >> On 01/11/17 04:30, Paul Simon wrote: >>> The python distribution for the Mageia 6 update does not include idlelib >>> or pip. Please tell me where to find them to add. >> >> IDLE should be in your package manager - along with zillions of >> other Python packages. You should just need to select it and >> install it. The caveat is that I don't use Mageia but that's >> how it works on every other Linux Python I've used. >> >> On my Mint system I use Synaptic as a package manager and typing >> idle into the search box brings up a long list in the form >> >> idle-pythonX.Y >> >> Where X.Y represent every version from 2.3 through to 3.6 >> Just select the version corresponding to your installed >> Python. >> > > Mageia is a descendant of Mandrake, which once upon a time (should be > over a decade ago by now) I used as my main system. If they haven't > changed away, that means you would search using urpmi... but you've > indicated you have asked them for things and not gotten a satisfactory > answer. > > You can _always_ just install your own Python environment. I have used > this to simplify management/installation: > > https://github.com/pyenv/pyenv > > Once you are running in a Python you have installed and are not messing > up the system version, you should be able to install whatever you want, > however you want, outside of whatever you think the distribution isn't > doing right. Installing from source the way pyenv does means you have a > full build, not one that's been segmented into sub-packages the way > Linux distributions do. > > Note: IDLE would require a properly working tkinter, which requires a > working tk library, which should not actually be a problem, it's not a > tough thing to do, but has managed to trip up many people (for example, > the system-provided tk on MacOS is not functional for this use so a lot > of people have had IDLE problems there). Don't feel you _have_ to use > IDLE as your interactive programming environment, there are tons of > other choices - the python.org website has a page of links. > > > _______________________________________________ > Tutor maillist - Tutor at python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > Thank you all very much. I assumed it was always installed with the standard library, and every time I upgrade to a new version of Mageia, I have the same problem and can never remember what I have done before. Pat of the problem for me is that idle is automatically installed with the Windows version. I got a lot of help from the Mageia group and now have all installed. Paul Simon From psimon at sonic.net Wed Nov 1 13:57:42 2017 From: psimon at sonic.net (Paul Simon) Date: Wed, 1 Nov 2017 10:57:42 -0700 Subject: [Tutor] missing idlelib and pip In-Reply-To: References: Message-ID: On 11/1/2017 9:08 AM, Mats Wichmann wrote: > On 11/01/17 04:39, Alan Gauld via Tutor wrote: >> On 01/11/17 04:30, Paul Simon wrote: >>> The python distribution for the Mageia 6 update does not include idlelib >>> or pip. Please tell me where to find them to add. >> >> IDLE should be in your package manager - along with zillions of >> other Python packages. You should just need to select it and >> install it. The caveat is that I don't use Mageia but that's >> how it works on every other Linux Python I've used. >> >> On my Mint system I use Synaptic as a package manager and typing >> idle into the search box brings up a long list in the form >> >> idle-pythonX.Y >> >> Where X.Y represent every version from 2.3 through to 3.6 >> Just select the version corresponding to your installed >> Python. >> > > Mageia is a descendant of Mandrake, which once upon a time (should be > over a decade ago by now) I used as my main system. If they haven't > changed away, that means you would search using urpmi... but you've > indicated you have asked them for things and not gotten a satisfactory > answer. > > You can _always_ just install your own Python environment. I have used > this to simplify management/installation: > > https://github.com/pyenv/pyenv > > Once you are running in a Python you have installed and are not messing > up the system version, you should be able to install whatever you want, > however you want, outside of whatever you think the distribution isn't > doing right. Installing from source the way pyenv does means you have a > full build, not one that's been segmented into sub-packages the way > Linux distributions do. > > Note: IDLE would require a properly working tkinter, which requires a > working tk library, which should not actually be a problem, it's not a > tough thing to do, but has managed to trip up many people (for example, > the system-provided tk on MacOS is not functional for this use so a lot > of people have had IDLE problems there). Don't feel you _have_ to use > IDLE as your interactive programming environment, there are tons of > other choices - the python.org website has a page of links. > > > _______________________________________________ > Tutor maillist - Tutor at python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > Thank you all very much. All is working fine now. I had always assumed that Idle and pip were installed with the standard library and not have to be separately installed. My experience is not much above novice and whenever I upgrade versions of Mageia I ask for help, sometimes in not the nicest way. I'm a bit older andmy memory is not always the best. Paul Simon From alan.gauld at yahoo.co.uk Wed Nov 1 14:49:26 2017 From: alan.gauld at yahoo.co.uk (Alan Gauld) Date: Wed, 1 Nov 2017 18:49:26 +0000 Subject: [Tutor] missing idlelib and pip In-Reply-To: References: Message-ID: On 01/11/17 16:08, Mats Wichmann wrote: > changed away, that means you would search using urpmi... If it uses RPM packages then there should definitely be Python and Tkinter packages available. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos From alan.gauld at yahoo.co.uk Wed Nov 1 14:56:07 2017 From: alan.gauld at yahoo.co.uk (Alan Gauld) Date: Wed, 1 Nov 2017 18:56:07 +0000 Subject: [Tutor] missing idlelib and pip In-Reply-To: References: Message-ID: On 01/11/17 17:57, Paul Simon wrote: > Thank you all very much. All is working fine now. I had always assumed > that Idle and pip were installed with the standard library and not have > to be separately installed. The Linux philosophy is that the user gets to choose so there should be no bloatware on your system. But if you choose to use something it should be esy to install - via the package manager. Many Linux distros use Python internally so the most basic Python installation is usually present but not necessarily the latest version, just the one needed to ru the tools. And IDLE is not needed for that so is usually an extra. By contrast the Windows philosophy is the user gets everything whether they need it or not and if the PC can't handle that then buy a new PC. Its easy but expensive. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos From george at fischhof.hu Thu Nov 2 09:26:29 2017 From: george at fischhof.hu (George Fischhof) Date: Thu, 2 Nov 2017 14:26:29 +0100 Subject: [Tutor] How to schedule the SFTP folder sync using python In-Reply-To: References: Message-ID: Hi Pareshkumar, I do not know what pysftp lib can do for you, but maybe you will need the scheduler too: https://pypi.python.org/pypi/schedule/ BR, George 2017-10-31 20:30 GMT+01:00 Pareshkumar Panchal : > Hi, > > can you help me about scheduling the folder sync between sftp and local > directory? > > pysftp library is good or you recommend different library? > > thank you > _______________________________________________ > Tutor maillist - Tutor at python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > From atuxnull at gmail.com Sat Nov 4 16:11:08 2017 From: atuxnull at gmail.com (Atux Atux) Date: Sat, 4 Nov 2017 22:11:08 +0200 Subject: [Tutor] double ended queue Message-ID: i am new to the area and i am struggling with a small project that i have. i need some help please. i need to create a program that runs constantly unless the user presses q to end it. the program asks the user for a number and puts the number in a queue, then it prints the queue with the new element at the end.if the number is with 01,02 then it will be added at the left hand side without the 0 at the beginning, otherwise at the right hand side. the user can remove an item from the end of the queue by typing r. if the user types '0r' it will be removed from the beginning of the queue. i got the starting point where it asks the user and goes until 'q' is pressed. while True: if input("\n\n\nType a number to add it to the queue or q to exit: ") == 'q': break but i a stuck on how to continue asking and adding to the list From alan.gauld at yahoo.co.uk Sat Nov 4 19:46:00 2017 From: alan.gauld at yahoo.co.uk (Alan Gauld) Date: Sat, 4 Nov 2017 23:46:00 +0000 Subject: [Tutor] double ended queue In-Reply-To: References: Message-ID: On 04/11/17 20:11, Atux Atux wrote: > i am new to the area and i am struggling with a small project that i have. You are on the right path. When faced with any software project you have to keep breaking it down till you get to something you can write. You've made a start, lets see what else needs doing: 1) create a program that runs constantly unless the user presses q to end it. Done! > the program asks the user for a number Kind of there except its asking for a string not a number. We need to do some work here. > and puts the number in a queue, then it prints the queue with the new > element at the end. We still need to do this bit > if the number is with 01,02 then it will be added at the > left hand side And this... > without the 0 at the beginning, > otherwise at the right hand > side. > the user can remove an item from the end of the queue by typing r. > if the user types '0r' it will be removed from the beginning of the queue. And all those but lets ignore them for now and just read a number, put it in the queue, print it out and keep going till the user hits 'q' while True: if input("\n\n\nType a number to add it to the queue or q to exit: ") == 'q': break So far so good but you want to do a few things to the input value so you need to store it in a variable response = input(....) if response.lower() == 'q': # allow user some latitude break number = int(response) # or do we need float??? Now you can add that to the list(aka quque) and print it. queue.append(number) print(queue) Try putting that all together with your existing code and see how it looks, then we can tackle the other more complicated options... -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos From steve at pearwood.info Sat Nov 4 20:26:38 2017 From: steve at pearwood.info (Steven D'Aprano) Date: Sun, 5 Nov 2017 11:26:38 +1100 Subject: [Tutor] double ended queue In-Reply-To: References: Message-ID: <20171105002637.GA15990@ando.pearwood.info> On Sat, Nov 04, 2017 at 10:11:08PM +0200, Atux Atux wrote: [...] > i got the starting point where it asks the user and goes until 'q' is > pressed. > > while True: > if input("\n\n\nType a number to add it to the queue or q to > exit: ") == 'q': > break > > but i a stuck on how to continue asking and adding to the list To start with, you have to actually have a list to add to. queue = [] To add to the left of the queue, use: queue.insert(0, value) To add to the right of the queue, use: queue.append(value) To delete the first value: del queue[0] and to delete the last: del queue[len(queue)-1] -- Steve From martin at linux-ip.net Sat Nov 4 21:31:04 2017 From: martin at linux-ip.net (Martin A. Brown) Date: Sat, 4 Nov 2017 18:31:04 -0700 Subject: [Tutor] double ended queue In-Reply-To: References: Message-ID: Hello and welcome duplicative Atux, >i am new to the area and i am struggling with a small project that i have. >i need some help please. New to Python, perhaps. New to programming, as well? >i need to create a program that runs constantly unless the user >presses q to end it. This is a good way to learn how to handle loops which can handle various conditions. I mention below a module called cmd, which ships as a part of the Python library, but it may be good to understand first how to handle the looping constructs before you move on to the cmd module. Consider a loop like you indicated: >while True: > if input("\n\n\nType a number to add it to the queue or q to exit: ") == 'q': > break There are quite a few valuable lessons in this simple task. * consider the what kind of data you are asking for; is it an integer, a string or a floating point value? Alan mentioned that in his message * be careful with the kind of data your user is entering, but it also teaches you the value of knowing what the data type is (an important lesson in most programming languages) * how do you loop successfully and how do you break out of the loop; you'll want to know about 'break' and you might find 'continue' useful, as well ------------------------------- # -- Python3 queue = list() status = '' instructions = "\n\nAdd a number to the queue or q to exit: " while True: # -- convert the string inputs to int(), float() or whatever type you want # the program to operate on # response = input(status + instructions) response = response.lower() # -- lower case the string if response == 'q': break # try: number = int(response) # -- or float(response) except ValueError: status = "Ignoring non-integer input: " + response continue queue.append(response) status = "queue = " + str(queue) ------------------------------- >the program asks the user for a number and puts the number in a >queue, then it prints the queue with the new element at the end.if >the number is with 01,02 then it will be added at the left hand >side without the 0 at the beginning, otherwise at the right hand >side. Steven has demonstrated how you could use the list() data structure to do what you describe. Note that Python comes with additional data structures and what you describe is known in Python as a deque. It's a bit less common of a data structure, so you could benefit from learning how to perform the prepend and append operations like Steven has suggested. If you haven't noticed that you can run the Python interpreter directly, you may find this helpful simply to play with the data structures. You can use a list() as you can see in the core documentation (and as Stephen mentioned), however, even in the main documentation is a pointer to the collections.deque, which is a more specific sort of data structure geared for exactly the use case you present. Important note; If humans are interacting with this, though, it's unlikely that any of the efficiency gains of a deque over a list are necessary, but here are links to the documentation: https://docs.python.org/3/tutorial/datastructures.html#using-lists-as-queues https://docs.python.org/3/library/collections.html#collections.deque >the user can remove an item from the end of the queue by typing r. >if the user types '0r' it will be removed from the beginning of the >queue. Once you have the addition of items to the queue and the looping worked out to your satisfaction, maybe you could share your progress and there might be somebody to provide a bit more help on the next step of your learning >but i a stuck on how to continue asking and adding to the list Good luck, -Martin -- Martin A. Brown http://linux-ip.net/ From atuxnull at gmail.com Sun Nov 5 03:07:31 2017 From: atuxnull at gmail.com (Atux Atux) Date: Sun, 5 Nov 2017 10:07:31 +0200 Subject: [Tutor] double ended queue In-Reply-To: References: Message-ID: Hi. Thanks a lot for the replies. i am actually nw to programming as well. your code keeps asking the user for a number and puts it to the end. how can i make it to add a number at the beginning if the user adds 01, then the program it will strip 0 and add 1 at ythe beginning, please? John On Sun, Nov 5, 2017 at 3:31 AM, Martin A. Brown wrote: > > Hello and welcome duplicative Atux, > > >i am new to the area and i am struggling with a small project that i have. > >i need some help please. > > New to Python, perhaps. New to programming, as well? > > >i need to create a program that runs constantly unless the user > >presses q to end it. > > This is a good way to learn how to handle loops which can handle > various conditions. I mention below a module called cmd, which > ships as a part of the Python library, but it may be good to > understand first how to handle the looping constructs before you > move on to the cmd module. > > Consider a loop like you indicated: > > >while True: > > if input("\n\n\nType a number to add it to the queue or q to exit: > ") == 'q': > > break > > There are quite a few valuable lessons in this simple task. > > * consider the what kind of data you are asking for; is it an > integer, a string or a floating point value? Alan mentioned > that in his message > * be careful with the kind of data your user is entering, but it > also teaches you the value of knowing what the data type is (an > important lesson in most programming languages) > * how do you loop successfully and how do you break out of the > loop; you'll want to know about 'break' and you might find > 'continue' useful, as well > > ------------------------------- > # -- Python3 > queue = list() > status = '' > instructions = "\n\nAdd a number to the queue or q to exit: " > > while True: > > # -- convert the string inputs to int(), float() or whatever type you > want > # the program to operate on > # > response = input(status + instructions) > response = response.lower() # -- lower case the string > if response == 'q': > break > > # > try: > number = int(response) # -- or float(response) > except ValueError: > status = "Ignoring non-integer input: " + response > continue > > queue.append(response) > status = "queue = " + str(queue) > ------------------------------- > > >the program asks the user for a number and puts the number in a > >queue, then it prints the queue with the new element at the end.if > >the number is with 01,02 then it will be added at the left hand > >side without the 0 at the beginning, otherwise at the right hand > >side. > > Steven has demonstrated how you could use the list() data structure > to do what you describe. Note that Python comes with additional > data structures and what you describe is known in Python as a deque. > It's a bit less common of a data structure, so you could benefit > from learning how to perform the prepend and append operations like > Steven has suggested. > > If you haven't noticed that you can run the Python interpreter > directly, you may find this helpful simply to play with the data > structures. > > You can use a list() as you can see in the core documentation (and > as Stephen mentioned), however, even in the main documentation is a > pointer to the collections.deque, which is a more specific sort of > data structure geared for exactly the use case you present. > > Important note; If humans are interacting with this, though, it's > unlikely that any of the efficiency gains of a deque over a list are > necessary, but here are links to the documentation: > > https://docs.python.org/3/tutorial/datastructures.html# > using-lists-as-queues > https://docs.python.org/3/library/collections.html#collections.deque > > >the user can remove an item from the end of the queue by typing r. > >if the user types '0r' it will be removed from the beginning of the > >queue. > > Once you have the addition of items to the queue and the looping > worked out to your satisfaction, maybe you could share your progress > and there might be somebody to provide a bit more help on the next > step of your learning > > >but i a stuck on how to continue asking and adding to the list > > Good luck, > > -Martin > > -- > Martin A. Brown > http://linux-ip.net/ > From steve at pearwood.info Sun Nov 5 04:27:01 2017 From: steve at pearwood.info (Steven D'Aprano) Date: Sun, 5 Nov 2017 20:27:01 +1100 Subject: [Tutor] double ended queue In-Reply-To: References: Message-ID: <20171105092701.GB15990@ando.pearwood.info> On Sun, Nov 05, 2017 at 10:07:31AM +0200, Atux Atux wrote: > Hi. Thanks a lot for the replies. i am actually nw to programming as well. > your code keeps asking the user for a number and puts it to the end. how > can i make it to add a number at the beginning if the user adds 01, then > the program it will strip 0 and add 1 at ythe beginning, please? This sounds like homework. We don't do people's homework for them. What have you tried? Hint: how to tell whether a string ends with "01" or not. if the_string.endswith("01"): print("insert the_string at the beginning") else: print("append the_string at the end") Second hint. Try running this in the Python interpreter and see what it does: the_string = "1234501" the_string = the_string[:-2] print(the_string) Third hint: I already showed you how to insert at the beginning, or append at the end, of the queue. We can provide you the pieces of the puzzle, but you have to put them together. -- Steve From atuxnull at gmail.com Sun Nov 5 10:05:04 2017 From: atuxnull at gmail.com (Atux Atux) Date: Sun, 5 Nov 2017 17:05:04 +0200 Subject: [Tutor] double ended queue In-Reply-To: <20171105092701.GB15990@ando.pearwood.info> References: <20171105092701.GB15990@ando.pearwood.info> Message-ID: ok then. how do i link 'r' to remove an item from right with mylist.pop(0) and how can i remove an item from left with '0r'? On Sun, Nov 5, 2017 at 11:27 AM, Steven D'Aprano wrote: > On Sun, Nov 05, 2017 at 10:07:31AM +0200, Atux Atux wrote: > > Hi. Thanks a lot for the replies. i am actually nw to programming as > well. > > your code keeps asking the user for a number and puts it to the end. how > > can i make it to add a number at the beginning if the user adds 01, then > > the program it will strip 0 and add 1 at ythe beginning, please? > > This sounds like homework. We don't do people's homework for them. What > have you tried? > > Hint: how to tell whether a string ends with "01" or not. > > if the_string.endswith("01"): > print("insert the_string at the beginning") > else: > print("append the_string at the end") > > > Second hint. Try running this in the Python interpreter and see what it > does: > > the_string = "1234501" > the_string = the_string[:-2] > print(the_string) > > > Third hint: I already showed you how to insert at the beginning, or > append at the end, of the queue. > > We can provide you the pieces of the puzzle, but you have to put them > together. > > > > -- > Steve > > _______________________________________________ > Tutor maillist - Tutor at python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > From alan.gauld at yahoo.co.uk Sun Nov 5 13:44:27 2017 From: alan.gauld at yahoo.co.uk (Alan Gauld) Date: Sun, 5 Nov 2017 18:44:27 +0000 Subject: [Tutor] double ended queue In-Reply-To: References: <20171105092701.GB15990@ando.pearwood.info> Message-ID: On 05/11/17 15:05, Atux Atux wrote: > ok then. how do i link 'r' to remove an item from right with mylist.pop(0) > and how can i remove an item from left with '0r'? Same way you detected the 'q' to quit. Using a variation of the 'code' I sent earlier: response = input(....).lower() # allow user some latitude if response == 'q': break elif response == 'r': # remove right elif response == '0r': # remove left else: number = int(response) # or do we need float??? -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos From tkadm30 at yandex.com Wed Nov 8 08:49:24 2017 From: tkadm30 at yandex.com (Etienne Robillard) Date: Wed, 8 Nov 2017 08:49:24 -0500 Subject: [Tutor] asyncio and wsgiref problem Message-ID: <53256a96-cf2a-2528-096c-fa938ab270fa@yandex.com> Hi, I'm trying to implement the asyncio.coroutine decorator in my wsgi app. Here's my server code: class AsyncIOController(WSGIController): def __init__(self, settings=None, executor=None, loop=None ): super(AsyncIOController, self).__init__(settings) # asyncio config. self._executor = executor self._loop = loop or get_event_loop() #@asyncio.coroutine def get_response(self, request=None, method='GET', data={}): response = super(AsyncIOController, self).get_response(request) return response @asyncio.coroutine def application(self, environ, start_response): with sessionmanager(environ): request.environ.update(environ) response = self.get_response(request=request)(environ, start_response) #assert isinstance(response, bytes), type(response) return response @asyncio.coroutine def __call__(self, environ, start_response, exc_info=None): result = self.application(environ, start_response) return result My test script: @asyncio.coroutine def app(environ, start_response): try: result = (yield from AsyncIOController().application(environ, start_response)) return result except: raise if __name__ == '__main__': server = simple_server.make_server('127.0.0.1', 8000, app) server.serve_forever() Should I attempt to decorate the AsyncIOController.get_response method with the asyncio.coroutine method ? Any ideas how to fix this script ? Thank you in advance, Etienne From mnickey at gmail.com Wed Nov 8 15:59:38 2017 From: mnickey at gmail.com (Mike Nickey) Date: Wed, 8 Nov 2017 12:59:38 -0800 Subject: [Tutor] Visual Studio issue when pip installing mysql-python Message-ID: Hi all, I understand that this might be out of the scope of this list but I am hopeful that someone has some insight on it so I can move forward with this project. This is a hail mary attempt to get this resolved. The issue that I am seeing is that I have a script that works well locally. I am trying to get this to work on a virtual machine (Windows Server 2012R). I the goal of this is to have the virtual machine run this automatically for us. When I am installing the dependancies for this script I am running into an issue with : pip install mysql-python The full Traceback is rather long but I can post it if needed. building '_mysql' extension creating build\temp.win-amd64-3.4 creating build\temp.win-amd64-3.4\Release c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include" -IC:\Python34\include -IC:\Python34\include /Tc_mysql.c /Fobuild\temp.win-amd64-3.4\Release\_mysql.obj /Zl _mysql.c _mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory error: command '"c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64\cl.exe"' failed with exit status 2 Any ideas on how to resolve this? I've already asked to have a linux virtual machine spun up for us but I'd love to hear what you think. -- ~MEN Portfolio Schedule a meeting with me! From mats at wichmann.us Wed Nov 8 16:17:45 2017 From: mats at wichmann.us (Mats Wichmann) Date: Wed, 8 Nov 2017 14:17:45 -0700 Subject: [Tutor] Visual Studio issue when pip installing mysql-python In-Reply-To: References: Message-ID: <83be02ef-1445-82b8-25e2-4beb9a465312@wichmann.us> On 11/08/2017 01:59 PM, Mike Nickey wrote: > Hi all, > > I understand that this might be out of the scope of this list but I am > hopeful that someone has some insight on it so I can move forward with this > project. This is a hail mary attempt to get this resolved. > > The issue that I am seeing is that I have a script that works well locally. > I am trying to get this to work on a virtual machine (Windows Server > 2012R). > I the goal of this is to have the virtual machine run this automatically > for us. > > When I am installing the dependancies for this script I am running into an > issue with : > pip install mysql-python > > The full Traceback is rather long but I can post it if needed. > > building '_mysql' extension > creating build\temp.win-amd64-3.4 > creating build\temp.win-amd64-3.4\Release > c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64\cl.exe > /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Dversion_info=(1,2,5,'final',1) > -D__version__=1.2.5 "-IC:\Program Files (x86)\MySQL\MySQL Connector C > 6.0.2\include" -IC:\Python34\include -IC:\Python34\include /Tc_mysql.c > /Fobuild\temp.win-amd64-3.4\Release\_mysql.obj /Zl > _mysql.c > _mysql.c(42) : fatal error C1083: Cannot open include file: > 'config-win.h': No such file or directory > error: command '"c:\Program Files (x86)\Microsoft Visual Studio > 10.0\VC\BIN\amd64\cl.exe"' failed with exit status 2 > > Any ideas on how to resolve this? > I've already asked to have a linux virtual machine spun up for us but I'd > love to hear what you think. Can't answer for you, not being a VS, or even Windows, guy, but a couple of notes: - people have been having problems with the mysql config-win.h for years. I bet you'll have some fun if you search for this on Stack Exchange. - VS 10.0 is _awfully_ old. If you're intentionally trying to use this version - don't. If it's falling over because of the VS tendency to try to support the whole world at once, I have no idea how to help you avoid that. You probably only want to intentionally support roughly [12.0 (aka VS 2013), 14.0 (aka VS 2015), 15.0 (aka CS 2017)] From tkadm30 at yandex.com Wed Nov 8 15:30:56 2017 From: tkadm30 at yandex.com (Etienne Robillard) Date: Wed, 8 Nov 2017 15:30:56 -0500 Subject: [Tutor] asyncio and wsgiref problem In-Reply-To: <53256a96-cf2a-2528-096c-fa938ab270fa@yandex.com> References: <53256a96-cf2a-2528-096c-fa938ab270fa@yandex.com> Message-ID: <67a2218a-f6e5-4eb8-97d1-3f1066518b51@yandex.com> This code is compatible with PEP-3333 on Python 3.5.3: @asyncio.coroutine def app(environ, start_response): try: result = (yield from AsyncIOController().application(environ, start_response)) except: raise else: #XXX result is a generator. this should not be needed? yield from result I updated my server code like so: class AsyncIOController(WSGIController): def __init__(self, settings=None, executor=None, loop=None ): super(AsyncIOController, self).__init__(settings) # asyncio config. self._executor = executor self._loop = loop or get_event_loop() #@asyncio.coroutine def get_response(self, request=None, method='GET', data={}): response = super(AsyncIOController, self).get_response(request) return response @asyncio.coroutine def application(self, environ, start_response): with sessionmanager(environ): request.environ.update(environ) response = self.get_response(request=request) #assert isinstance(response, bytes), type(response) return response(environ, start_response) @asyncio.coroutine def __call__(self, environ, start_response, exc_info=None): result = self.application(environ, start_response) return result How can i avoid calling "yield" twice in my test script ? Thank you, Etienne From tkadm30 at yandex.com Thu Nov 9 13:29:17 2017 From: tkadm30 at yandex.com (Etienne Robillard) Date: Thu, 9 Nov 2017 13:29:17 -0500 Subject: [Tutor] asyncio and wsgiref problem In-Reply-To: <67a2218a-f6e5-4eb8-97d1-3f1066518b51@yandex.com> References: <53256a96-cf2a-2528-096c-fa938ab270fa@yandex.com> <67a2218a-f6e5-4eb8-97d1-3f1066518b51@yandex.com> Message-ID: <3dd03f59-f186-ae9d-be5c-5c80b400cdb8@yandex.com> OK i figured that wsgiref (PEP-3333) is currently incompatible with asyncio. I'm not sure about the motivations of this incompatibility. Would it be so hard to make a "wsgiref.asyncio_server" extension for people wanting to use wsgiref for development without having to use a third-party extension? Anyways, I'm now using uWSGI for development and testing. Etienne Le 2017-11-08 ? 15:30, Etienne Robillard a ?crit?: > This code is compatible with PEP-3333 on Python 3.5.3: > > @asyncio.coroutine > def app(environ, start_response): > ??? try: > ??????? result = (yield from AsyncIOController().application(environ, > start_response)) > ??? except: > ??????? raise > ??? else: > > ??????? #XXX result is a generator. this should not be needed? > > ??????? yield from result > > I updated my server code like so: > > class AsyncIOController(WSGIController): > ??? def __init__(self, settings=None, executor=None, loop=None > ??????? ): > ??????? super(AsyncIOController, self).__init__(settings) > ??????? # asyncio config. > ??????? self._executor = executor > ??????? self._loop = loop or get_event_loop() > > ??? #@asyncio.coroutine > ??? def get_response(self, request=None, method='GET', data={}): > ??????? response = super(AsyncIOController, self).get_response(request) > ??????? return response > > ??? @asyncio.coroutine > ??? def application(self, environ, start_response): > ??????? with sessionmanager(environ): > ??????????? request.environ.update(environ) > ??????????? response = self.get_response(request=request) > ??????? #assert isinstance(response, bytes), type(response) > ??????? return response(environ, start_response) > > ??? @asyncio.coroutine > ??? def __call__(self, environ, start_response, exc_info=None): > ??????? result = self.application(environ, start_response) > ??????? return result > > How can i avoid calling "yield" twice in my test script ? > > Thank you, > > Etienne > > _______________________________________________ > Tutor maillist? -? Tutor at python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor -- Etienne Robillard tkadm30 at yandex.com http://www.isotopesoftware.ca/ From anish198519851985 at gmail.com Sun Nov 12 05:37:06 2017 From: anish198519851985 at gmail.com (anish singh) Date: Sun, 12 Nov 2017 02:37:06 -0800 Subject: [Tutor] Python creating trie Message-ID: Can someone explain me this code to create a trie from words? import collections words = ["bad", "sad", "abyss"] Trie = lambda: collections.defaultdict(Trie) trie = Trie() END = True for i, word in enumerate(words): reduce(dict.__getitem__, word, trie)[END] = i print(trie.values()) I am not able to understand lambda usage and reduce function here. Thanks, From __peter__ at web.de Sun Nov 12 06:40:59 2017 From: __peter__ at web.de (Peter Otten) Date: Sun, 12 Nov 2017 12:40:59 +0100 Subject: [Tutor] Python creating trie References: Message-ID: anish singh wrote: > Can someone explain me this code to create a trie > from words? > > import collections > words = ["bad", "sad", "abyss"] > > Trie = lambda: collections.defaultdict(Trie) > trie = Trie() > END = True > > for i, word in enumerate(words): > reduce(dict.__getitem__, word, trie)[END] = i > print(trie.values()) > > > I am not able to understand lambda usage and reduce > function here. foo = lambda: expr is just another way to write def foo(): return expr In the example the function is def Trie(): return collections.defauldict(Trie) This function creates a defaultdict whose values automatically spring into existence and are defaultdict themselves: >>> Trie = lambda: collections.defaultdict(Trie) >>> trie = Trie() >>> trie["a"]["b"]["c"] defaultdict( at 0x7f220e21cae8>, {}) >>> trie defaultdict( at 0x7f220e21cae8>, {'a': defaultdict( at 0x7f220e21cae8>, {'b': defaultdict( at 0x7f220e21cae8>, {'c': defaultdict( at 0x7f220e21cae8>, {})})})}) You can achieve the same with the standard dict by checking explicitly for the key: >>> trie = {} >>> t = trie >>> for key in ["a", "b", "c"]: ... if key not in t: ... t[key] = {} ... t = t[key] ... >>> trie {'a': {'b': {'c': {}}}} Can you rewrite this with the dict.setdefault() method? The reduce() function is basically a single loop: >>> def reduce(func, items, initial): ... result = initial ... for item in items: ... result = func(result, item) ... return result ... >>> reduce(lambda a, b: a + b, [1, 2, 3], 42) 48 Rewritten without reduce: >>> result = 42 >>> for item in [1, 2, 3]: ... result = result + item ... >>> result 48 If we rewrite your code following the examples above we get trie = {} END = True for i, word in enumerate(words): t = trie for c in word: t = t.setdefault(c, {}) t[END] = i print(trie.values()) which you may find a bit easier to follow. You are not alone. From steve at pearwood.info Sun Nov 12 06:48:33 2017 From: steve at pearwood.info (Steven D'Aprano) Date: Sun, 12 Nov 2017 22:48:33 +1100 Subject: [Tutor] Python creating trie In-Reply-To: References: Message-ID: <20171112114832.GH19802@ando.pearwood.info> On Sun, Nov 12, 2017 at 02:37:06AM -0800, anish singh wrote: > Can someone explain me this code to create a trie > from words? Not really. What makes this a trie? Where did you get this code from? > import collections > words = ["bad", "sad", "abyss"] > > Trie = lambda: collections.defaultdict(Trie) > trie = Trie() > END = True > > for i, word in enumerate(words): > reduce(dict.__getitem__, word, trie)[END] = i > print(trie.values()) > > > I am not able to understand lambda usage and reduce > function here. The lambda is exactly equivalent to: # Trie = lambda: collections.defaultdict(Trie) def Trie(): return collections.defaultdict(Trie) Does that help? The call to reduce (inside the loop) can be re-written as (untested): # for i, word in enumerate(words): # reduce(dict.__getitem__, word, trie)[END] = i for i, word in enumerate(words): value = trie for item in word: value = value[item] value[END] = i -- Steve From 01patrickliu at gmail.com Sun Nov 12 10:54:52 2017 From: 01patrickliu at gmail.com (=?UTF-8?B?5YqJ5qyK6Zme?=) Date: Sun, 12 Nov 2017 23:54:52 +0800 Subject: [Tutor] (no subject) Message-ID: ????closure ?????????? ?????????? def f1(a): def f2(b): return a+b return f2 f1=f1(10) ??f1????? ???????? From alan.gauld at yahoo.co.uk Sun Nov 12 18:06:03 2017 From: alan.gauld at yahoo.co.uk (Alan Gauld) Date: Sun, 12 Nov 2017 23:06:03 +0000 Subject: [Tutor] (no subject) In-Reply-To: References: Message-ID: On 12/11/17 15:54, ??? wrote: > ????closure ?????????? > ?????????? > > def f1(a): > def f2(b): > return a+b > return f2 > > f1=f1(10) > > ??f1????? ???????? Can you tell us what language this is? Or better still post an English translation? That's what most of us speak on this list... -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos From steve at pearwood.info Sun Nov 12 18:13:49 2017 From: steve at pearwood.info (Steven D'Aprano) Date: Mon, 13 Nov 2017 10:13:49 +1100 Subject: [Tutor] (no subject) In-Reply-To: References: Message-ID: <20171112231349.GI19802@ando.pearwood.info> Sorry ??? <01patrickliu at gmail.com>, but this is an English-language mailing list. I do not understand what question you are asking. On Sun, Nov 12, 2017 at 11:54:52PM +0800, ??? wrote: > ????closure ?????????? > ?????????? > > def f1(a): > def f2(b): > return a+b > return f2 > > f1=f1(10) > > ??f1????? ???????? -- Steve From alan.gauld at yahoo.co.uk Sun Nov 12 19:52:41 2017 From: alan.gauld at yahoo.co.uk (Alan Gauld) Date: Mon, 13 Nov 2017 00:52:41 +0000 Subject: [Tutor] Fwd: Re: (no subject) In-Reply-To: <1510530909.14476.1.camel@gmail.com> References: <1510530909.14476.1.camel@gmail.com> Message-ID: <82847cca-5978-155f-3d06-aeb7ba814f4c@yahoo.co.uk> Forwarding to the list... From: RRRoy BBBean Organisation: DDDead MMMail To: Alan Gauld , tutor at python.org On Sun, 2017-11-12 at 23:06 +0000, Alan Gauld via Tutor wrote: > On 12/11/17 15:54, ??? wrote: ... > Can you tell us what language this is? > Or better still post an English translation? > That's what most of us speak on this list... ... It's Chinese. Google Translate does a decent job with Chinese, much better than Korean at least. > I encountered some problems when using closure. > For example, a simple example, > > def f1 (a): > def f2 (b): > return a + b > return f2 > > f1 = f1 (10) > > This time f1 conflict, is this normal? It appears to be a question about currying in Python? From alan.gauld at yahoo.co.uk Wed Nov 15 12:41:14 2017 From: alan.gauld at yahoo.co.uk (Alan Gauld) Date: Wed, 15 Nov 2017 17:41:14 +0000 Subject: [Tutor] Updates to web tutor Message-ID: Only just on topic but i'd like some help please... I've been doing some much needed maintenance to my web tutor. In particular I'm trying to move it from the (web)stone age of HTML3 and Frames to HTML5/CSS and provide a responsive/reactive design. Along the way I've also completely changed the styling to give it a more modern appearance(*). I'm now at the stage where some independent feedback would be useful so if anyone feels like trying out the new design I'd appreciate any feedback - especially on how it works on mobile devices of the Apple variety. The test site is: http://www.alan-g.me.uk/l2p2/ I've done the first 2 sections - up to the Error Handling topic. PS: There is very little changed in the actual content so far - just a few typos fixed and a couple of extra explanatory paragraphs I've been meaning to add for a while. Its really the web design that I'm working on just now. (*)The TOC will eventually be restyled to a block menu look but is just boring hyperlinks for now. Any feedback is appreciated. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos From eddio0141 at gmail.com Wed Nov 15 17:16:35 2017 From: eddio0141 at gmail.com (Eddio 0141) Date: Wed, 15 Nov 2017 22:16:35 +0000 Subject: [Tutor] input string to own console stdin Message-ID: Hi. I've been searching on google about inputting to own stdin and press enter but so far i haven't found anything at all. so what im trying to do is the chatterbot function i got on python doesn't seem to accept string as an input and always wants a console input and Enter (the line -> response = bot.get_response(input string)) so instead, im finding a way to put the input to the stdin and automatically press enter. i have tried this [ https://stackoverflow.com/questions/8475290/how-do-i-write-to-a-python-subprocess-stdin ] but even it doesn't give me an syntax error, it did absolutely nothing. Please help. Thanks From alan.gauld at yahoo.co.uk Wed Nov 15 19:47:13 2017 From: alan.gauld at yahoo.co.uk (Alan Gauld) Date: Thu, 16 Nov 2017 00:47:13 +0000 Subject: [Tutor] input string to own console stdin In-Reply-To: References: Message-ID: On 15/11/17 22:16, Eddio 0141 wrote: > Hi. > I've been searching on google about inputting to own stdin and press enter > but so far i haven't found anything at all. You need to give us a bit more context. This doesn't look like standard library stuff so which package are you using? (Is that what chatterbot is?) Also without seeing the code that doesn't work we can only make wild guesses about whats going wrong. One thing to consider is that if (as I assume) you are trying to talk to another process from Python you need to be sending your data on stdout for it to be read on the other process' stdin. You will also need to ensure that Pipes are switched on in subprocess and that your execution environment is piping your stdout to their stdin. eg you start chatterbot with something like: $ python myscript.py|chatterbot or $ chatterbot < python myscript.py But show us your code, it will make life easier for all of us. > i have tried this > [ > https://stackoverflow.com/questions/8475290/how-do-i-write-to-a-python-subprocess-stdin > ] > but even it doesn't give me an syntax error, it did absolutely nothing. See, even that question doesn't make sense, since you *read* from stdin not write to it. It sounds like a fundamental concepts kind of thing... -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos From sudipta.mml at gmail.com Thu Nov 16 11:55:47 2017 From: sudipta.mml at gmail.com (sudipta.mml) Date: Thu, 16 Nov 2017 08:55:47 -0800 Subject: [Tutor] Fw(4): sudipta.mml@gmail.com Message-ID: This message can only be viewed in a browser. To view this message please click here Thu, 16 Nov 2017 08:55:47 -0800 Yahoo error code: mptsm From ghering at hotmail.com Fri Nov 17 20:51:16 2017 From: ghering at hotmail.com (adam ghering) Date: Sat, 18 Nov 2017 01:51:16 +0000 Subject: [Tutor] QT5 pyqt5 for python 2.7 Message-ID: Hello, I am trying to get up to speed on python; expand my skills etc. I work in a VFX environment where most all the tools continue to run with python 2.7XX I have seen that pyqt5 supports python 2.7 according to its documentation but it needs to be rebuilt to function. I have done some homework on the subject and tried to download, tweak and install some things but nothing works. Can someone point me in the right direction? Also I see QT5 mentioned in addition to pyqt5 or like pyqt5 is just a binding of QT5 to python? can someone explain. ideally i just need the holes filled in as I have searched and searched and there seems to be no clear path to getting this working even though people are using it and have rebuilt it already. appreciate any help up front Best, From alan.gauld at yahoo.co.uk Sat Nov 18 04:28:59 2017 From: alan.gauld at yahoo.co.uk (Alan Gauld) Date: Sat, 18 Nov 2017 09:28:59 +0000 Subject: [Tutor] QT5 pyqt5 for python 2.7 In-Reply-To: References: Message-ID: On 18/11/17 01:51, adam ghering wrote: > I have seen that pyqt5 supports python 2.7 according to its documentation > but it needs to be rebuilt to function. Thats unusual, usually you can find a binary by somebody. But provided you have the dev tools building from source shoulkd not be too difficult. > I have done some homework on the subject and tried to download, tweak and install some things but nothing works. Define "othing works" Can you download it? What tweaks? What happened? What kind of install, how did you do it? What errors did you get? We need specifics. > Also I see QT5 mentioned in addition to pyqt5 or like > pyqt5 is just a binding of QT5 to python? can someone explain. Thats correct. QT5 is the actual C/C++ UI Library and pyqt5 is a Python binding to that. (Similaar to the forked "side" project which you might also explore since they might have a binary ready built) > ideally i just need the holes filled in as I have searched > and searched and there seems to be no clear path There are side and pyqt support forums, your best bet for detailed help is to ask there. Alan G From breamoreboy at gmail.com Sat Nov 18 05:09:41 2017 From: breamoreboy at gmail.com (Mark Lawrence) Date: Sat, 18 Nov 2017 10:09:41 +0000 Subject: [Tutor] QT5 pyqt5 for python 2.7 In-Reply-To: References: Message-ID: On 18/11/17 01:51, adam ghering wrote: > Hello, > > I am trying to get up to speed on python; expand my skills etc. > > I work in a VFX environment where most all the tools continue to run with python 2.7XX > > I have seen that pyqt5 supports python 2.7 according to its documentation but it needs to be rebuilt to function. > > I have done some homework on the subject and tried to download, tweak and install some things but nothing works. > > Can someone point me in the right direction? > > Also I see QT5 mentioned in addition to pyqt5 or like pyqt5 is just a binding of QT5 to python? can someone explain. > > ideally i just need the holes filled in as I have searched and searched and there seems to be no clear path to getting this working even though people are using it and have rebuilt it already. > > appreciate any help up front > > Best, > Just search for "pyqt5 python 2.7 your-os" without the quotes, there's loads of hits for linux and its variants, mac and windows. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence From ghering at hotmail.com Sat Nov 18 13:03:02 2017 From: ghering at hotmail.com (adam ghering) Date: Sat, 18 Nov 2017 18:03:02 +0000 Subject: [Tutor] QT5 pyqt5 for python 2.7 In-Reply-To: References: , Message-ID: I have what seems like two responses but there are no text at all in the body of the messages. Is there a way I am supposed to see these? Best, ________________________________ From: Tutor on behalf of Mark Lawrence Sent: Saturday, November 18, 2017 2:09:41 AM To: tutor at python.org Subject: Re: [Tutor] QT5 pyqt5 for python 2.7 On 18/11/17 01:51, adam ghering wrote: > Hello, > > I am trying to get up to speed on python; expand my skills etc. > > I work in a VFX environment where most all the tools continue to run with python 2.7XX > > I have seen that pyqt5 supports python 2.7 according to its documentation but it needs to be rebuilt to function. > > I have done some homework on the subject and tried to download, tweak and install some things but nothing works. > > Can someone point me in the right direction? > > Also I see QT5 mentioned in addition to pyqt5 or like pyqt5 is just a binding of QT5 to python? can someone explain. > > ideally i just need the holes filled in as I have searched and searched and there seems to be no clear path to getting this working even though people are using it and have rebuilt it already. > > appreciate any help up front > > Best, > Just search for "pyqt5 python 2.7 your-os" without the quotes, there's loads of hits for linux and its variants, mac and windows. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence _______________________________________________ Tutor maillist - Tutor at python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor From alan.gauld at yahoo.co.uk Sun Nov 19 05:10:53 2017 From: alan.gauld at yahoo.co.uk (Alan Gauld) Date: Sun, 19 Nov 2017 10:10:53 +0000 Subject: [Tutor] Try the list archive Re: QT5 pyqt5 for python 2.7 In-Reply-To: References: Message-ID: On 18/11/17 18:03, adam ghering wrote: > I have what seems like two responses but there are no text at all in the body of the messages. > > > Is there a way I am supposed to see these? You should see the body but youcan try the list archive via a browser... Alan g From breamoreboy at gmail.com Sun Nov 19 08:58:14 2017 From: breamoreboy at gmail.com (Mark Lawrence) Date: Sun, 19 Nov 2017 13:58:14 +0000 Subject: [Tutor] QT5 pyqt5 for python 2.7 In-Reply-To: References: Message-ID: On 18/11/17 18:03, adam ghering wrote: > I have what seems like two responses but there are no text at all in the body of the messages. > > Is there a way I am supposed to see these? > > Best, > > ________________________________ > From: Tutor on behalf of Mark Lawrence > Sent: Saturday, November 18, 2017 2:09:41 AM > To: tutor at python.org > Subject: Re: [Tutor] QT5 pyqt5 for python 2.7 > > On 18/11/17 01:51, adam ghering wrote: >> Hello, >> >> I am trying to get up to speed on python; expand my skills etc. >> >> I work in a VFX environment where most all the tools continue to run with python 2.7XX >> >> I have seen that pyqt5 supports python 2.7 according to its documentation but it needs to be rebuilt to function. >> >> I have done some homework on the subject and tried to download, tweak and install some things but nothing works. >> >> Can someone point me in the right direction? >> >> Also I see QT5 mentioned in addition to pyqt5 or like pyqt5 is just a binding of QT5 to python? can someone explain. >> >> ideally i just need the holes filled in as I have searched and searched and there seems to be no clear path to getting this working even though people are using it and have rebuilt it already. >> >> appreciate any help up front >> >> Best, >> > > Just search for "pyqt5 python 2.7 your-os" without the quotes, there's > loads of hits for linux and its variants, mac and windows. > > -- > My fellow Pythonistas, ask not what our language can do for you, ask > what you can do for our language. > > Mark Lawrence > One can only conclude that some subscribers are not aware of the preference for bottom posting on this list. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence From s.molnar at sbcglobal.net Sun Nov 19 11:36:47 2017 From: s.molnar at sbcglobal.net (Stephen P. Molnar) Date: Sun, 19 Nov 2017 11:36:47 -0500 Subject: [Tutor] AttributeError: 'BezierPath' object has no attribute '_draw_solid' Message-ID: <5A11B31F.7060900@sbcglobal.net> I have written a short Python 3 script to plot three curves (one plot) of data from a FORTRAN program. Initially the code worked and produced the plot which is attached. I have also attached the code and the input data, In all candor, I don't have the faintest idea as to whst the problem (or problens) might be and would greatly appreciate a pointer towards the solution. Thanks in advance. -- Stephen P. Molnar, Ph.D. Life is a fuzzy set www.molecular-modeling.net Stochastic and multivariate (614)312-7528 (c) Skype: smolnar1 -------------- next part -------------- 0.150000 1457.204006 998.233839 -0.018612 0.300000 1344.817934 931.699910 -0.017571 0.450000 1170.330414 827.700509 -0.015915 0.600000 951.240195 695.702122 -0.013757 0.750000 708.832611 547.341272 -0.011238 0.900000 465.526861 395.074189 -0.008520 1.050000 242.168335 250.776922 -0.005770 1.200000 55.640011 124.478386 -0.003147 1.350000 -82.889238 23.385404 -0.000790 1.500000 -168.863907 -48.686568 0.001192 1.650000 -204.304928 -91.423531 0.002725 1.800000 -196.892849 -107.676083 0.003774 1.950000 -158.353900 -102.749215 0.004342 2.100000 -102.425393 -83.440486 0.004465 2.250000 -42.724395 -56.976574 0.004210 2.400000 9.160768 -30.003148 0.003659 2.550000 45.090063 -7.765044 0.002907 2.700000 61.128133 6.423416 0.002048 2.850000 57.577347 11.367836 0.001171 3.000000 38.344275 7.846857 0.000349 3.150000 9.797326 -1.817135 -0.000359 3.300000 -20.657232 -14.377418 -0.000917 3.450000 -46.025084 -26.358616 -0.001307 3.600000 -60.958617 -34.712347 -0.001528 3.750000 -62.589086 -37.332393 -0.001596 3.900000 -50.849425 -33.359410 -0.001536 4.050000 -28.274206 -23.244463 -0.001380 4.200000 0.647490 -8.581977 -0.001162 4.350000 30.419924 8.240844 -0.000915 4.500000 55.601812 24.504898 -0.000668 4.650000 71.786890 37.644793 -0.000444 4.800000 76.337446 45.676179 -0.000259 4.950000 68.758579 47.497775 -0.000122 5.100000 50.671170 43.026846 -0.000036 5.250000 25.414468 33.157608 0.000001 5.400000 -2.627852 19.562143 -0.000004 5.550000 -28.841964 4.378077 -0.000039 5.700000 -49.186470 -10.157324 -0.000095 5.850000 -60.843330 -22.062653 -0.000159 6.000000 -62.613119 -29.900128 -0.000219 6.150000 -55.002707 -32.954002 -0.000264 6.300000 -40.011347 -31.279440 -0.000284 6.450000 -20.674231 -25.624738 -0.000272 6.600000 -0.461617 -17.250484 -0.000223 6.750000 17.349547 -7.684285 -0.000134 6.900000 30.217978 1.543060 -0.000007 7.050000 36.704572 9.135157 0.000153 7.200000 36.611564 14.205163 0.000340 7.350000 30.887904 16.366163 0.000542 7.500000 21.337500 15.730856 0.000745 7.650000 10.200327 12.830456 0.000931 7.800000 -0.305538 8.475307 0.001083 7.950000 -8.392428 3.587153 0.001184 8.100000 -12.989800 -0.965458 0.001218 8.250000 -13.865349 -4.501286 0.001173 8.400000 -11.571637 -6.611087 0.001043 8.550000 -7.243459 -7.184785 0.000828 8.700000 -2.298165 -6.384063 0.000537 8.850000 1.893836 -4.572551 0.000186 9.000000 4.300063 -2.221752 -0.000202 9.150000 4.422590 0.187190 -0.000598 9.300000 2.366936 2.247742 -0.000969 9.450000 -1.222319 3.685155 -0.001284 9.600000 -5.337564 4.380342 -0.001511 9.750000 -8.852834 4.361341 -0.001629 9.900000 -10.782542 3.769297 -0.001621 10.050000 -10.499667 2.809727 -0.001487 10.200000 -7.869748 1.701068 -0.001234 10.350000 -3.276223 0.631156 -0.000884 10.500000 2.464059 -0.271036 -0.000469 10.650000 8.273897 -0.945429 -0.000028 10.800000 13.038886 -1.394038 0.000399 10.950000 15.833457 -1.662153 0.000770 11.100000 16.103771 -1.814211 0.001050 11.250000 13.771794 -1.911156 0.001215 11.400000 9.242103 -1.994565 0.001252 11.550000 3.313230 -2.080285 0.001163 11.700000 -2.985528 -2.161399 0.000962 11.850000 -8.596642 -2.217844 0.000678 12.000000 -12.634473 -2.228480 0.000348 12.150000 -14.543259 -2.181162 0.000011 12.300000 -14.183265 -2.077415 -0.000293 12.450000 -11.831038 -1.930211 -0.000529 12.600000 -8.097637 -1.755702 -0.000673 12.750000 -3.785170 -1.561765 -0.000713 12.900000 0.286255 -1.337475 -0.000649 13.050000 3.444324 -1.047676 -0.000496 13.200000 5.289172 -0.635686 -0.000280 13.350000 5.752874 -0.035101 -0.000031 13.500000 5.084229 0.810898 0.000214 13.650000 3.765365 1.926706 0.000424 13.800000 2.380864 3.283445 0.000570 13.950000 1.469617 4.786014 0.000637 14.100000 1.392498 6.272847 0.000617 14.250000 2.244816 7.530844 0.000516 14.400000 3.832308 8.324771 0.000351 14.550000 5.715404 8.437061 0.000146 14.700000 7.311696 7.711171 -0.000073 14.850000 8.033953 6.090102 -0.000276 15.000000 7.433384 3.641765 -0.000439 15.150000 5.316604 0.564736 -0.000543 15.300000 1.810210 -2.828748 -0.000580 15.450000 -2.642187 -6.151479 -0.000548 15.600000 -7.351504 -8.996319 -0.000458 15.750000 -11.509884 -10.998722 -0.000323 15.900000 -14.347438 -11.895943 -0.000165 16.050000 -15.287336 -11.572105 -0.000005 16.200000 -14.067416 -10.080444 0.000138 16.350000 -10.802914 -7.637870 0.000248 16.500000 -5.976553 -4.591918 0.000313 16.650000 -0.356722 -1.365240 0.000331 16.800000 5.141053 1.612947 0.000304 16.950000 9.622693 3.976462 0.000240 17.100000 12.381359 5.480370 0.000150 17.250000 13.027990 6.037313 0.000047 17.400000 11.560979 5.725370 -0.000056 17.550000 8.361334 4.766082 -0.000148 17.700000 4.114364 3.476794 -0.000220 17.850000 -0.326569 2.206282 -0.000267 18.000000 -4.107304 1.265785 -0.000287 18.150000 -6.538177 0.868443 -0.000282 18.300000 -7.224883 1.088608 -0.000252 18.450000 -6.139379 1.848705 -0.000204 18.600000 -3.617297 2.936154 -0.000139 18.750000 -0.282930 4.047106 -0.000062 18.900000 3.082729 4.848645 0.000024 19.050000 5.704201 5.047554 0.000114 19.200000 6.971360 4.452410 0.000206 19.350000 6.564880 3.017031 0.000294 19.500000 4.522214 0.856722 0.000374 19.650000 1.230971 -1.766056 0.000438 19.800000 -2.648913 -4.484225 0.000481 19.950000 -6.318611 -6.889144 0.000496 20.100000 -9.002726 -8.602539 0.000477 20.250000 -10.107995 -9.344044 0.000422 20.400000 -9.346550 -8.981821 0.000330 20.550000 -6.798915 -7.556928 0.000205 20.700000 -2.903834 -5.276963 0.000055 20.850000 1.623478 -2.480263 -0.000108 21.000000 5.928860 0.422670 -0.000271 21.150000 9.185629 3.019640 -0.000419 21.300000 10.757201 4.966197 -0.000537 21.450000 10.323870 6.041463 -0.000612 21.600000 7.948619 6.180453 -0.000637 21.750000 4.068745 5.477529 -0.000608 21.900000 -0.585430 4.161075 -0.000530 22.050000 -5.129229 2.544839 -0.000409 22.200000 -8.692916 0.965619 -0.000260 22.350000 -10.588841 -0.280687 -0.000100 22.500000 -10.444054 -0.992625 0.000055 22.650000 -8.272710 -1.096543 0.000188 22.800000 -4.474256 -0.654048 0.000287 22.950000 0.242214 0.157064 0.000342 23.100000 4.992771 1.083970 0.000352 23.250000 8.886579 1.853469 0.000319 23.400000 11.194571 2.229163 0.000253 23.550000 11.486519 2.059953 0.000167 23.700000 9.710378 1.310590 0.000074 23.850000 6.199083 0.068697 -0.000010 24.000000 1.604060 -1.472605 -0.000074 24.150000 -3.231163 -3.052584 -0.000107 24.300000 -7.432407 -4.393498 -0.000107 24.450000 -10.259983 -5.253775 -0.000075 24.600000 -11.245723 -5.473386 -0.000015 24.750000 -10.275890 -5.002726 0.000061 24.900000 -7.604690 -3.909790 0.000143 25.050000 -3.796750 -2.364759 0.000217 25.200000 0.389244 -0.605594 0.000273 25.350000 4.152273 1.108109 0.000301 25.500000 6.805936 2.543593 0.000298 25.650000 7.909843 3.536125 0.000263 25.800000 7.350003 4.014905 0.000199 25.950000 5.353055 4.009026 0.000113 26.100000 2.432371 3.632910 0.000015 26.250000 -0.722508 3.054842 -0.000086 26.400000 -3.390524 2.455632 -0.000178 26.550000 -4.968693 1.986324 -0.000255 26.700000 -5.096709 1.733989 -0.000310 26.850000 -3.731726 1.702825 -0.000341 27.000000 -1.158468 1.814569 -0.000347 27.150000 2.067294 1.928147 -0.000331 27.300000 5.230689 1.874430 -0.000297 27.450000 7.602892 1.498788 -0.000250 27.600000 8.590698 0.702348 -0.000195 27.750000 7.860842 -0.526952 -0.000137 27.900000 5.414273 -2.100526 -0.000078 28.050000 1.595387 -3.836088 -0.000021 28.200000 -2.966087 -5.484824 0.000033 28.350000 -7.469726 -6.774045 0.000083 28.500000 -11.093709 -7.457409 0.000130 28.650000 -13.150129 -7.363012 0.000173 28.800000 -13.216479 -6.429907 0.000210 28.950000 -11.218047 -4.725585 0.000241 29.100000 -7.445355 -2.440554 0.000261 29.250000 -2.503302 0.139537 0.000267 29.400000 2.798296 2.679474 0.000257 29.550000 7.591889 4.849545 0.000229 29.700000 11.109157 6.380035 0.000181 29.850000 12.818104 7.105092 0.000116 30.000000 12.514665 6.987915 0.000037 30.150000 10.352073 6.122683 -0.000048 From wrw at mac.com Sun Nov 19 15:10:40 2017 From: wrw at mac.com (William Ray Wing) Date: Sun, 19 Nov 2017 15:10:40 -0500 Subject: [Tutor] AttributeError: 'BezierPath' object has no attribute '_draw_solid' In-Reply-To: <5A11B31F.7060900@sbcglobal.net> References: <5A11B31F.7060900@sbcglobal.net> Message-ID: <248AF619-AE3B-409A-BB96-937089525B22@mac.com> > On Nov 19, 2017, at 11:36 AM, Stephen P. Molnar wrote: > > I have written a short Python 3 script to plot three curves (one plot) of data from a FORTRAN program. Initially the code worked and produced the plot which is attached. I have also attached the code and the input data, > The data made it through, neither the script nor the plot did. If the script really is short, perhaps you could just cut and paste it into a follow-up msg. Absent that, no one here can help you. Thanks, Bill > In all candor, I don't have the faintest idea as to whst the problem (or problens) might be and would greatly appreciate a pointer towards the solution. > > Thanks in advance. > > -- > Stephen P. Molnar, Ph.D. Life is a fuzzy set > www.molecular-modeling.net Stochastic and multivariate > (614)312-7528 (c) > Skype: smolnar1 > > _______________________________________________ > Tutor maillist - Tutor at python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor From wrw at mac.com Sun Nov 19 16:51:06 2017 From: wrw at mac.com (William Ray Wing) Date: Sun, 19 Nov 2017 16:51:06 -0500 Subject: [Tutor] AttributeError: 'BezierPath' object has no attribute '_draw_solid' In-Reply-To: <5A11E613.6050509@sbcglobal.net> References: <5A11B31F.7060900@sbcglobal.net> <248AF619-AE3B-409A-BB96-937089525B22@mac.com> <5A11E613.6050509@sbcglobal.net> Message-ID: <52996304-86B9-4037-8CCE-8CE943F1E199@mac.com> > On Nov 19, 2017, at 3:14 PM, Stephen P. Molnar wrote: > > > On 11/19/2017 03:10 PM, William Ray Wing wrote: >>> On Nov 19, 2017, at 11:36 AM, Stephen P. Molnar wrote: >>> >>> I have written a short Python 3 script to plot three curves (one plot) of data from a FORTRAN program. Initially the code worked and produced the plot which is attached. I have also attached the code and the input data, >>> >> The data made it through, neither the script nor the plot did. If the script really is short, perhaps you could just cut and paste it into a follow-up msg. Absent that, no one here can help you. >> >> Thanks, >> Bill >> >>> In all candor, I don't have the faintest idea as to whst the problem (or problens) might be and would greatly appreciate a pointer towards the solution. >>> >>> Thanks in advance. >>> >>> -- >>> Stephen P. Molnar, Ph.D. Life is a fuzzy set >>> www.molecular-modeling.net Stochastic and multivariate >>> (614)312-7528 (c) >>> Skype: smolnar1 >>> >>> _______________________________________________ >>> Tutor maillist - Tutor at python.org >>> To unsubscribe or change subscription options: >>> https://mail.python.org/mailman/listinfo/tutor >> > Unfortunately your mail reader/program has pasted it in as an RTF file and this makes it almost impossible to look at in a text editor or hand to the Python interpreter. What we see looks like the following (I?ve pasted in the first few lines). ??????????????? Multiple_Plots_2_b.py\ \ Copyright (c) 2017 Stephen P. Molnar, Ph.D. \'a0All rights reserved.\ \ """\ import numpy as np\ from mpl_toolkits.axes_grid1 import host_subplot\ import mpl_toolkits.axisartist as AA\ import matplotlib.pyplot as plt\ \ data = []\ name = input("Enter Molecule ID: ")\ \ name_in = name+'_poutput'\ data = np.genfromtxt(name_in)\ \ s = data[:,0]\ FTm = data[:,1] \'a0\'a0\'a0\'a0#atomic number\ FTe = data[:,2] \'a0\'a0\'a0\'a0#atomic mass\ FTc = data[:,3] \'a0\'a0\'a0\'a0#atom electron density\ \ \ fig = plt.figure(figsize=(7.6,4))\ \ host = host_subplot(111, axes_class=AA.Axes)\ plt.subplots_adjust(right=0.75)\ \ par1 = host.twinx()\ par2 = host.twinx()\ \ offset = 60\ new_fixed_axis = par2.get_grid_helper().new_fixed_axis\ par2.axis["right"] = new_fixed_axis(loc="right", axes=par2,\ \'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0offset=(offset, 0))\ \ ------------------------------- > Here it is: > > #!/usr/bin/env python3 > # -*- coding: utf-8 -*- > """ > Multiple_Plots_2_b.py > > Copyright (c) 2017 Stephen P. Molnar, Ph.D. All rights reserved. > > """ > import numpy as np > from mpl_toolkits.axes_grid1 import host_subplot > import mpl_toolkits.axisartist as AA > import matplotlib.pyplot as plt > > data = [] > name = input("Enter Molecule ID: ") > > name_in = name+'_poutput' > data = np.genfromtxt(name_in) > > s = data[:,0] > FTm = data[:,1] #atomic number > FTe = data[:,2] #atomic mass > FTc = data[:,3] #atom electron density > > > fig = plt.figure(figsize=(7.6,4)) > > host = host_subplot(111, axes_class=AA.Axes) > plt.subplots_adjust(right=0.75) > > par1 = host.twinx() > par2 = host.twinx() > > offset = 60 > new_fixed_axis = par2.get_grid_helper().new_fixed_axis > par2.axis["right"] = new_fixed_axis(loc="right", axes=par2, > offset=(offset, 0)) > > par2.axis["right"].toggle(all=True) > > host.set_xlim(0, 30) > """ > host.set_ylim(min(FTm), max(FTm)) > """ > > host.set_xlabel("Distance ($\AA$)") > host.set_ylabel("Atomic Number") > par1.set_ylabel("Atom Mass") > par2.set_ylabel("Atom Electron Density") > > p1, = host.plot(data[:,0], data[:,1])#, label="Atomic Number") > p2, = par1.plot(data[:,0], data[:,2])#, label="Atom Mass") > p3, = par2.plot(data[:,0], data[:,3])#, label="Atom Electron Density") > > """ > par1.set_ylim(min(FTe), max(FTe)) > par2.set_ylim(min(FTc),max(FTc)) > """ > > #host.legend() > > host.axis["left"].label.set_color(p1.get_color()) > par1.axis["right"].label.set_color(p2.get_color()) > par2.axis["right"].label.set_color(p3.get_color()) > > host.title.set_text('Molecule {0} - Molecular Transforms'.format(name)) > plt.draw() > plt.show() > > name_plt = name+'-fig1.png' > fig.savefig(name_plt,bbox_inches='tight') > > > -- > Stephen P. Molnar, Ph.D. Life is a fuzzy set > www.molecular-modeling.net Stochastic and multivariate > (614)312-7528 (c) > Skype: smolnar1 > From s.molnar at sbcglobal.net Sun Nov 19 15:14:11 2017 From: s.molnar at sbcglobal.net (Stephen P. Molnar) Date: Sun, 19 Nov 2017 15:14:11 -0500 Subject: [Tutor] AttributeError: 'BezierPath' object has no attribute '_draw_solid' In-Reply-To: <248AF619-AE3B-409A-BB96-937089525B22@mac.com> References: <5A11B31F.7060900@sbcglobal.net> <248AF619-AE3B-409A-BB96-937089525B22@mac.com> Message-ID: <5A11E613.6050509@sbcglobal.net> On 11/19/2017 03:10 PM, William Ray Wing wrote: >> On Nov 19, 2017, at 11:36 AM, Stephen P. Molnar wrote: >> >> I have written a short Python 3 script to plot three curves (one plot) of data from a FORTRAN program. Initially the code worked and produced the plot which is attached. I have also attached the code and the input data, >> > The data made it through, neither the script nor the plot did. If the script really is short, perhaps you could just cut and paste it into a follow-up msg. Absent that, no one here can help you. > > Thanks, > Bill > >> In all candor, I don't have the faintest idea as to whst the problem (or problens) might be and would greatly appreciate a pointer towards the solution. >> >> Thanks in advance. >> >> -- >> Stephen P. Molnar, Ph.D. Life is a fuzzy set >> www.molecular-modeling.net Stochastic and multivariate >> (614)312-7528 (c) >> Skype: smolnar1 >> >> _______________________________________________ >> Tutor maillist - Tutor at python.org >> To unsubscribe or change subscription options: >> https://mail.python.org/mailman/listinfo/tutor > Here it is: #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Multiple_Plots_2_b.py Copyright (c) 2017 Stephen P. Molnar, Ph.D. All rights reserved. """ import numpy as np from mpl_toolkits.axes_grid1 import host_subplot import mpl_toolkits.axisartist as AA import matplotlib.pyplot as plt data = [] name = input("Enter Molecule ID: ") name_in = name+'_poutput' data = np.genfromtxt(name_in) s = data[:,0] FTm = data[:,1] #atomic number FTe = data[:,2] #atomic mass FTc = data[:,3] #atom electron density fig = plt.figure(figsize=(7.6,4)) host = host_subplot(111, axes_class=AA.Axes) plt.subplots_adjust(right=0.75) par1 = host.twinx() par2 = host.twinx() offset = 60 new_fixed_axis = par2.get_grid_helper().new_fixed_axis par2.axis["right"] = new_fixed_axis(loc="right", axes=par2, offset=(offset, 0)) par2.axis["right"].toggle(all=True) host.set_xlim(0, 30) """ host.set_ylim(min(FTm), max(FTm)) """ host.set_xlabel("Distance ($\AA$)") host.set_ylabel("Atomic Number") par1.set_ylabel("Atom Mass") par2.set_ylabel("Atom Electron Density") p1, = host.plot(data[:,0], data[:,1])#, label="Atomic Number") p2, = par1.plot(data[:,0], data[:,2])#, label="Atom Mass") p3, = par2.plot(data[:,0], data[:,3])#, label="Atom Electron Density") """ par1.set_ylim(min(FTe), max(FTe)) par2.set_ylim(min(FTc),max(FTc)) """ #host.legend() host.axis["left"].label.set_color(p1.get_color()) par1.axis["right"].label.set_color(p2.get_color()) par2.axis["right"].label.set_color(p3.get_color()) host.title.set_text('Molecule {0} - Molecular Transforms'.format(name)) plt.draw() plt.show() name_plt = name+'-fig1.png' fig.savefig(name_plt,bbox_inches='tight') -- Stephen P. Molnar, Ph.D. Life is a fuzzy set www.molecular-modeling.net Stochastic and multivariate (614)312-7528 (c) Skype: smolnar1 From alan.gauld at yahoo.co.uk Sun Nov 19 18:23:24 2017 From: alan.gauld at yahoo.co.uk (Alan Gauld) Date: Sun, 19 Nov 2017 23:23:24 +0000 Subject: [Tutor] AttributeError: 'BezierPath' object has no attribute '_draw_solid' In-Reply-To: <5A11E613.6050509@sbcglobal.net> References: <5A11B31F.7060900@sbcglobal.net> <248AF619-AE3B-409A-BB96-937089525B22@mac.com> <5A11E613.6050509@sbcglobal.net> Message-ID: On 19/11/17 20:14, Stephen P. Molnar wrote: >>> In all candor, I don't have the faintest idea as to whst the problem >>> (or problens) might be and would greatly appreciate a pointer towards >>> the solution. You really need to post the entire error message not just the summary line. Especially since you don't appear to access _draw_solid in your own code so we need to see where that arises. > Here it is: > > #!/usr/bin/env python3 > # -*- coding: utf-8 -*- > """ > Multiple_Plots_2_b.py > > Copyright (c) 2017 Stephen P. Molnar, Ph.D.? All rights reserved. > > """ > import numpy as np > from mpl_toolkits.axes_grid1 import host_subplot > import mpl_toolkits.axisartist as AA > import matplotlib.pyplot as plt > > data = [] > name = input("Enter Molecule ID: ") > > name_in = name+'_poutput' > data = np.genfromtxt(name_in) > > s = data[:,0] > FTm = data[:,1]???? #atomic number > FTe = data[:,2]???? #atomic mass > FTc = data[:,3]???? #atom electron density > > > fig = plt.figure(figsize=(7.6,4)) > > host = host_subplot(111, axes_class=AA.Axes) > plt.subplots_adjust(right=0.75) > > par1 = host.twinx() > par2 = host.twinx() > > offset = 60 > new_fixed_axis = par2.get_grid_helper().new_fixed_axis > par2.axis["right"] = new_fixed_axis(loc="right", axes=par2, > ??????????????????????????????????????? offset=(offset, 0)) > > par2.axis["right"].toggle(all=True) > > host.set_xlim(0, 30) > """ > host.set_ylim(min(FTm), max(FTm)) > """ > > host.set_xlabel("Distance ($\AA$)") > host.set_ylabel("Atomic Number") > par1.set_ylabel("Atom Mass") > par2.set_ylabel("Atom Electron Density") > > p1, = host.plot(data[:,0], data[:,1])#, label="Atomic Number") > p2, = par1.plot(data[:,0], data[:,2])#, label="Atom Mass") > p3, = par2.plot(data[:,0], data[:,3])#, label="Atom Electron Density") > > """ > par1.set_ylim(min(FTe), max(FTe)) > par2.set_ylim(min(FTc),max(FTc)) > """ > > #host.legend() > > host.axis["left"].label.set_color(p1.get_color()) > par1.axis["right"].label.set_color(p2.get_color()) > par2.axis["right"].label.set_color(p3.get_color()) > > host.title.set_text('Molecule {0} - Molecular Transforms'.format(name)) > plt.draw() > plt.show() > > name_plt = name+'-fig1.png' > fig.savefig(name_plt,bbox_inches='tight') > > From mats at wichmann.us Sun Nov 19 18:24:05 2017 From: mats at wichmann.us (Mats Wichmann) Date: Sun, 19 Nov 2017 16:24:05 -0700 Subject: [Tutor] AttributeError: 'BezierPath' object has no attribute '_draw_solid' In-Reply-To: <5A11B31F.7060900@sbcglobal.net> References: <5A11B31F.7060900@sbcglobal.net> Message-ID: <3323fee0-9636-e50a-f391-3aee859102c5@wichmann.us> On 11/19/2017 09:36 AM, Stephen P. Molnar wrote: > I have written a short Python 3 script to plot three curves (one plot) > of data from a FORTRAN program.? Initially the code worked and produced > the plot which is attached.? I have also attached the code and the input > data, > > In all candor, I don't have the faintest idea as to whst the problem (or > problens) might be and would greatly appreciate a pointer towards the > solution. >From here, it's hard to tell... you have an error that indicates misusing a class named BezierPath by referencing a method or attribute which does not exist. This usually is due to a version skew problem - some code expects a newer version of something than you have (or, if the developer has been really careless, something has gone away which is horrid API stability behavior). But your code doesn't seem to reference BezierPath at all... so it must be referenced by something you ARE calling. Have you tried an internet search on this? From steve at pearwood.info Sun Nov 19 19:02:36 2017 From: steve at pearwood.info (Steven D'Aprano) Date: Mon, 20 Nov 2017 11:02:36 +1100 Subject: [Tutor] AttributeError: 'BezierPath' object has no attribute '_draw_solid' In-Reply-To: <52996304-86B9-4037-8CCE-8CE943F1E199@mac.com> References: <5A11B31F.7060900@sbcglobal.net> <248AF619-AE3B-409A-BB96-937089525B22@mac.com> <5A11E613.6050509@sbcglobal.net> <52996304-86B9-4037-8CCE-8CE943F1E199@mac.com> Message-ID: <20171120000236.GX19802@ando.pearwood.info> On Sun, Nov 19, 2017 at 04:51:06PM -0500, William Ray Wing wrote: > Unfortunately your mail reader/program has pasted it in as an RTF file > and this makes it almost impossible to look at in a text editor or > hand to the Python interpreter. What we see looks like the following > (I?ve pasted in the first few lines). I don't think that's correct -- it looks like plain text to me. Perhaps it is your mail reader (not Stephen's) that has decided to convert it to a RTF file? Try the "View Source", if your mail reader provides such a thing. -- Steve From steve at pearwood.info Sun Nov 19 19:23:53 2017 From: steve at pearwood.info (Steven D'Aprano) Date: Mon, 20 Nov 2017 11:23:53 +1100 Subject: [Tutor] AttributeError: 'BezierPath' object has no attribute '_draw_solid' In-Reply-To: <5A11E613.6050509@sbcglobal.net> References: <5A11B31F.7060900@sbcglobal.net> <248AF619-AE3B-409A-BB96-937089525B22@mac.com> <5A11E613.6050509@sbcglobal.net> Message-ID: <20171120002353.GY19802@ando.pearwood.info> On Sun, Nov 19, 2017 at 03:14:11PM -0500, Stephen P. Molnar wrote: [...] > >>I have written a short Python 3 script to plot three curves (one plot) of > >>data from a FORTRAN program. [...] Stephen, please remember that we are volunteers offering services for free, not paid consultants. If you want our help, you maximise the chances that we will do so by making things as easy as possible for us, rather than just dropping a big ball of mud in our laps and expecting us to sort it all out. If we were charging by the hour, and you had an unlimited budget, we'd be more than happy to do all the preparation for you. But since we aren't, you are relying on our good-will to get answers. If you make it hard for us, and your problem looks boring, then you are unlikely to get much, if any, help. Please help us to help you: - If you get an error, copy and paste the ENTIRE error message, starting with the "Traceback" line, not just the final line. - Provide a MINIMAL set of data that exposes the problem, the smaller the better. We shouldn't have to wade through hundreds of data points looking for the one which causes the problem. - Simplify your code to the MINIMUM required to demonstrate the problem. - Make sure that the code you send us actually works, in the sense that it will run and show the error you claim it shows. If we cannot run your code, we cannot debug it. - Ensure your code and data are ATTACHED to the email as separate files, not copy and pasted into the body. We should be able to save the files directly to our own computers without the risk of introducing formatting changes caused by going through an intermediate email format. It may help if you read this: http://sscce.org/ It is written for Java programmers, but the principles apply to everyone regardless of the language they are using. Thank you. -- Steve From haziq2ros at gmail.com Sun Nov 19 21:05:14 2017 From: haziq2ros at gmail.com (haziq roslan) Date: Mon, 20 Nov 2017 10:05:14 +0800 Subject: [Tutor] Need assistance Message-ID: Hye guys, Im Haziq from Malaysia. Anyone can lend me a hand to do my assignment? I have no idea how to do this task. Please reply me if you interested. Your kindness is really appreciated. From alan.gauld at yahoo.co.uk Mon Nov 20 05:26:50 2017 From: alan.gauld at yahoo.co.uk (Alan Gauld) Date: Mon, 20 Nov 2017 10:26:50 +0000 Subject: [Tutor] AttributeError: 'BezierPath' object has no attribute '_draw_solid' In-Reply-To: <20171120002353.GY19802@ando.pearwood.info> References: <5A11B31F.7060900@sbcglobal.net> <248AF619-AE3B-409A-BB96-937089525B22@mac.com> <5A11E613.6050509@sbcglobal.net> <20171120002353.GY19802@ando.pearwood.info> Message-ID: I'll echo everything Steve says except: On 20/11/17 00:23, Steven D'Aprano wrote: > - Ensure your code and data are ATTACHED to the email as separate > files, not copy and pasted into the body. We should be able to > save the files directly to our own computers without the risk > of introducing formatting changes caused by going through an > intermediate email format. Actually, pasting code etc is safer since the server removes attachments. And while it is supposed to preserve plain text attachments it will throw them away if it sees *anything* that it thinks looks like binary. Also some readers are on corporate accounts that strip all attachments regardless of type, so attachments are a bit of a gamble. So provided it not too big (and it wont be if you followed Steven's other advice) just paste it in the body. Alan g. From steve at pearwood.info Mon Nov 20 06:24:50 2017 From: steve at pearwood.info (Steven D'Aprano) Date: Mon, 20 Nov 2017 22:24:50 +1100 Subject: [Tutor] AttributeError: 'BezierPath' object has no attribute '_draw_solid' In-Reply-To: References: <5A11B31F.7060900@sbcglobal.net> <248AF619-AE3B-409A-BB96-937089525B22@mac.com> <5A11E613.6050509@sbcglobal.net> <20171120002353.GY19802@ando.pearwood.info> Message-ID: <20171120112450.GD19802@ando.pearwood.info> On Mon, Nov 20, 2017 at 10:26:50AM +0000, Alan Gauld via Tutor wrote: > Actually, pasting code etc is safer since the server removes > attachments. And while it is supposed to preserve plain text > attachments it will throw them away if it sees *anything* > that it thinks looks like binary. Let's do a test and see what happens! Attached is a .py file in UTF-8. If that passes through, I think we're good :-) > Also some readers are on > corporate accounts that strip all attachments regardless > of type Given the popularity of HTML email, corporate logos attached as images, and the ubiquity of emailing PDF and DOC/DOCX files in the business world, I would be stunned to come across any corporation that stripped all attachements. -- Steve -------------- next part -------------- # Testing if __name__ == '__main__': print("Hello World! ??? ? ? ?") From breamoreboy at gmail.com Mon Nov 20 06:39:13 2017 From: breamoreboy at gmail.com (Mark Lawrence) Date: Mon, 20 Nov 2017 11:39:13 +0000 Subject: [Tutor] Need assistance In-Reply-To: References: Message-ID: On 20/11/17 02:05, haziq roslan wrote: > Hye guys, Im Haziq from Malaysia. Anyone can lend me a hand to do my > assignment? I have no idea how to do this task. Please reply me if you > interested. > Your kindness is really appreciated. > This list does not work like that. You tell us what the assignment is and show us the code that you have written, then we give you hints on how to proceed. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence From steve at pearwood.info Mon Nov 20 06:47:03 2017 From: steve at pearwood.info (Steven D'Aprano) Date: Mon, 20 Nov 2017 22:47:03 +1100 Subject: [Tutor] Need assistance In-Reply-To: References: Message-ID: <20171120114702.GE19802@ando.pearwood.info> On Mon, Nov 20, 2017 at 10:05:14AM +0800, haziq roslan wrote: > Hye guys, Im Haziq from Malaysia. Anyone can lend me a hand to do my > assignment? I have no idea how to do this task. Neither do we. What task? If you want help, please tell us what the task is, show us the code you have written to solve it, and what results you get. > Please reply me if you interested. After this email, all my responses will go to the list. Please keep replies on the mailing list, so others can learn from your questions. -- Steve From s.molnar at sbcglobal.net Mon Nov 20 08:18:41 2017 From: s.molnar at sbcglobal.net (Stephen P. Molnar) Date: Mon, 20 Nov 2017 08:18:41 -0500 Subject: [Tutor] AttributeError: 'BezierPath' object has no attribute '_draw_solid' In-Reply-To: <20171120112450.GD19802@ando.pearwood.info> References: <5A11B31F.7060900@sbcglobal.net> <248AF619-AE3B-409A-BB96-937089525B22@mac.com> <5A11E613.6050509@sbcglobal.net> <20171120002353.GY19802@ando.pearwood.info> <20171120112450.GD19802@ando.pearwood.info> Message-ID: <5A12D631.5010302@sbcglobal.net> On 11/20/2017 06:24 AM, Steven D'Aprano wrote: > On Mon, Nov 20, 2017 at 10:26:50AM +0000, Alan Gauld via Tutor wrote: > >> Actually, pasting code etc is safer since the server removes >> attachments. And while it is supposed to preserve plain text >> attachments it will throw them away if it sees *anything* >> that it thinks looks like binary. > Let's do a test and see what happens! Attached is a .py file in UTF-8. > If that passes through, I think we're good :-) > > >> Also some readers are on >> corporate accounts that strip all attachments regardless >> of type > Given the popularity of HTML email, corporate logos attached as images, > and the ubiquity of emailing PDF and DOC/DOCX files in the business > world, I would be stunned to come across any corporation that stripped > all attachements. > > > > _______________________________________________ > Tutor maillist - Tutor at python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor Many thanks. Indeed it worked! I'm not really looking for someone to do the programming for me. I know that the code works, because it did and produced the attached plot. I just don't know why it stopped working. Actually, all of my programming experience has been with FORTRAN, starting with II in 1961 (yes, I am rather an old... an Organic Chemist. Let's start over, This is the code: #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Multiple_Plots_2_b.py Copyright (c) 2017 Stephen P. Molnar, Ph.D. All rights reserved. """ import numpy as np from mpl_toolkits.axes_grid1 import host_subplot import mpl_toolkits.axisartist as AA import matplotlib.pyplot as plt data = [] name = input("Enter Molecule ID: ") name_in = name+'_poutput' data = np.genfromtxt(name_in) s = data[:,0] FTm = data[:,1] #atomic number FTe = data[:,2] #atomic mass FTc = data[:,3] #atom electron density fig = plt.figure(figsize=(7.6,4)) host = host_subplot(111, axes_class=AA.Axes) plt.subplots_adjust(right=0.75) par1 = host.twinx() par2 = host.twinx() offset = 60 new_fixed_axis = par2.get_grid_helper().new_fixed_axis par2.axis["right"] = new_fixed_axis(loc="right", axes=par2, offset=(offset, 0)) par2.axis["right"].toggle(all=True) host.set_xlim(0, 30) """ host.set_ylim(min(FTm), max(FTm)) """ host.set_xlabel("Distance ($\AA$)") host.set_ylabel("Atomic Number") par1.set_ylabel("Atom Mass") par2.set_ylabel("Atom Electron Density") p1, = host.plot(data[:,0], data[:,1])#, label="Atomic Number") p2, = par1.plot(data[:,0], data[:,2])#, label="Atom Mass") p3, = par2.plot(data[:,0], data[:,3])#, label="Atom Electron Density") """ par1.set_ylim(min(FTe), max(FTe)) par2.set_ylim(min(FTc),max(FTc)) """ #host.legend() host.axis["left"].label.set_color(p1.get_color()) par1.axis["right"].label.set_color(p2.get_color()) par2.axis["right"].label.set_color(p3.get_color()) host.title.set_text('Molecule {0} - Molecular Transforms'.format(name)) plt.draw() plt.show() name_plt = name+'-fig1.png' fig.savefig(name_plt,bbox_inches='tight') And the input file A_poutput: 0.150000 1457.204006 998.233839 -0.018612 0.300000 1344.817934 931.699910 -0.017571 0.450000 1170.330414 827.700509 -0.015915 0.600000 951.240195 695.702122 -0.013757 0.750000 708.832611 547.341272 -0.011238 0.900000 465.526861 395.074189 -0.008520 1.050000 242.168335 250.776922 -0.005770 1.200000 55.640011 124.478386 -0.003147 1.350000 -82.889238 23.385404 -0.000790 1.500000 -168.863907 -48.686568 0.001192 1.650000 -204.304928 -91.423531 0.002725 1.800000 -196.892849 -107.676083 0.003774 1.950000 -158.353900 -102.749215 0.004342 2.100000 -102.425393 -83.440486 0.004465 2.250000 -42.724395 -56.976574 0.004210 2.400000 9.160768 -30.003148 0.003659 2.550000 45.090063 -7.765044 0.002907 2.700000 61.128133 6.423416 0.002048 2.850000 57.577347 11.367836 0.001171 3.000000 38.344275 7.846857 0.000349 3.150000 9.797326 -1.817135 -0.000359 3.300000 -20.657232 -14.377418 -0.000917 3.450000 -46.025084 -26.358616 -0.001307 3.600000 -60.958617 -34.712347 -0.001528 3.750000 -62.589086 -37.332393 -0.001596 3.900000 -50.849425 -33.359410 -0.001536 4.050000 -28.274206 -23.244463 -0.001380 4.200000 0.647490 -8.581977 -0.001162 4.350000 30.419924 8.240844 -0.000915 4.500000 55.601812 24.504898 -0.000668 4.650000 71.786890 37.644793 -0.000444 4.800000 76.337446 45.676179 -0.000259 4.950000 68.758579 47.497775 -0.000122 5.100000 50.671170 43.026846 -0.000036 5.250000 25.414468 33.157608 0.000001 5.400000 -2.627852 19.562143 -0.000004 5.550000 -28.841964 4.378077 -0.000039 5.700000 -49.186470 -10.157324 -0.000095 5.850000 -60.843330 -22.062653 -0.000159 6.000000 -62.613119 -29.900128 -0.000219 6.150000 -55.002707 -32.954002 -0.000264 6.300000 -40.011347 -31.279440 -0.000284 6.450000 -20.674231 -25.624738 -0.000272 6.600000 -0.461617 -17.250484 -0.000223 6.750000 17.349547 -7.684285 -0.000134 6.900000 30.217978 1.543060 -0.000007 7.050000 36.704572 9.135157 0.000153 7.200000 36.611564 14.205163 0.000340 7.350000 30.887904 16.366163 0.000542 7.500000 21.337500 15.730856 0.000745 7.650000 10.200327 12.830456 0.000931 7.800000 -0.305538 8.475307 0.001083 7.950000 -8.392428 3.587153 0.001184 8.100000 -12.989800 -0.965458 0.001218 8.250000 -13.865349 -4.501286 0.001173 8.400000 -11.571637 -6.611087 0.001043 8.550000 -7.243459 -7.184785 0.000828 8.700000 -2.298165 -6.384063 0.000537 8.850000 1.893836 -4.572551 0.000186 9.000000 4.300063 -2.221752 -0.000202 9.150000 4.422590 0.187190 -0.000598 9.300000 2.366936 2.247742 -0.000969 9.450000 -1.222319 3.685155 -0.001284 9.600000 -5.337564 4.380342 -0.001511 9.750000 -8.852834 4.361341 -0.001629 9.900000 -10.782542 3.769297 -0.001621 10.050000 -10.499667 2.809727 -0.001487 10.200000 -7.869748 1.701068 -0.001234 10.350000 -3.276223 0.631156 -0.000884 10.500000 2.464059 -0.271036 -0.000469 10.650000 8.273897 -0.945429 -0.000028 10.800000 13.038886 -1.394038 0.000399 10.950000 15.833457 -1.662153 0.000770 11.100000 16.103771 -1.814211 0.001050 11.250000 13.771794 -1.911156 0.001215 11.400000 9.242103 -1.994565 0.001252 11.550000 3.313230 -2.080285 0.001163 11.700000 -2.985528 -2.161399 0.000962 11.850000 -8.596642 -2.217844 0.000678 12.000000 -12.634473 -2.228480 0.000348 12.150000 -14.543259 -2.181162 0.000011 12.300000 -14.183265 -2.077415 -0.000293 12.450000 -11.831038 -1.930211 -0.000529 12.600000 -8.097637 -1.755702 -0.000673 12.750000 -3.785170 -1.561765 -0.000713 12.900000 0.286255 -1.337475 -0.000649 13.050000 3.444324 -1.047676 -0.000496 13.200000 5.289172 -0.635686 -0.000280 13.350000 5.752874 -0.035101 -0.000031 13.500000 5.084229 0.810898 0.000214 13.650000 3.765365 1.926706 0.000424 13.800000 2.380864 3.283445 0.000570 13.950000 1.469617 4.786014 0.000637 14.100000 1.392498 6.272847 0.000617 14.250000 2.244816 7.530844 0.000516 14.400000 3.832308 8.324771 0.000351 14.550000 5.715404 8.437061 0.000146 14.700000 7.311696 7.711171 -0.000073 14.850000 8.033953 6.090102 -0.000276 15.000000 7.433384 3.641765 -0.000439 15.150000 5.316604 0.564736 -0.000543 15.300000 1.810210 -2.828748 -0.000580 15.450000 -2.642187 -6.151479 -0.000548 15.600000 -7.351504 -8.996319 -0.000458 15.750000 -11.509884 -10.998722 -0.000323 15.900000 -14.347438 -11.895943 -0.000165 16.050000 -15.287336 -11.572105 -0.000005 16.200000 -14.067416 -10.080444 0.000138 16.350000 -10.802914 -7.637870 0.000248 16.500000 -5.976553 -4.591918 0.000313 16.650000 -0.356722 -1.365240 0.000331 16.800000 5.141053 1.612947 0.000304 16.950000 9.622693 3.976462 0.000240 17.100000 12.381359 5.480370 0.000150 17.250000 13.027990 6.037313 0.000047 17.400000 11.560979 5.725370 -0.000056 17.550000 8.361334 4.766082 -0.000148 17.700000 4.114364 3.476794 -0.000220 17.850000 -0.326569 2.206282 -0.000267 18.000000 -4.107304 1.265785 -0.000287 18.150000 -6.538177 0.868443 -0.000282 18.300000 -7.224883 1.088608 -0.000252 18.450000 -6.139379 1.848705 -0.000204 18.600000 -3.617297 2.936154 -0.000139 18.750000 -0.282930 4.047106 -0.000062 18.900000 3.082729 4.848645 0.000024 19.050000 5.704201 5.047554 0.000114 19.200000 6.971360 4.452410 0.000206 19.350000 6.564880 3.017031 0.000294 19.500000 4.522214 0.856722 0.000374 19.650000 1.230971 -1.766056 0.000438 19.800000 -2.648913 -4.484225 0.000481 19.950000 -6.318611 -6.889144 0.000496 20.100000 -9.002726 -8.602539 0.000477 20.250000 -10.107995 -9.344044 0.000422 20.400000 -9.346550 -8.981821 0.000330 20.550000 -6.798915 -7.556928 0.000205 20.700000 -2.903834 -5.276963 0.000055 20.850000 1.623478 -2.480263 -0.000108 21.000000 5.928860 0.422670 -0.000271 21.150000 9.185629 3.019640 -0.000419 21.300000 10.757201 4.966197 -0.000537 21.450000 10.323870 6.041463 -0.000612 21.600000 7.948619 6.180453 -0.000637 21.750000 4.068745 5.477529 -0.000608 21.900000 -0.585430 4.161075 -0.000530 22.050000 -5.129229 2.544839 -0.000409 22.200000 -8.692916 0.965619 -0.000260 22.350000 -10.588841 -0.280687 -0.000100 22.500000 -10.444054 -0.992625 0.000055 22.650000 -8.272710 -1.096543 0.000188 22.800000 -4.474256 -0.654048 0.000287 22.950000 0.242214 0.157064 0.000342 23.100000 4.992771 1.083970 0.000352 23.250000 8.886579 1.853469 0.000319 23.400000 11.194571 2.229163 0.000253 23.550000 11.486519 2.059953 0.000167 23.700000 9.710378 1.310590 0.000074 23.850000 6.199083 0.068697 -0.000010 24.000000 1.604060 -1.472605 -0.000074 24.150000 -3.231163 -3.052584 -0.000107 24.300000 -7.432407 -4.393498 -0.000107 24.450000 -10.259983 -5.253775 -0.000075 24.600000 -11.245723 -5.473386 -0.000015 24.750000 -10.275890 -5.002726 0.000061 24.900000 -7.604690 -3.909790 0.000143 25.050000 -3.796750 -2.364759 0.000217 25.200000 0.389244 -0.605594 0.000273 25.350000 4.152273 1.108109 0.000301 25.500000 6.805936 2.543593 0.000298 25.650000 7.909843 3.536125 0.000263 25.800000 7.350003 4.014905 0.000199 25.950000 5.353055 4.009026 0.000113 26.100000 2.432371 3.632910 0.000015 26.250000 -0.722508 3.054842 -0.000086 26.400000 -3.390524 2.455632 -0.000178 26.550000 -4.968693 1.986324 -0.000255 26.700000 -5.096709 1.733989 -0.000310 26.850000 -3.731726 1.702825 -0.000341 27.000000 -1.158468 1.814569 -0.000347 27.150000 2.067294 1.928147 -0.000331 27.300000 5.230689 1.874430 -0.000297 27.450000 7.602892 1.498788 -0.000250 27.600000 8.590698 0.702348 -0.000195 27.750000 7.860842 -0.526952 -0.000137 27.900000 5.414273 -2.100526 -0.000078 28.050000 1.595387 -3.836088 -0.000021 28.200000 -2.966087 -5.484824 0.000033 28.350000 -7.469726 -6.774045 0.000083 28.500000 -11.093709 -7.457409 0.000130 28.650000 -13.150129 -7.363012 0.000173 28.800000 -13.216479 -6.429907 0.000210 28.950000 -11.218047 -4.725585 0.000241 29.100000 -7.445355 -2.440554 0.000261 29.250000 -2.503302 0.139537 0.000267 29.400000 2.798296 2.679474 0.000257 29.550000 7.591889 4.849545 0.000229 29.700000 11.109157 6.380035 0.000181 29.850000 12.818104 7.105092 0.000116 30.000000 12.514665 6.987915 0.000037 30.150000 10.352073 6.122683 -0.000048 Incidentally, my email client is FossaMail and I do not send html emails. -- Stephen P. Molnar, Ph.D. Life is a fuzzy set www.molecular-modeling.net Stochastic and multivariate (614)312-7528 (c) Skype: smolnar1 -------------- next part -------------- runfile('/home/comp/Apps/Python/Plot_T_Data/MultiplePlots_3.py', wdir='/home/comp/Apps/Python/Plot_T_Data') Enter Molecule ID: A Traceback (most recent call last): File "", line 1, in runfile('/home/comp/Apps/Python/Plot_T_Data/MultiplePlots_3.py', wdir='/home/comp/Apps/Python/Plot_T_Data') File "/usr/local/lib/python3.5/dist-packages/spyder/utils/site/sitecustomize.py", line 688, in runfile execfile(filename, namespace) File "/usr/local/lib/python3.5/dist-packages/spyder/utils/site/sitecustomize.py", line 101, in execfile exec(compile(f.read(), filename, 'exec'), namespace) File "/home/comp/Apps/Python/Plot_T_Data/MultiplePlots_3.py", line 67, in plt.draw() File "/usr/local/lib/python3.5/dist-packages/matplotlib/pyplot.py", line 691, in draw get_current_fig_manager().canvas.draw_idle() File "/usr/local/lib/python3.5/dist-packages/matplotlib/backend_bases.py", line 2053, in draw_idle self.draw(*args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_agg.py", line 430, in draw self.figure.draw(self.renderer) File "/usr/local/lib/python3.5/dist-packages/matplotlib/artist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 1295, in draw renderer, self, artists, self.suppressComposite) File "/usr/local/lib/python3.5/dist-packages/matplotlib/image.py", line 138, in _draw_list_compositing_images a.draw(renderer) File "/usr/lib/python3/dist-packages/mpl_toolkits/axes_grid1/parasite_axes.py", line 295, in draw self._get_base_axes_attr("draw")(self, renderer) File "/usr/lib/python3/dist-packages/mpl_toolkits/axisartist/axislines.py", line 778, in draw super(Axes, self).draw(renderer, inframe) File "/usr/local/lib/python3.5/dist-packages/matplotlib/artist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/matplotlib/axes/_base.py", line 2399, in draw mimage._draw_list_compositing_images(renderer, self, artists) File "/usr/local/lib/python3.5/dist-packages/matplotlib/image.py", line 138, in _draw_list_compositing_images a.draw(renderer) File "/usr/local/lib/python3.5/dist-packages/matplotlib/artist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs) File "/usr/lib/python3/dist-packages/mpl_toolkits/axisartist/axis_artist.py", line 1572, in draw self._draw_line(renderer) File "/usr/lib/python3/dist-packages/mpl_toolkits/axisartist/axis_artist.py", line 1170, in _draw_line self.line.draw(renderer) File "/usr/lib/python3/dist-packages/mpl_toolkits/axisartist/axis_artist.py", line 163, in draw lineFunc = getattr(self, funcname) AttributeError: 'BezierPath' object has no attribute '_draw_solid' Traceback (most recent call last): File "/home/comp/.local/lib/python3.5/site-packages/IPython/core/formatters.py", line 332, in __call__ return printer(obj) File "/home/comp/.local/lib/python3.5/site-packages/IPython/core/pylabtools.py", line 237, in png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs)) File "/home/comp/.local/lib/python3.5/site-packages/IPython/core/pylabtools.py", line 121, in print_figure fig.canvas.print_figure(bytes_io, **kw) File "/usr/local/lib/python3.5/dist-packages/matplotlib/backend_bases.py", line 2208, in print_figure **kwargs) File "/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_agg.py", line 507, in print_png FigureCanvasAgg.draw(self) File "/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_agg.py", line 430, in draw self.figure.draw(self.renderer) File "/usr/local/lib/python3.5/dist-packages/matplotlib/artist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 1295, in draw renderer, self, artists, self.suppressComposite) File "/usr/local/lib/python3.5/dist-packages/matplotlib/image.py", line 138, in _draw_list_compositing_images a.draw(renderer) File "/usr/lib/python3/dist-packages/mpl_toolkits/axes_grid1/parasite_axes.py", line 295, in draw self._get_base_axes_attr("draw")(self, renderer) File "/usr/lib/python3/dist-packages/mpl_toolkits/axisartist/axislines.py", line 778, in draw super(Axes, self).draw(renderer, inframe) File "/usr/local/lib/python3.5/dist-packages/matplotlib/artist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/matplotlib/axes/_base.py", line 2399, in draw mimage._draw_list_compositing_images(renderer, self, artists) File "/usr/local/lib/python3.5/dist-packages/matplotlib/image.py", line 138, in _draw_list_compositing_images a.draw(renderer) File "/usr/local/lib/python3.5/dist-packages/matplotlib/artist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs) File "/usr/lib/python3/dist-packages/mpl_toolkits/axisartist/axis_artist.py", line 1572, in draw self._draw_line(renderer) File "/usr/lib/python3/dist-packages/mpl_toolkits/axisartist/axis_artist.py", line 1170, in _draw_line self.line.draw(renderer) File "/usr/lib/python3/dist-packages/mpl_toolkits/axisartist/axis_artist.py", line 163, in draw lineFunc = getattr(self, funcname) AttributeError: 'BezierPath' object has no attribute '_draw_solid' -------------- next part -------------- 0.150000 1457.204006 998.233839 -0.018612 0.300000 1344.817934 931.699910 -0.017571 0.450000 1170.330414 827.700509 -0.015915 0.600000 951.240195 695.702122 -0.013757 0.750000 708.832611 547.341272 -0.011238 0.900000 465.526861 395.074189 -0.008520 1.050000 242.168335 250.776922 -0.005770 1.200000 55.640011 124.478386 -0.003147 1.350000 -82.889238 23.385404 -0.000790 1.500000 -168.863907 -48.686568 0.001192 1.650000 -204.304928 -91.423531 0.002725 1.800000 -196.892849 -107.676083 0.003774 1.950000 -158.353900 -102.749215 0.004342 2.100000 -102.425393 -83.440486 0.004465 2.250000 -42.724395 -56.976574 0.004210 2.400000 9.160768 -30.003148 0.003659 2.550000 45.090063 -7.765044 0.002907 2.700000 61.128133 6.423416 0.002048 2.850000 57.577347 11.367836 0.001171 3.000000 38.344275 7.846857 0.000349 3.150000 9.797326 -1.817135 -0.000359 3.300000 -20.657232 -14.377418 -0.000917 3.450000 -46.025084 -26.358616 -0.001307 3.600000 -60.958617 -34.712347 -0.001528 3.750000 -62.589086 -37.332393 -0.001596 3.900000 -50.849425 -33.359410 -0.001536 4.050000 -28.274206 -23.244463 -0.001380 4.200000 0.647490 -8.581977 -0.001162 4.350000 30.419924 8.240844 -0.000915 4.500000 55.601812 24.504898 -0.000668 4.650000 71.786890 37.644793 -0.000444 4.800000 76.337446 45.676179 -0.000259 4.950000 68.758579 47.497775 -0.000122 5.100000 50.671170 43.026846 -0.000036 5.250000 25.414468 33.157608 0.000001 5.400000 -2.627852 19.562143 -0.000004 5.550000 -28.841964 4.378077 -0.000039 5.700000 -49.186470 -10.157324 -0.000095 5.850000 -60.843330 -22.062653 -0.000159 6.000000 -62.613119 -29.900128 -0.000219 6.150000 -55.002707 -32.954002 -0.000264 6.300000 -40.011347 -31.279440 -0.000284 6.450000 -20.674231 -25.624738 -0.000272 6.600000 -0.461617 -17.250484 -0.000223 6.750000 17.349547 -7.684285 -0.000134 6.900000 30.217978 1.543060 -0.000007 7.050000 36.704572 9.135157 0.000153 7.200000 36.611564 14.205163 0.000340 7.350000 30.887904 16.366163 0.000542 7.500000 21.337500 15.730856 0.000745 7.650000 10.200327 12.830456 0.000931 7.800000 -0.305538 8.475307 0.001083 7.950000 -8.392428 3.587153 0.001184 8.100000 -12.989800 -0.965458 0.001218 8.250000 -13.865349 -4.501286 0.001173 8.400000 -11.571637 -6.611087 0.001043 8.550000 -7.243459 -7.184785 0.000828 8.700000 -2.298165 -6.384063 0.000537 8.850000 1.893836 -4.572551 0.000186 9.000000 4.300063 -2.221752 -0.000202 9.150000 4.422590 0.187190 -0.000598 9.300000 2.366936 2.247742 -0.000969 9.450000 -1.222319 3.685155 -0.001284 9.600000 -5.337564 4.380342 -0.001511 9.750000 -8.852834 4.361341 -0.001629 9.900000 -10.782542 3.769297 -0.001621 10.050000 -10.499667 2.809727 -0.001487 10.200000 -7.869748 1.701068 -0.001234 10.350000 -3.276223 0.631156 -0.000884 10.500000 2.464059 -0.271036 -0.000469 10.650000 8.273897 -0.945429 -0.000028 10.800000 13.038886 -1.394038 0.000399 10.950000 15.833457 -1.662153 0.000770 11.100000 16.103771 -1.814211 0.001050 11.250000 13.771794 -1.911156 0.001215 11.400000 9.242103 -1.994565 0.001252 11.550000 3.313230 -2.080285 0.001163 11.700000 -2.985528 -2.161399 0.000962 11.850000 -8.596642 -2.217844 0.000678 12.000000 -12.634473 -2.228480 0.000348 12.150000 -14.543259 -2.181162 0.000011 12.300000 -14.183265 -2.077415 -0.000293 12.450000 -11.831038 -1.930211 -0.000529 12.600000 -8.097637 -1.755702 -0.000673 12.750000 -3.785170 -1.561765 -0.000713 12.900000 0.286255 -1.337475 -0.000649 13.050000 3.444324 -1.047676 -0.000496 13.200000 5.289172 -0.635686 -0.000280 13.350000 5.752874 -0.035101 -0.000031 13.500000 5.084229 0.810898 0.000214 13.650000 3.765365 1.926706 0.000424 13.800000 2.380864 3.283445 0.000570 13.950000 1.469617 4.786014 0.000637 14.100000 1.392498 6.272847 0.000617 14.250000 2.244816 7.530844 0.000516 14.400000 3.832308 8.324771 0.000351 14.550000 5.715404 8.437061 0.000146 14.700000 7.311696 7.711171 -0.000073 14.850000 8.033953 6.090102 -0.000276 15.000000 7.433384 3.641765 -0.000439 15.150000 5.316604 0.564736 -0.000543 15.300000 1.810210 -2.828748 -0.000580 15.450000 -2.642187 -6.151479 -0.000548 15.600000 -7.351504 -8.996319 -0.000458 15.750000 -11.509884 -10.998722 -0.000323 15.900000 -14.347438 -11.895943 -0.000165 16.050000 -15.287336 -11.572105 -0.000005 16.200000 -14.067416 -10.080444 0.000138 16.350000 -10.802914 -7.637870 0.000248 16.500000 -5.976553 -4.591918 0.000313 16.650000 -0.356722 -1.365240 0.000331 16.800000 5.141053 1.612947 0.000304 16.950000 9.622693 3.976462 0.000240 17.100000 12.381359 5.480370 0.000150 17.250000 13.027990 6.037313 0.000047 17.400000 11.560979 5.725370 -0.000056 17.550000 8.361334 4.766082 -0.000148 17.700000 4.114364 3.476794 -0.000220 17.850000 -0.326569 2.206282 -0.000267 18.000000 -4.107304 1.265785 -0.000287 18.150000 -6.538177 0.868443 -0.000282 18.300000 -7.224883 1.088608 -0.000252 18.450000 -6.139379 1.848705 -0.000204 18.600000 -3.617297 2.936154 -0.000139 18.750000 -0.282930 4.047106 -0.000062 18.900000 3.082729 4.848645 0.000024 19.050000 5.704201 5.047554 0.000114 19.200000 6.971360 4.452410 0.000206 19.350000 6.564880 3.017031 0.000294 19.500000 4.522214 0.856722 0.000374 19.650000 1.230971 -1.766056 0.000438 19.800000 -2.648913 -4.484225 0.000481 19.950000 -6.318611 -6.889144 0.000496 20.100000 -9.002726 -8.602539 0.000477 20.250000 -10.107995 -9.344044 0.000422 20.400000 -9.346550 -8.981821 0.000330 20.550000 -6.798915 -7.556928 0.000205 20.700000 -2.903834 -5.276963 0.000055 20.850000 1.623478 -2.480263 -0.000108 21.000000 5.928860 0.422670 -0.000271 21.150000 9.185629 3.019640 -0.000419 21.300000 10.757201 4.966197 -0.000537 21.450000 10.323870 6.041463 -0.000612 21.600000 7.948619 6.180453 -0.000637 21.750000 4.068745 5.477529 -0.000608 21.900000 -0.585430 4.161075 -0.000530 22.050000 -5.129229 2.544839 -0.000409 22.200000 -8.692916 0.965619 -0.000260 22.350000 -10.588841 -0.280687 -0.000100 22.500000 -10.444054 -0.992625 0.000055 22.650000 -8.272710 -1.096543 0.000188 22.800000 -4.474256 -0.654048 0.000287 22.950000 0.242214 0.157064 0.000342 23.100000 4.992771 1.083970 0.000352 23.250000 8.886579 1.853469 0.000319 23.400000 11.194571 2.229163 0.000253 23.550000 11.486519 2.059953 0.000167 23.700000 9.710378 1.310590 0.000074 23.850000 6.199083 0.068697 -0.000010 24.000000 1.604060 -1.472605 -0.000074 24.150000 -3.231163 -3.052584 -0.000107 24.300000 -7.432407 -4.393498 -0.000107 24.450000 -10.259983 -5.253775 -0.000075 24.600000 -11.245723 -5.473386 -0.000015 24.750000 -10.275890 -5.002726 0.000061 24.900000 -7.604690 -3.909790 0.000143 25.050000 -3.796750 -2.364759 0.000217 25.200000 0.389244 -0.605594 0.000273 25.350000 4.152273 1.108109 0.000301 25.500000 6.805936 2.543593 0.000298 25.650000 7.909843 3.536125 0.000263 25.800000 7.350003 4.014905 0.000199 25.950000 5.353055 4.009026 0.000113 26.100000 2.432371 3.632910 0.000015 26.250000 -0.722508 3.054842 -0.000086 26.400000 -3.390524 2.455632 -0.000178 26.550000 -4.968693 1.986324 -0.000255 26.700000 -5.096709 1.733989 -0.000310 26.850000 -3.731726 1.702825 -0.000341 27.000000 -1.158468 1.814569 -0.000347 27.150000 2.067294 1.928147 -0.000331 27.300000 5.230689 1.874430 -0.000297 27.450000 7.602892 1.498788 -0.000250 27.600000 8.590698 0.702348 -0.000195 27.750000 7.860842 -0.526952 -0.000137 27.900000 5.414273 -2.100526 -0.000078 28.050000 1.595387 -3.836088 -0.000021 28.200000 -2.966087 -5.484824 0.000033 28.350000 -7.469726 -6.774045 0.000083 28.500000 -11.093709 -7.457409 0.000130 28.650000 -13.150129 -7.363012 0.000173 28.800000 -13.216479 -6.429907 0.000210 28.950000 -11.218047 -4.725585 0.000241 29.100000 -7.445355 -2.440554 0.000261 29.250000 -2.503302 0.139537 0.000267 29.400000 2.798296 2.679474 0.000257 29.550000 7.591889 4.849545 0.000229 29.700000 11.109157 6.380035 0.000181 29.850000 12.818104 7.105092 0.000116 30.000000 12.514665 6.987915 0.000037 30.150000 10.352073 6.122683 -0.000048 From steve at pearwood.info Mon Nov 20 10:18:29 2017 From: steve at pearwood.info (Steven D'Aprano) Date: Tue, 21 Nov 2017 02:18:29 +1100 Subject: [Tutor] AttributeError: 'BezierPath' object has no attribute '_draw_solid' In-Reply-To: <5A12D631.5010302@sbcglobal.net> References: <5A11B31F.7060900@sbcglobal.net> <248AF619-AE3B-409A-BB96-937089525B22@mac.com> <5A11E613.6050509@sbcglobal.net> <20171120002353.GY19802@ando.pearwood.info> <20171120112450.GD19802@ando.pearwood.info> <5A12D631.5010302@sbcglobal.net> Message-ID: <20171120151829.GG19802@ando.pearwood.info> On Mon, Nov 20, 2017 at 08:18:41AM -0500, Stephen P. Molnar wrote: > I'm not really looking for someone to do the programming for me. I know > that the code works, because it did and produced the attached plot. I > just don't know why it stopped working. Actually, all of my programming > experience has been with FORTRAN, starting with II in 1961 (yes, I am > rather an old... an Organic Chemist. > > Let's start over, > > This is the code: You seem to have completely ignored my advice about cutting the code down to the minimum amount that demonstrates the error. Okay, that's your perogative, but as a volunteer it is my perogative to choose how much or how little effort I put into solving your problem for you. I have neither the time nor the inclination to spend a lot of time on this, so I'll just offer one suggestion. According to the error traceback, you appear to be running the script from inside either the Spyder IDE, or possibly an iPython/Jupyter notebook. This appears to be the command you are running (inside iPython?): > runfile('/home/comp/Apps/Python/Plot_T_Data/MultiplePlots_3.py', wdir='/home/comp/Apps/Python/Plot_T_Data') and the traceback shows a failure relating to iPython and/or Spyder: > File "", line 1, in > runfile('/home/comp/Apps/Python/Plot_T_Data/MultiplePlots_3.py', wdir='/home/comp/Apps/Python/Plot_T_Data') > > File "/usr/local/lib/python3.5/dist-packages/spyder/utils/site/sitecustomize.py", line 688, in runfile > execfile(filename, namespace) It is possible that you have recently updated iPython or installed Spyder, and that has broken your script. I recommend that you eliminate them from contention, by running your script from the old-fashioned Linux commandline. From bash, or some other terminal shell, run: cd /home/comp/Apps/Python/Plot_T_Data python3.5 MultiplePlots_3.py and see if the error persists. If the error goes away, then the problem lies in iPython or Spyder. In a nutshell, based on a cursory look at the traceback, this seems to be a problem with your environment rather than your code. Good luck! -- Steve From wrw at mac.com Mon Nov 20 09:34:35 2017 From: wrw at mac.com (William Ray Wing) Date: Mon, 20 Nov 2017 09:34:35 -0500 Subject: [Tutor] AttributeError: 'BezierPath' object has no attribute '_draw_solid' In-Reply-To: <5A11E613.6050509@sbcglobal.net> References: <5A11B31F.7060900@sbcglobal.net> <248AF619-AE3B-409A-BB96-937089525B22@mac.com> <5A11E613.6050509@sbcglobal.net> Message-ID: <78432708-C58D-4E0F-BD57-4B8DF29B90F7@mac.com> > On Nov 19, 2017, at 3:14 PM, Stephen P. Molnar wrote: > > > On 11/19/2017 03:10 PM, William Ray Wing wrote: >>> On Nov 19, 2017, at 11:36 AM, Stephen P. Molnar wrote: >>> >>> I have written a short Python 3 script to plot three curves (one plot) of data from a FORTRAN program. Initially the code worked and produced the plot which is attached. I have also attached the code and the input data, >>> >> The data made it through, neither the script nor the plot did. If the script really is short, perhaps you could just cut and paste it into a follow-up msg. Absent that, no one here can help you. >> >> Thanks, >> Bill >> As an experiment, I took the code and moved it to my laptop (MacOS, running 10.12.6 where there is a complete Anaconda installation that contains self-consistent versions of everything Dr. Molnar imports (Python 3.6.1 incidentally). There the code runs perfectly. I?m appending a copy of the .png file it produced, and although I expect it to be scraped off by the gateway list-server, it should show up in Dr. Molnar?s e-mail. Bill >>> In all candor, I don't have the faintest idea as to whst the problem (or problens) might be and would greatly appreciate a pointer towards the solution. >>> >>> Thanks in advance. >>> >>> -- >>> Stephen P. Molnar, Ph.D. Life is a fuzzy set >>> www.molecular-modeling.net Stochastic and multivariate >>> (614)312-7528 (c) >>> Skype: smolnar1 >>> >>> _______________________________________________ >>> Tutor maillist - Tutor at python.org >>> To unsubscribe or change subscription options: >>> https://mail.python.org/mailman/listinfo/tutor >> > > Here it is: > > #!/usr/bin/env python3 > # -*- coding: utf-8 -*- > """ > Multiple_Plots_2_b.py > > Copyright (c) 2017 Stephen P. Molnar, Ph.D. All rights reserved. > > """ > import numpy as np > from mpl_toolkits.axes_grid1 import host_subplot > import mpl_toolkits.axisartist as AA > import matplotlib.pyplot as plt > > data = [] > name = input("Enter Molecule ID: ") > > name_in = name+'_poutput' > data = np.genfromtxt(name_in) > > s = data[:,0] > FTm = data[:,1] #atomic number > FTe = data[:,2] #atomic mass > FTc = data[:,3] #atom electron density > > > fig = plt.figure(figsize=(7.6,4)) > > host = host_subplot(111, axes_class=AA.Axes) > plt.subplots_adjust(right=0.75) > > par1 = host.twinx() > par2 = host.twinx() > > offset = 60 > new_fixed_axis = par2.get_grid_helper().new_fixed_axis > par2.axis["right"] = new_fixed_axis(loc="right", axes=par2, > offset=(offset, 0)) > > par2.axis["right"].toggle(all=True) > > host.set_xlim(0, 30) > """ > host.set_ylim(min(FTm), max(FTm)) > """ > > host.set_xlabel("Distance ($\AA$)") > host.set_ylabel("Atomic Number") > par1.set_ylabel("Atom Mass") > par2.set_ylabel("Atom Electron Density") > > p1, = host.plot(data[:,0], data[:,1])#, label="Atomic Number") > p2, = par1.plot(data[:,0], data[:,2])#, label="Atom Mass") > p3, = par2.plot(data[:,0], data[:,3])#, label="Atom Electron Density") > > """ > par1.set_ylim(min(FTe), max(FTe)) > par2.set_ylim(min(FTc),max(FTc)) > """ > > #host.legend() > > host.axis["left"].label.set_color(p1.get_color()) > par1.axis["right"].label.set_color(p2.get_color()) > par2.axis["right"].label.set_color(p3.get_color()) > > host.title.set_text('Molecule {0} - Molecular Transforms'.format(name)) > plt.draw() > plt.show() > > name_plt = name+'-fig1.png' > fig.savefig(name_plt,bbox_inches='tight') > > > -- > Stephen P. Molnar, Ph.D. Life is a fuzzy set > www.molecular-modeling.net Stochastic and multivariate > (614)312-7528 (c) > Skype: smolnar1 > > _______________________________________________ > Tutor maillist - Tutor at python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor From wrw at mac.com Mon Nov 20 11:28:53 2017 From: wrw at mac.com (William Ray Wing) Date: Mon, 20 Nov 2017 11:28:53 -0500 Subject: [Tutor] AttributeError: 'BezierPath' object has no attribute '_draw_solid' In-Reply-To: <5A12ECED.6000108@sbcglobal.net> References: <5A11B31F.7060900@sbcglobal.net> <248AF619-AE3B-409A-BB96-937089525B22@mac.com> <5A11E613.6050509@sbcglobal.net> <78432708-C58D-4E0F-BD57-4B8DF29B90F7@mac.com> <5A12ECED.6000108@sbcglobal.net> Message-ID: <9754AD35-D4AE-4C50-99C8-8033EB914DEC@mac.com> > On Nov 20, 2017, at 9:55 AM, Stephen P. Molnar wrote: > > > On 11/20/2017 09:34 AM, William Ray Wing wrote: [byte] >> As an experiment, I took the code and moved it to my laptop (MacOS, running 10.12.6 where there is a complete Anaconda installation that contains self-consistent versions of everything Dr. Molnar imports (Python 3.6.1 incidentally). There the code runs perfectly. I?m appending a copy of the .png file it produced, and although I expect it to be scraped off by the gateway list-server, it should show up in Dr. Molnar?s e-mail. >> >> Bill >> >> >> [big byte] > Hmmmmmmmmmmmmmm! I'm relieved that the code works! > > I've just encountered something strange. > > I haven't been using Python very long, only about six months or so. When I started I look at a number of different IDE, and settled on Spyder, although not in Anaconda. I just installed Canopy in order to use the ipython notebook, and the code ran perfectly in the Canopy editor!!!! Perhaps I should switch IDE's, but I rather like the Variable Explorer feature in Spyder. > -- There are lots of IDEs. Some of them have more trouble than others dealing with graphics from within a GUI window. I happen to use (and like WingIDE - the name collision is purely an accident). It supports multiple sub-windows, including ones for examining variables, and also running short snippets of code independently of the main code (thus, and very handy in science, plot an array as it exists at a break point to see what it ?looks? like, and not just look at numbers). I would highly recommend you explore alternative IDEs. Bill > Stephen P. Molnar, Ph.D. Life is a fuzzy set > www.molecular-modeling.net Stochastic and multivariate > (614)312-7528 (c) > Skype: smolnar1 From alan.gauld at yahoo.co.uk Mon Nov 20 11:32:46 2017 From: alan.gauld at yahoo.co.uk (Alan Gauld) Date: Mon, 20 Nov 2017 16:32:46 +0000 Subject: [Tutor] AttributeError: 'BezierPath' object has no attribute '_draw_solid' In-Reply-To: <20171120112450.GD19802@ando.pearwood.info> References: <5A11B31F.7060900@sbcglobal.net> <248AF619-AE3B-409A-BB96-937089525B22@mac.com> <5A11E613.6050509@sbcglobal.net> <20171120002353.GY19802@ando.pearwood.info> <20171120112450.GD19802@ando.pearwood.info> Message-ID: On 20/11/17 11:24, Steven D'Aprano wrote: > On Mon, Nov 20, 2017 at 10:26:50AM +0000, Alan Gauld via Tutor wrote: > >> Actually, pasting code etc is safer since the server removes >> attachments. And while it is supposed to preserve plain text >> attachments it will throw them away if it sees *anything* >> that it thinks looks like binary. > > Let's do a test and see what happens! Attached is a .py file in UTF-8. > If that passes through, I think we're good :-) > I think code will normally work unless thee are some odd characters in strings etc. But we have had a couple of cases of py files getting lost. (As in, I could see them in the moderation queue but they were not in the final posted message) But my main concern would be data files where anything that looks like binary will almost certainly go awol. >> corporate accounts that strip all attachments regardless > Given the popularity of HTML email, corporate logos attached as images, > and the ubiquity of emailing PDF and DOC/DOCX files in the business > world, I would be stunned to come across any corporation that stripped > all attachements. I know of at least 3 large corporations that do that. Security is paramount for these guys. It will not apply internally but their firewalls just totally strip any incoming attachments regardless of source or type. At least one will even block mails that look like they contain code in the body text- so even pasting code wouldn't work there. Alan G. From s.molnar at sbcglobal.net Mon Nov 20 09:55:41 2017 From: s.molnar at sbcglobal.net (Stephen P. Molnar) Date: Mon, 20 Nov 2017 09:55:41 -0500 Subject: [Tutor] AttributeError: 'BezierPath' object has no attribute '_draw_solid' In-Reply-To: <78432708-C58D-4E0F-BD57-4B8DF29B90F7@mac.com> References: <5A11B31F.7060900@sbcglobal.net> <248AF619-AE3B-409A-BB96-937089525B22@mac.com> <5A11E613.6050509@sbcglobal.net> <78432708-C58D-4E0F-BD57-4B8DF29B90F7@mac.com> Message-ID: <5A12ECED.6000108@sbcglobal.net> On 11/20/2017 09:34 AM, William Ray Wing wrote: > >> On Nov 19, 2017, at 3:14 PM, Stephen P. Molnar >> > wrote: >> >> >> On 11/19/2017 03:10 PM, William Ray Wing wrote: >>>> On Nov 19, 2017, at 11:36 AM, Stephen P. Molnar >>>> > wrote: >>>> >>>> I have written a short Python 3 script to plot three curves (one >>>> plot) of data from a FORTRAN program. Initially the code worked >>>> and produced the plot which is attached. I have also attached the >>>> code and the input data, >>>> >>> The data made it through, neither the script nor the plot did. If >>> the script really is short, perhaps you could just cut and paste >>> it into a follow-up msg. Absent that, no one here can help you. >>> >>> Thanks, >>> Bill >>> > > As an experiment, I took the code and moved it to my laptop (MacOS, > running 10.12.6 where there is a complete Anaconda installation that > contains self-consistent versions of everything Dr. Molnar imports > (Python 3.6.1 incidentally). There the code runs perfectly. I?m > appending a copy of the .png file it produced, and although I expect > it to be scraped off by the gateway list-server, it should show up in > Dr. Molnar?s e-mail. > > Bill > > > >>>> In all candor, I don't have the faintest idea as to whst the >>>> problem (or problens) might be and would greatly appreciate a >>>> pointer towards the solution. >>>> >>>> Thanks in advance. >>>> >>>> -- >>>> Stephen P. Molnar, Ph.D.Life is a fuzzy set >>>> www.molecular-modeling.net >>>> Stochastic and multivariate >>>> (614)312-7528 (c) >>>> Skype: smolnar1 >>>> >>>> _______________________________________________ >>>> Tutor maillist - Tutor at python.org >>>> To unsubscribe or change subscription options: >>>> https://mail.python.org/mailman/listinfo/tutor >>> >> >> Here it is: >> >> #!/usr/bin/env python3 >> # -*- coding: utf-8 -*- >> """ >> Multiple_Plots_2_b.py >> >> Copyright (c) 2017 Stephen P. Molnar, Ph.D. All rights reserved. >> >> """ >> import numpy as np >> from mpl_toolkits.axes_grid1 import host_subplot >> import mpl_toolkits.axisartist as AA >> import matplotlib.pyplot as plt >> >> data = [] >> name = input("Enter Molecule ID: ") >> >> name_in = name+'_poutput' >> data = np.genfromtxt(name_in) >> >> s = data[:,0] >> FTm = data[:,1] #atomic number >> FTe = data[:,2] #atomic mass >> FTc = data[:,3] #atom electron density >> >> >> fig = plt.figure(figsize=(7.6,4)) >> >> host = host_subplot(111, axes_class=AA.Axes) >> plt.subplots_adjust(right=0.75) >> >> par1 = host.twinx() >> par2 = host.twinx() >> >> offset = 60 >> new_fixed_axis = par2.get_grid_helper().new_fixed_axis >> par2.axis["right"] = new_fixed_axis(loc="right", axes=par2, >> offset=(offset, 0)) >> >> par2.axis["right"].toggle(all=True) >> >> host.set_xlim(0, 30) >> """ >> host.set_ylim(min(FTm), max(FTm)) >> """ >> >> host.set_xlabel("Distance ($\AA$)") >> host.set_ylabel("Atomic Number") >> par1.set_ylabel("Atom Mass") >> par2.set_ylabel("Atom Electron Density") >> >> p1, = host.plot(data[:,0], data[:,1])#, label="Atomic Number") >> p2, = par1.plot(data[:,0], data[:,2])#, label="Atom Mass") >> p3, = par2.plot(data[:,0], data[:,3])#, label="Atom Electron Density") >> >> """ >> par1.set_ylim(min(FTe), max(FTe)) >> par2.set_ylim(min(FTc),max(FTc)) >> """ >> >> #host.legend() >> >> host.axis["left"].label.set_color(p1.get_color()) >> par1.axis["right"].label.set_color(p2.get_color()) >> par2.axis["right"].label.set_color(p3.get_color()) >> >> host.title.set_text('Molecule {0} - Molecular Transforms'.format(name)) >> plt.draw() >> plt.show() >> >> name_plt = name+'-fig1.png' >> fig.savefig(name_plt,bbox_inches='tight') >> >> >> -- >> Stephen P. Molnar, Ph.D.Life is a fuzzy set >> www.molecular-modeling.net >> Stochastic and multivariate >> (614)312-7528 (c) >> Skype: smolnar1 >> >> _______________________________________________ >> Tutor maillist - Tutor at python.org >> To unsubscribe or change subscription options: >> https://mail.python.org/mailman/listinfo/tutor > Hmmmmmmmmmmmmmm! I'm relieved that the code works! I've just encountered something strange. I haven't been using Python very long, only about six months or so. When I started I look at a number of different IDE, and settled on Spyder, although not in Anaconda. I just installed Canopy in order to use the ipython notebook, and the code ran perfectly in the Canopy editor!!!! Perhaps I should switch IDE's, but I rather like the Variable Explorer feature in Spyder. -- Stephen P. Molnar, Ph.D. Life is a fuzzy set www.molecular-modeling.net Stochastic and multivariate (614)312-7528 (c) Skype: smolnar1 From s.molnar at sbcglobal.net Mon Nov 20 10:51:02 2017 From: s.molnar at sbcglobal.net (Stephen P. Molnar) Date: Mon, 20 Nov 2017 10:51:02 -0500 Subject: [Tutor] AttributeError: 'BezierPath' object has no attribute '_draw_solid' In-Reply-To: <20171120151829.GG19802@ando.pearwood.info> References: <5A11B31F.7060900@sbcglobal.net> <248AF619-AE3B-409A-BB96-937089525B22@mac.com> <5A11E613.6050509@sbcglobal.net> <20171120002353.GY19802@ando.pearwood.info> <20171120112450.GD19802@ando.pearwood.info> <5A12D631.5010302@sbcglobal.net> <20171120151829.GG19802@ando.pearwood.info> Message-ID: <5A12F9E6.60806@sbcglobal.net> On 11/20/2017 10:18 AM, Steven D'Aprano wrote: > On Mon, Nov 20, 2017 at 08:18:41AM -0500, Stephen P. Molnar wrote: > >> I'm not really looking for someone to do the programming for me. I know >> that the code works, because it did and produced the attached plot. I >> just don't know why it stopped working. Actually, all of my programming >> experience has been with FORTRAN, starting with II in 1961 (yes, I am >> rather an old... an Organic Chemist. >> >> Let's start over, >> >> This is the code: > You seem to have completely ignored my advice about cutting the code > down to the minimum amount that demonstrates the error. Okay, that's > your perogative, but as a volunteer it is my perogative to choose how > much or how little effort I put into solving your problem for you. > > I have neither the time nor the inclination to spend a lot of time on > this, so I'll just offer one suggestion. According to the error > traceback, you appear to be running the script from inside either the > Spyder IDE, or possibly an iPython/Jupyter notebook. > > This appears to be the command you are running (inside iPython?): > >> runfile('/home/comp/Apps/Python/Plot_T_Data/MultiplePlots_3.py', wdir='/home/comp/Apps/Python/Plot_T_Data') > and the traceback shows a failure relating to iPython and/or Spyder: > >> File "", line 1, in >> runfile('/home/comp/Apps/Python/Plot_T_Data/MultiplePlots_3.py', wdir='/home/comp/Apps/Python/Plot_T_Data') >> >> File "/usr/local/lib/python3.5/dist-packages/spyder/utils/site/sitecustomize.py", line 688, in runfile >> execfile(filename, namespace) > > It is possible that you have recently updated iPython or installed > Spyder, and that has broken your script. I recommend that you eliminate > them from contention, by running your script from the old-fashioned > Linux commandline. From bash, or some other terminal shell, run: > > > cd /home/comp/Apps/Python/Plot_T_Data > python3.5 MultiplePlots_3.py > > > and see if the error persists. If the error goes away, then the problem > lies in iPython or Spyder. > > In a nutshell, based on a cursory look at the traceback, this seems to > be a problem with your environment rather than your code. > > Good luck! > > Followed your advice; comp at AbNormal:~/Apps/Models/Fluoranthene/ReferenceMolecules/Output/Transforms_1$ python3.5 MultiplePlots_3.py Enter Molecule ID: Chrysene Exception in Tkinter callback Traceback (most recent call last): File "/usr/lib/python3.5/tkinter/__init__.py", line 1562, in __call__ return self.func(*args) File "/usr/lib/python3.5/tkinter/__init__.py", line 608, in callit func(*args) File "/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_tkagg.py", line 323, in idle_draw self.draw() File "/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_tkagg.py", line 304, in draw FigureCanvasAgg.draw(self) File "/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_agg.py", line 430, in draw self.figure.draw(self.renderer) File "/usr/local/lib/python3.5/dist-packages/matplotlib/artist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 1295, in draw renderer, self, artists, self.suppressComposite) File "/usr/local/lib/python3.5/dist-packages/matplotlib/image.py", line 138, in _draw_list_compositing_images a.draw(renderer) File "/usr/lib/python3/dist-packages/mpl_toolkits/axes_grid1/parasite_axes.py", line 295, in draw self._get_base_axes_attr("draw")(self, renderer) File "/usr/lib/python3/dist-packages/mpl_toolkits/axisartist/axislines.py", line 778, in draw super(Axes, self).draw(renderer, inframe) File "/usr/local/lib/python3.5/dist-packages/matplotlib/artist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/matplotlib/axes/_base.py", line 2399, in draw mimage._draw_list_compositing_images(renderer, self, artists) File "/usr/local/lib/python3.5/dist-packages/matplotlib/image.py", line 138, in _draw_list_compositing_images a.draw(renderer) File "/usr/local/lib/python3.5/dist-packages/matplotlib/artist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs) File "/usr/lib/python3/dist-packages/mpl_toolkits/axisartist/axis_artist.py", line 1572, in draw self._draw_line(renderer) File "/usr/lib/python3/dist-packages/mpl_toolkits/axisartist/axis_artist.py", line 1170, in _draw_line self.line.draw(renderer) File "/usr/lib/python3/dist-packages/mpl_toolkits/axisartist/axis_artist.py", line 163, in draw lineFunc = getattr(self, funcname) AttributeError: 'BezierPath' object has no attribute '_draw_solid' Exception in Tkinter callback Traceback (most recent call last): File "/usr/lib/python3.5/tkinter/__init__.py", line 1562, in __call__ return self.func(*args) File "/usr/lib/python3.5/tkinter/__init__.py", line 608, in callit func(*args) File "/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_tkagg.py", line 323, in idle_draw self.draw() File "/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_tkagg.py", line 304, in draw FigureCanvasAgg.draw(self) File "/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_agg.py", line 430, in draw self.figure.draw(self.renderer) File "/usr/local/lib/python3.5/dist-packages/matplotlib/artist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 1295, in draw renderer, self, artists, self.suppressComposite) File "/usr/local/lib/python3.5/dist-packages/matplotlib/image.py", line 138, in _draw_list_compositing_images a.draw(renderer) File "/usr/lib/python3/dist-packages/mpl_toolkits/axes_grid1/parasite_axes.py", line 295, in draw self._get_base_axes_attr("draw")(self, renderer) File "/usr/lib/python3/dist-packages/mpl_toolkits/axisartist/axislines.py", line 778, in draw super(Axes, self).draw(renderer, inframe) File "/usr/local/lib/python3.5/dist-packages/matplotlib/artist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/matplotlib/axes/_base.py", line 2399, in draw mimage._draw_list_compositing_images(renderer, self, artists) File "/usr/local/lib/python3.5/dist-packages/matplotlib/image.py", line 138, in _draw_list_compositing_images a.draw(renderer) File "/usr/local/lib/python3.5/dist-packages/matplotlib/artist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs) File "/usr/lib/python3/dist-packages/mpl_toolkits/axisartist/axis_artist.py", line 1572, in draw self._draw_line(renderer) File "/usr/lib/python3/dist-packages/mpl_toolkits/axisartist/axis_artist.py", line 1170, in _draw_line self.line.draw(renderer) File "/usr/lib/python3/dist-packages/mpl_toolkits/axisartist/axis_artist.py", line 163, in draw lineFunc = getattr(self, funcname) AttributeError: 'BezierPath' object has no attribute '_draw_solid' Exception in Tkinter callback Traceback (most recent call last): File "/usr/lib/python3.5/tkinter/__init__.py", line 1562, in __call__ return self.func(*args) File "/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_tkagg.py", line 233, in resize self.show() File "/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_tkagg.py", line 304, in draw FigureCanvasAgg.draw(self) File "/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_agg.py", line 430, in draw self.figure.draw(self.renderer) File "/usr/local/lib/python3.5/dist-packages/matplotlib/artist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/matplotlib/figure.py", line 1295, in draw renderer, self, artists, self.suppressComposite) File "/usr/local/lib/python3.5/dist-packages/matplotlib/image.py", line 138, in _draw_list_compositing_images a.draw(renderer) File "/usr/lib/python3/dist-packages/mpl_toolkits/axes_grid1/parasite_axes.py", line 295, in draw self._get_base_axes_attr("draw")(self, renderer) File "/usr/lib/python3/dist-packages/mpl_toolkits/axisartist/axislines.py", line 778, in draw super(Axes, self).draw(renderer, inframe) File "/usr/local/lib/python3.5/dist-packages/matplotlib/artist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/matplotlib/axes/_base.py", line 2399, in draw mimage._draw_list_compositing_images(renderer, self, artists) File "/usr/local/lib/python3.5/dist-packages/matplotlib/image.py", line 138, in _draw_list_compositing_images a.draw(renderer) File "/usr/local/lib/python3.5/dist-packages/matplotlib/artist.py", line 55, in draw_wrapper return draw(artist, renderer, *args, **kwargs) File "/usr/lib/python3/dist-packages/mpl_toolkits/axisartist/axis_artist.py", line 1572, in draw self._draw_line(renderer) File "/usr/lib/python3/dist-packages/mpl_toolkits/axisartist/axis_artist.py", line 1170, in _draw_line self.line.draw(renderer) File "/usr/lib/python3/dist-packages/mpl_toolkits/axisartist/axis_artist.py", line 163, in draw lineFunc = getattr(self, funcname) AttributeError: 'BezierPath' object has no attribute '_draw_solid' -- Stephen P. Molnar, Ph.D. Life is a fuzzy set www.molecular-modeling.net Stochastic and multivariate (614)312-7528 (c) Skype: smolnar1 From marcus.luetolf at bluewin.ch Sun Nov 26 07:29:49 2017 From: marcus.luetolf at bluewin.ch (=?iso-8859-1?Q?marcus_l=FCtolf?=) Date: Sun, 26 Nov 2017 13:29:49 +0100 Subject: [Tutor] failed installation of Python 2.7 Message-ID: <000801d366b2$40bf0a30$c23d1e90$@bluewin.ch> dear experts, cleaning up my computer I removed all my different Python versions, saving all .py and .txt files. I could reinstall Python 3.6 but not Python 2.7, getting an error mesage: ?a program required for this insatll could not be found?. Searching different websites I could not solve this problem. Might you be able to offre a solution? Marcus Luetolf --- Diese E-Mail wurde von Avast Antivirus-Software auf Viren gepr?ft. https://www.avast.com/antivirus From steve at pearwood.info Sun Nov 26 18:12:09 2017 From: steve at pearwood.info (Steven D'Aprano) Date: Mon, 27 Nov 2017 10:12:09 +1100 Subject: [Tutor] failed installation of Python 2.7 In-Reply-To: <000801d366b2$40bf0a30$c23d1e90$@bluewin.ch> References: <000801d366b2$40bf0a30$c23d1e90$@bluewin.ch> Message-ID: <20171126231209.GE22248@ando.pearwood.info> On Sun, Nov 26, 2017 at 01:29:49PM +0100, marcus l?tolf wrote: > dear experts, > > cleaning up my computer I removed all my different Python versions, Its sounds more like "breaking" than "cleaning up" :-( You should never delete programs unless you know what they are for and what will be affected by it. > saving all .py and .txt files. > > I could reinstall Python 3.6 but not Python 2.7, getting an error mesage: > > a program required for this insatll could not be found. "insatll"? I doubt that was what the error message actually said. When reporting error messages, it is critically important to get them word-for-word exactly right. Please don't paraphrase them or type from memory. Please start by explaining: - What operating system you are using (Windows, Linux, Mac OS, something else?) - If Linux, which distro you are running (Red Hat, Debian, Ubuntu, etc)? - If Windows or Mac OS, what version? - Please try to COPY AND PASTE the FULL error message. I am pretty sure that even on Windows you can use the mouse to select the error message and copy it. - Does the error message say *which* program is missing? That is the most important information you need. -- Steve From alan.gauld at yahoo.co.uk Sun Nov 26 19:21:48 2017 From: alan.gauld at yahoo.co.uk (Alan Gauld) Date: Mon, 27 Nov 2017 00:21:48 +0000 Subject: [Tutor] failed installation of Python 2.7 In-Reply-To: <20171126231209.GE22248@ando.pearwood.info> References: <000801d366b2$40bf0a30$c23d1e90$@bluewin.ch> <20171126231209.GE22248@ando.pearwood.info> Message-ID: On 26/11/17 23:12, Steven D'Aprano wrote: > Please start by explaining: > > ... Also tell us how you are installing this version. If it is a binary installer where did you download it from? And what was it called? If you are using a package manager say so. If you are trying to build from source (why?) tell us exactly what steps you took. There are lots of options when it comes to "installing python" and we need to know exactly what you are doing before we can help. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos From johncocksbusiness at gmail.com Sun Nov 26 20:57:37 2017 From: johncocksbusiness at gmail.com (John Cocks) Date: Sun, 26 Nov 2017 19:57:37 -0600 Subject: [Tutor] Need help fixing some code for a project Message-ID: The task is broken down into three sections. Section 1 - User Input Section 2 - loop through the grocery list Section 3 - provide output to the console ''' #Task: Create the empty data structure grocery_item = {} grocery_history = [] #Variable used to check if the while loop condition is met stop = 'go' while stop == 'go' : #Accept input of the name of the grocery item purchased. item_name = "Item name:\n" #Accept input of the quantitiy of the grocery item purchased. quantity = "Quantity purchased:\n" #Accept input of the cost of the grocery item input (this is a per-item cost). cost = "Price per item:\n" #Create a dictionary entry which contains the name, number and price entered by the user. grocery_item = {'name': item_name, 'number': int(quantity), 'price': float(cost)} -- errors usually occur here because of "quantity purchased:\n line #Add the grocery_item to the grocery_history list using the append function grocery_history.append(grocery_item) #Accept input from the user asking if they have finished entering grocery items. print("Would you like to enter another item?\n Type 'c' for continue or 'q' to quit:\n") # Define variable to hold grand total called 'grand_total' grand_total = 0 #Define a 'for' loop. for grocery_item in grocery_history: #Calculate the total cost for the grocery_item. item_total = number * price #Add the item_total to the grand_total item_total = grand_total #Output the information for the grocery item to match this example: #2 apple @ $1.49 ea $2.98 print('number', 'name', 'price', 'cost') #print(name) #print(price: %6.2f) -- errors happen here #print(item_total: %6.2f) -- errors happen here too #Set the item_total equal to 0 item_total = 0 #Print the grand total print(grand_total) From alan.gauld at yahoo.co.uk Mon Nov 27 04:48:10 2017 From: alan.gauld at yahoo.co.uk (Alan Gauld) Date: Mon, 27 Nov 2017 09:48:10 +0000 Subject: [Tutor] Need help fixing some code for a project In-Reply-To: References: Message-ID: On 27/11/17 01:57, John Cocks wrote: > The task is broken down into three sections. What exactly do you want help with? Do you not understand part of the problem? Do you not know how to code some part? Are you getting an error? If so show us the full error text. WE are not mind readers, you need to tell us what you want to know. As for the code below, I've added a few remarks... > #Task: Create the empty data structure > grocery_item = {} > > grocery_history = [] > > #Variable used to check if the while loop condition is met > stop = 'go' > > while stop == 'go' : This would read better if stop were a boolean variable stop = False while not stop: ... > #Accept input of the name of the grocery item purchased. > item_name = "Item name:\n" Your comment says "accept input" but you are not accepting input, you are just assigning a string to a variable. Do you know how to read input from a user? > #Accept input of the quantitiy of the grocery item purchased. > quantity = "Quantity purchased:\n" > #Accept input of the cost of the grocery item input (this is a per-item > cost). > cost = "Price per item:\n" > #Create a dictionary entry which contains the name, number and price > entered by the user. > grocery_item = {'name': item_name, 'number': int(quantity), 'price': > float(cost)} -- errors usually occur here because of "quantity > purchased:\n line > #Add the grocery_item to the grocery_history list using the append > function > grocery_history.append(grocery_item) > #Accept input from the user asking if they have finished entering > grocery items. > print("Would you like to enter another item?\n Type 'c' for continue or > 'q' to quit:\n") If you were reading input how would you exit the while loop above? You need to test for that situation and take the appropriate action. > # Define variable to hold grand total called 'grand_total' > grand_total = 0 Its traditional to put ALL the variable definitions at the top of your code so you know where to find them easily. > #Define a 'for' loop. > for grocery_item in grocery_history: Its probbablyt not a good idea to use the same variable name for the loop as you did in the input code above. In this case it won't bite you but it could get confusing. I'd suggest maybe just use 'item' instead? > #Calculate the total cost for the grocery_item. > item_total = number * price You don't have variables called 'number' or 'price' but you do have dictionary keys in grocery_item. So you really need: item_total = grocery_item['number'] * grocery_item['price'] > #Add the item_total to the grand_total > item_total = grand_total You are not adding you are assigning. And in fact you are wiping out your total by replacing it with 0! > #Output the information for the grocery item to match this example: > #2 apple @ $1.49 ea $2.98 > print('number', 'name', 'price', 'cost') Her you just print the key strings not the actuial values. Again you need to use the keys to access the item. > #Set the item_total equal to 0 > item_total = 0 > #Print the grand total > print(grand_total) HTH, but, if you have more specific queries, come back to us with more detail. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos From 1019shaun at gmail.com Mon Nov 27 15:47:05 2017 From: 1019shaun at gmail.com (Howard Lawrence) Date: Mon, 27 Nov 2017 12:47:05 -0800 Subject: [Tutor] calling function Message-ID: import turtle # this part draws a square def square(): my_turtle = turtle.Turtle() my_turtle.forward(100) my_turtle.left(90) my_turtle.forward(100) my_turtle.left(90) my_turtle.forward(100) my_turtle.left(90) my_turtle.forward(100) square() my_turtle.forward(100) # this is a second square square() # my_turtle.forward(100) # my_turtle.left(90) # my_turtle.forward(100) # my_turtle.left(90) # my_turtle.forward(100) # my_turtle.left(90) # my_turtle.forward(100) what is wrong with this, and how to fix it the code is suppose to make two box but only make one using python 3.5 idle on windows 7 From DerekSmith at racksquared.com Mon Nov 27 16:24:34 2017 From: DerekSmith at racksquared.com (Derek Smith) Date: Mon, 27 Nov 2017 21:24:34 +0000 Subject: [Tutor] get javascript output data from ssi file Message-ID: I have not found a way into my tape library from the manufacture IBM, there's no command-line or api I am aware of nor is google. I need to get what this library thinks is its tape volumes inventory. I have used chrome to view the code and its using adobe's SSI files which then calls a jscript. Does python provide any way into this tricky application? I tried cURL but from my understanding it will not provide such data since its pulls markup. Below is the code in a file called move_element_operations.ssi according to chromes inspect command via right-click. The volume listing and volumes are highlighted. Thx in advance!!
Source
Element
Volume Serial
Element Volume Serial
Drive 1 (1) R20122L5
Drive 2 (1) R20277L5
Drive 3 (1) R20265L5
Slot 1 (1) R20435L5
Slot 2 (1) R20061L5
Slot 3 (1) R20408L5
Slot 4 (1) R20063L5
Slot 5 (1) R20218L5
Slot 6 (1) R20465L5
Slot 7 (1) R20261L5
Slot 8 (1) R20561L5
Slot 10 (1) R20378L5
Slot 11 (1) R20255L5
Slot 12 (1) R20445L5
Slot 13 (1) R20052L5
Slot 14 (1) R20498L5
Slot 15 (1) R20345L5
Slot 16 (1) R20325L5
Slot 17 (1) R20037L5
Slot 18 (1) R20272L5
Slot 19 (1) R20446L5
Slot 21 (1) R20372L5
Slot 22 (1) R20121L5
Slot 24 (1) R20027L5
Slot 25 (1) R20082L5
Slot 26 (1) R20347L5
Slot 27 (1) R20065L5
Slot 28 (1) R20331L5
Slot 29 (1) R20296L5
Slot 33 (1) R20494L5
Slot 34 (1) R20030L5
Slot 38 (1) R20373L5
Slot 39 (1) R20292L5
Slot 42 (1) R20158L5
Slot 43 (1) R20578L5
Slot 45 *Res* CLNU76L1


Destination
Element
Volume Serial
Element Volume Serial
Drive 4 (1)  
I/O Station 1  
I/O Station 2  
I/O Station 3  
Slot 9 (1)  
Slot 20 (1)  
Slot 23 (1)  
Slot 30 (1)  
Slot 31 (1)  
Slot 32 (1)  
Slot 35 (1)  
Slot 36 (1)  
Slot 37 (1)  
Slot 40 (1)  
Slot 41 (1)  
Slot 44 (1)  

Derek Smith | Unix/TSM Administrator | Racksquared Data Centers ': 614-437-4983 * 325 East Spring Street, Columbus, OH 43215 :: dereksmith at racksquared.com *: www.racksquared.com | www.racksquared.jobs [cid:image003.png at 01D2E9AA.1B9CF8F0] From marcus.luetolf at bluewin.ch Mon Nov 27 15:39:37 2017 From: marcus.luetolf at bluewin.ch (=?utf-8?Q?marcus_l=C3=BCtolf?=) Date: Mon, 27 Nov 2017 21:39:37 +0100 Subject: [Tutor] failed installation of Python 2.7 In-Reply-To: References: <000801d366b2$40bf0a30$c23d1e90$@bluewin.ch> Message-ID: <002901d367bf$d98c6e70$8ca54b50$@bluewin.ch> many thanks, Peter I could install the newest version of python 3.6 without any problems but I need python 2.7 for tutorial purposes. Marcus. -----Urspr?ngliche Nachricht----- Von: peter [mailto:peterrisley47 at gmail.com] Gesendet: Montag, 27. November 2017 20:20 An: marcus l?tolf Betreff: Re: [Tutor] failed installation of Python 2.7 I had that problem and ended up using install python3 instead of 3.6 . I do not think that was the best answer as now python3 defaults to 3.5.4 and not 3.6! frustrating. Its suppose to install and default to the newest version you have! but it works. also I remember that it did install 2.7 which for backward compatible issues is necessary I guess? I think your problem is baked in the cake and we will have to wait till newer versions come out. And as they say "Waiting is the hardest part!" Tom petty. On 11/26/2017 02:29 AM, marcus l?tolf wrote: > dear experts, > > cleaning up my computer I removed all my different Python versions, > > saving all .py and .txt files. > > I could reinstall Python 3.6 but not Python 2.7, getting an error mesage: > > ?a program required for this insatll could not be found?. > > Searching different websites I could not solve this problem. > Might you be able to offre a solution? > > > > Marcus Luetolf > > > > > > --- > Diese E-Mail wurde von Avast Antivirus-Software auf Viren gepr?ft. > https://www.avast.com/antivirus > _______________________________________________ > Tutor maillist - Tutor at python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor From alan.gauld at yahoo.co.uk Mon Nov 27 19:19:50 2017 From: alan.gauld at yahoo.co.uk (Alan Gauld) Date: Tue, 28 Nov 2017 00:19:50 +0000 Subject: [Tutor] calling function In-Reply-To: References: Message-ID: On 27/11/17 20:47, Howard Lawrence wrote: > import turtle > # this part draws a square > def square(): > > my_turtle = turtle.Turtle() Note that this creates my_turtle as a local variable inside the function. It will not be visible outside the function. > my_turtle.forward(100) > my_turtle.left(90) > my_turtle.forward(100) > my_turtle.left(90) > my_turtle.forward(100) > my_turtle.left(90) > my_turtle.forward(100) > square() > > my_turtle.forward(100) So this should fail; with an error message - a name error most likely. > # this is a second square > square() And this creates a new square directly on top of the earlier one, so they look like one. You need to create the turtle outside the function and then refer to it from inside the function, ideally by passing it in as an argument: def square(aTurtle): aTurtle.forward(100) etc... my_turtle = turtle.Turtle() square(my_turtle) my_turtle.forward(100) square(my_turtle) HTH -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos From alan.gauld at yahoo.co.uk Tue Nov 28 03:33:18 2017 From: alan.gauld at yahoo.co.uk (Alan Gauld) Date: Tue, 28 Nov 2017 08:33:18 +0000 Subject: [Tutor] failed installation of Python 2.7 In-Reply-To: <002901d367bf$d98c6e70$8ca54b50$@bluewin.ch> References: <000801d366b2$40bf0a30$c23d1e90$@bluewin.ch> <002901d367bf$d98c6e70$8ca54b50$@bluewin.ch> Message-ID: On 27/11/17 20:39, marcus l?tolf wrote: > I could install the newest version of python 3.6 without > any problems but I need python 2.7 for tutorial purposes. Please provide the extra information previously requested and we should be able to help. What you want to do is easily possible we just need more details to help. > I think your problem is baked in the cake and we will > have to wait till newer versions come out. This is most certainly not true, many of us are running multiple versions of Python, including 3.6 and 2.7 We just need to get to the root of your issue. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos From alan.gauld at yahoo.co.uk Tue Nov 28 03:42:23 2017 From: alan.gauld at yahoo.co.uk (Alan Gauld) Date: Tue, 28 Nov 2017 08:42:23 +0000 Subject: [Tutor] get javascript output data from ssi file In-Reply-To: References: Message-ID: On 27/11/17 21:24, Derek Smith wrote: > I have not found a way into my tape library from the manufacture IBM, > there's no command-line or api I am aware of nor is google. I suspect you are asking the wrong questions. Have you tried contacting IBM directly - if they make/sell it they should support it! And it's almost inconceivable that there is no API. > I have used chrome to view the code I assume you mean that there is some kind of web application and you are looking at the browser code? Not the actual code of the tape management system? Also, what tape library is it? Which OS are you using? That would help a lot. It may be that the OS provides a generic tape API that your product conforms too. > and its using adobe's SSI files Sorry I've never heard of these before. > > > > > > >