Re: [Tutor] best Python Web-Development Applications framework.

2017-05-07 Thread Alan Gauld via Tutor
On 07/05/17 16:23, Jojo Mwebaze wrote: > I am trying to figure out the best Python Web-Development Applications > framework. I trying to get started with building Web-Based Applications. > Kindly give advise which one is the best for a novice user It depends on several factors which you haven't

[Tutor] Fwd: Re: Python 3.6 Extract Floating Point Data from a Text File

2017-04-30 Thread Alan Gauld via Tutor
How, embarrassing, I forgot to CC the list! :-) On 30/04/17 11:09, Stephen P. Molnar wrote: > I would have managed to extract input data from another calculation (not > a Python program) into the following text file. > > LOEWDIN ATOMIC CHARGES > -- > 0 C :

Re: [Tutor] Fwd: Re: Python 3.6 Extract Floating Point Data from a Text File

2017-05-01 Thread Alan Gauld via Tutor
On 01/05/17 15:54, Stephen P. Molnar wrote: > Unfortunately, I'm still missing something. Here is my latest attempt > to incorporate your solution: > name = input("Enter Molecule ID: ") > name = str(name) you don't need the str() since input() always returns whatever string the user enters. >

Re: [Tutor] Working with APIs - understanding the basics (Python 3.5)

2017-04-29 Thread Alan Gauld via Tutor
On 29/04/17 18:13, Rafael Knuth wrote: > can anyone recommend good resources? I am primarily in search of > simple, clean code examples & practical usecases (Google APIs for > example). An API is just a set of classes or functions. The Python standard library is an API. You already have lots of

Re: [Tutor] Tkinter layout question

2017-04-30 Thread Alan Gauld via Tutor
On 26/04/17 07:56, Phil wrote: >> Your messages come into the moderation queue, I'm > > Thanks Alan, maybe the reason ...is because I'm > on the bounces list. I don;t know what bounces list you mean but it looks like your messages are going through directly now, I don't know what changed...

Re: [Tutor] Press ESC to exit()

2017-05-02 Thread Alan Gauld via Tutor
On 02/05/17 04:03, Michael C wrote: > holy cow I did warn you it was non trivial :-) Basically Eryksun has done what your scripting tool is doing in the background. -- 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

Re: [Tutor] Pycharm Edu Lesson 3, Task 7

2017-05-02 Thread Alan Gauld via Tutor
On 02/05/17 01:42, David Wolfe wrote: > I'm working through Pycharm Edu, and I'm stuck on the following: > > phrase = """ > It is a really long string > triple-quoted strings are used > to define multi-line strings > """ > first_half = phrase[:len(phrase)//2] > print(first_half) > > > The

Re: [Tutor] Index Out of Range?List

2017-05-04 Thread Alan Gauld via Tutor
On 04/05/17 13:21, Stephen P. Molnar wrote: > Here are the error messages: > > Enter Molecule ID: A > A.lac.dat > Traceback (most recent call last): > >File "", line 1, in > runfile('/home/comp/Apps/Python/Testing/ReadFile_1.py', > wdir='/home/comp/Apps/Python/Testing') There

Re: [Tutor] General question rgrd. usage of libraries

2017-05-05 Thread Alan Gauld via Tutor
On 05/05/17 14:45, Rafael Knuth wrote: > How do I know which libraries I need to perform a certain task? Mostly youn learn by experience, but otherwise google (or other search engine) is your friend. It doesn't do any harm to read the Library Reference document on the python.org web site too, it

Re: [Tutor] selenium, automated testing and python

2017-05-04 Thread Alan Gauld via Tutor
On 04/05/17 19:44, Palm Tree wrote: > Sorry i'm a bit new to automated testing. > > I have explored python wide and deep but can someone just tell me why as a > coder i need automated testing? You don't, you can test it all by hand. But it will take you much longer, especially after you've done,

Re: [Tutor] Index Out of Range?List

2017-05-04 Thread Alan Gauld via Tutor
On 04/05/17 13:50, Stephen P. Molnar wrote: >> I'll assume that's where the problem lies. >> Try checking if the string is not empty before using it: >> >> for line in f.readlines(): >> if line: >> atm_chg.append(float( line.split()[-1] )) > I have edited the code: >

Re: [Tutor] selenium, automated testing and python

2017-05-04 Thread Alan Gauld via Tutor
On 04/05/17 22:09, Alan Gauld via Tutor wrote: > And the reasons above are only scratching the > surface, there are many more gains that apply to > testing in general but are only practical if > testing is automated. One thing I meant to add is that "automated" does not

Re: [Tutor] urllib ... lost novice's question

2017-05-08 Thread Alan Gauld via Tutor
On 08/05/17 16:23, Rafael Knuth wrote: > Which package should I use to fetch and open an URL? > I am using Python 3.5 and there are presently 4 versions: > > urllib2 > urllib3 > urllib4 > urllib5 I don't know where you are getting those from but the standard install of Python v3.6 only has

Re: [Tutor] airflow dag

2017-05-25 Thread Alan Gauld via Tutor
On 25/05/17 13:15, shubham goyal wrote: > He guys, > > I want to ask that can we pass the parameters as commandline arguments in > airflow when we are triggering the dag and access them inside the dag's > python script/file. I've no idea what a dag is. This list is for people learning Python as

[Tutor] Fwd: Re: Using files to read data

2017-06-27 Thread Alan Gauld via Tutor
34 2017" ] [ 0.03, 0.9777, "Mon Jun 26 20:37:34 2017" ] [ 0.02, 0.9889, "Mon Jun 26 20:37:34 2017” *with this code* filename = "xyz_save.json" with open(filename) as f_obj: lines = f_obj.read() print(lines)

Re: [Tutor] How to write database-agnostic python code? (Is this even possible?)

2017-09-14 Thread Alan Gauld via Tutor
On 14/09/17 04:11, boB Stepp wrote: >> SELECT some, fields (never *) > > Why no "*"? Does this open up a security vulnerability? Not so much security as resilience to change. If you use * and the data schema changes to include extra fields then your * query returns the extra

Re: [Tutor] How to write database-agnostic python code? (Is this even possible?)

2017-09-14 Thread Alan Gauld via Tutor
On 14/09/17 04:40, boB Stepp wrote: >> mapping your logic layer object models to underlying >> data tables. > > My initial thoughts here are that typically a particular class would > map to a particular table and that each object instance would > correspond to a row in said table. Is this

Re: [Tutor] Python Help

2017-09-15 Thread Alan Gauld via Tutor
On 15/09/17 04:08, Pratyusha Thundena wrote: > How do check to see if string ‘garden’ contains a > vowel(a, e , i , o, u , or y) using a for loop? Hi, this sounds like homework and we won't do your homework for you, but we do give hints. How would you do this without a computer? There are (at

Re: [Tutor] Create CDF using Python

2017-09-13 Thread Alan Gauld via Tutor
On 13/09/17 01:28, Pareshkumar Panchal wrote: > I have set of data in excel file. i would like to create the CDF plots & > find 40th & 70th Percentile using python with functionality of refresh > whenever the data sets update. There may be a good reason for this but frankly that's what

Re: [Tutor] How is database creation normally handled?

2017-09-13 Thread Alan Gauld via Tutor
On 10/09/17 18:41, Mats Wichmann wrote: > restore" and a local copy of the (mysql) db will be built. So that's > what I just agreed with: the setup process happens outside the code app ... > maybe it's not that unusual - any time you need to start with a > reproducible known state of the DB, that

Re: [Tutor] Python HW question

2017-09-16 Thread Alan Gauld via Tutor
On 16/09/17 01:32, mikn...@gmail.com wrote: > I really need some Python help. I’m a beginner and have some hw for class: OK, Usual caveat: we don;t do your homework, just give hints. > Write a program that calculates longest substring of increasing letters in > st, say

Re: [Tutor] pip install of subprocess module

2017-09-18 Thread Alan Gauld via Tutor
On 18/09/17 18:59, Derek Smith wrote: > I want to use the subprocess.run module b/c per the> docs os.system is > antiquated Its not so much antiquated but it is deprecated because it is severely limited, all you get back is an error code. > Why am I doing wrong below? You are trying to

Re: [Tutor] Need Help with install of Python!

2017-09-19 Thread Alan Gauld via Tutor
On 19/09/17 21:13, Larry Staley wrote: > Hello I am very new to Python just having installed Python Version 2.7 onto > my windows 8.1 laptop. I thought the install was successful and was > entering information for my first assignment when I received an unexpected > error. Where did you get your

Re: [Tutor] Require help for a script

2017-09-19 Thread Alan Gauld via Tutor
On 19/09/17 08:48, Clara Chua wrote: > Hi Python tutor, I require help for a script that asks user for number of > rows, r and number of columns c, and generates a r x c matrix with the > following values: What help do you need? Which part of the above do you not know how to do? Can you ask the

Re: [Tutor] subprocess check_output

2017-09-20 Thread Alan Gauld via Tutor
On 20/09/17 22:09, Derek Smith wrote: > Why does python output this b and newline characters Because that's what the command is returning. The b indicates its an array of bytes (as opposed to a unicode string) Note the module dpocumentation for check_output() says: "By default, this function

Re: [Tutor] (no subject)

2017-09-19 Thread Alan Gauld via Tutor
On 19/09/17 15:11, C wrote: > Hi Python tutor, I require help for a script that asks user for number of > rows, r and number of columns c, and generates a r x c matrix with the > following values: You already posted this in another thread, please do not multi-post it just clutters up the archive

Re: [Tutor] Tutor Digest, Vol 163, Issue 28

2017-09-19 Thread Alan Gauld via Tutor
On 19/09/17 15:45, Saahndong Ransom wrote: > What are the uses of python? > What are easy way to learn python? Python is a general purpose programming language that can be used to build many kinds of software applications from computer administration to web servers to desktop GUI applications.

Re: [Tutor] array input from keyboard

2017-09-15 Thread Alan Gauld via Tutor
On 15/09/17 21:50, Derek Smith wrote: > if nput1 == "file" : > nput2 = input("Please provide your input file? ") > nput2 = nput2.lower() Are you sure the filenames will always be lower case? > print (nput2) > fh = open(nput2,"r") You should wrap that in a try/except in case

Re: [Tutor] Python + Irc

2017-09-15 Thread Alan Gauld via Tutor
On 15/09/17 21:16, Fernando Gualberto wrote: > How i can integrate Python program with IRC to send Messages from program > to the IRC? If you google "python irc module" you should get several hits. Try looking at the documentation and pick the one that seems easiest for your needs. -- Alan G

Re: [Tutor] running or calling a module from the desktop

2017-09-21 Thread Alan Gauld via Tutor
On 20/09/17 22:06, orpha.pen...@outlook.com wrote: > I would like to import, run or set path to desktop. OK, On Windows go to Windows Exploder and type in the address %HOMEPATH%\Desktop Go there and you should be able to see/figure out the full path to your personal desktop folder. Then add

Re: [Tutor] Tkinter's Documentation

2017-10-06 Thread Alan Gauld via Tutor
my first message was not so clear -- From: Tutor <tutor-bounces+rikudou__sennin=outlook....@python.org> on behalf of Alan Gauld via Tutor <tutor@python.org> Sent: Friday, October 6, 2017 10:05:27 AM To: tutor@python.org Subject: Re: [Tutor] Tkin

Re: [Tutor] ctypes wintypes

2017-10-04 Thread Alan Gauld via Tutor
On 04/10/17 04:12, Michael C wrote: > Is there a module that does this for me? > If it exists, how do I find it? Google is your friend. What you need to remember is that modules only get created if someone else has the same need as you. And usually if its a repeated need since it takes time and

Re: [Tutor] script guidelines

2017-10-03 Thread Alan Gauld via Tutor
On 03/10/17 09:48, renukesh nk wrote: > requirement: > i have a directory , that contains multiple sub directories, each sub > directory has multiple text and log files, my script fetches the required > lines from all the sub directories and stores it in one text file. > I'm not too sure what

Re: [Tutor] I am trying to create a list of object and want to display that list on the screen on my Tkinter screen

2017-10-04 Thread Alan Gauld via Tutor
On 04/10/17 14:40, edmundo pierre via Tutor wrote: > Hello, > I am writing a code When posting code please use plain text. HTML gets mangled so we can't see what your code looks like.(see below) > where I am using a empty list and I will fill up that > list with object. Then  I will show those

Re: [Tutor] Tree again: iterator, yield, increase (treelib)

2017-10-14 Thread Alan Gauld via Tutor
On 14/10/17 16:44, Chris wrote: > I've a question about treelib library from pip. The list focus is the language and standard library so if you want to ask about other code you need to give us more context. treelib is not a commonly discussed module, in fact this the first mention I've seen. >

Re: [Tutor] Tkinter's Documentation

2017-10-06 Thread Alan Gauld via Tutor
On 05/10/17 17:38, adil gourinda wrote: > Where can i find the reference documentation of "Tkinter" Tkinter is a module, not part of the language, so it is documented in the modules section. But the documentation is not 100% complete and for details you often need to look at the Tk/Tcl

Re: [Tutor] script guidelines

2017-10-06 Thread Alan Gauld via Tutor
On 06/10/17 11:07, renukesh nk wrote: > currently m using pycharm , interpreter = python 3.6 > i am getting th error as below, what might be the reason for this. > > UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 159: > character maps to It looks like you have a

Re: [Tutor] Windows Memory Basics

2017-10-17 Thread Alan Gauld via Tutor
On 17/10/17 00:53, Michael C wrote: > ah, i am bummed completely haha. > > Is there a way to tell which parts a variables so I can scan it? > Maybe you could point me to some reading materials? There are some rules about where programs store data within their memory space, but typically that

Re: [Tutor] Windows Memory Basics

2017-10-17 Thread Alan Gauld via Tutor
On 17/10/17 01:02, Michael C wrote: > that is, one number, can be truncated and exist in multiple locations like > this > > double = 12345678 > > 123 is at x001 > 45 is at x005 > 678 is at x010 That won't happen, a single variable will always be in a a single area. But the representation

Re: [Tutor] problems using a listbox

2017-10-17 Thread Alan Gauld via Tutor
On 17/10/17 07:25, Chris Roy-Smith wrote: > I am trying to learn how to use a tkinter listbox. When I execute my > experimental code, an odd index is printed immediately (output below > code), index looks wrong (shouldn’t it be an integer). You pass in the widget so thats what gets printed

Re: [Tutor] problem with program

2017-10-13 Thread Alan Gauld via Tutor
On 13/10/17 18:53, Alan Gauld via Tutor wrote: > On 13/10/17 13:04, Chris Coleman wrote: > >> def_init_(self,chat): > >> File "scripts/bird.py", line 4 >> def_init_(self,chat): >> ^ >> SyntaxError: invalid

Re: [Tutor] How to test for the existence of a table in a sqlite3 db?

2017-10-14 Thread Alan Gauld via Tutor
On 14/10/17 06:43, boB Stepp wrote: > table if that table does not exist. Alan suggested using > executescript() to do this. I misunderstood Alan and thought that > this would take a filename and execute it. c.executescript(sqlFile.read()) -- Alan G Author of the Learn to Program web site

Re: [Tutor] Windows Memory Basics

2017-10-16 Thread Alan Gauld via Tutor
On 16/10/17 21:04, Michael C wrote: > I don't understand this part about the memory: And I'm not sure I understand your question but... > if I used VirtualQueryEx to find out if a region of memory is ok to scan, > and it > says it's ok, are the values in the region arranged like this: > >

Re: [Tutor] using while loop for read process memory

2017-10-13 Thread Alan Gauld via Tutor
On 13/10/17 02:58, Michael C wrote: >         end = current_address + mbi.RegionSize - 7 > > then it doesn't complain anymore. I think it's because I ran this in a > while loop with start += 1 > so in the last 7 bytes, I'd be reading past the end of this memory chunk. > > Is this right? Yes,

Re: [Tutor] problem with program

2017-10-13 Thread Alan Gauld via Tutor
On 13/10/17 13:04, Chris Coleman wrote: > def_init_(self,chat): > File "scripts/bird.py", line 4 > def_init_(self,chat): > ^ > SyntaxError: invalid syntax There are two problems here. The first is that you need a space after the def. The second is that

Re: [Tutor] New to Python

2017-09-08 Thread Alan Gauld via Tutor
On 08/09/17 08:35, George Fischhof wrote: > As this is a really frequent question, maybe it would be good to put a > short list (the answers cumulated no more than about 10 websites) into the > welcome message of the Tutor mailing list. The welcome message should be a very short (ideally one

Re: [Tutor] question about calendar module in standard libriary

2017-09-11 Thread Alan Gauld via Tutor
On 11/09/17 11:58, Айнур Зулькарнаев wrote: > So, the question is why not explicitly raise ValueError if > user enters the firstweekday parameter bigger that 6 Its a valid question but you probably need to find the original PEP document to find the answer and that module has been around for a

Re: [Tutor] How to create an object in database only if the object is not already there?

2017-09-11 Thread Alan Gauld via Tutor
On 11/09/17 10:38, GMX wrote: > I am using `pony` orm to write a simple class as my model. pony is not a standard module (indeed I only heard about it from your email) so you are probably best asking on the pony support forum if such exists or via the author. > from pony.orm import Database >

Re: [Tutor] I want to display Integral symbols

2017-09-05 Thread Alan Gauld via Tutor
On 05/09/17 14:29, edmundo pierre via Tutor wrote: > I have been trying to display mathematics symbols on my Tkinter (using > Python) project, > but was not successful So show us what you did. Its hard to figure out what's gone wrong when we can't see your code. And that includes telling us

Re: [Tutor] Help With Python Tasks

2017-09-05 Thread Alan Gauld via Tutor
On 05/09/17 19:25, Ruth Hardy wrote: > I was wondering if you can help me please with these computer science tasks We can help, but we won;t do them for you. > First Task > > Write code do the following things involving strings. Wherever possible, > you should try to incorporate

Re: [Tutor] Fw: I want to display Integral symbols

2017-09-06 Thread Alan Gauld via Tutor
On 06/09/17 08:09, edmundo pierre via Tutor wrote: > So show us what you did. Its hard to figure out what's > gone wrong when we can't see your code:That is what I did: > from sympy import*from tkinter import*from sympy import init_printing > root = >

Re: [Tutor] Select a string

2017-09-06 Thread Alan Gauld via Tutor
On 06/09/17 06:34, Pat Martin wrote: > but my script returns 0. Since they want it to find 2 from the bobob in the > string using "bob in s" doesn't work (it only returns 1). Your code has bugs and Cameron has addressed those along with general advice on how to debug your code in future.

Re: [Tutor] Executing "if :" function on terminal

2017-09-05 Thread Alan Gauld via Tutor
On 05/09/17 08:56, Nathan Kckaiyer wrote: > i have just started learning python. I have repeatedly hit a road > block on my mac os terminal . Everytime i use the "if :" command i > get syntax errors. The problem is that you are somehow executing the Python interpreter prompt in the

Re: [Tutor] How to write database-agnostic python code? (Is this even possible?)

2017-09-13 Thread Alan Gauld via Tutor
On 12/09/17 20:05, boB Stepp wrote: As I continue to read about SQL, one thing jumps out: There are many differences between how SQL statements are implemented usage of SQL. So how does one write one's python program to be DB-agnostic? And if this is impossible, then what is the best way

Re: [Tutor] How is database creation normally handled?

2017-09-10 Thread Alan Gauld via Tutor
On 10/09/17 01:29, boB Stepp wrote: > While reading about SQL, SQLite and the Python module sqlite3, it > appears that I could (1) have a program check for the existence of the > program's database, and if not found, create it, make the tables, > etc.; or, (2) create the database separately and

Re: [Tutor] Standard module sqlite3 or APSW?

2017-09-10 Thread Alan Gauld via Tutor
On 10/09/17 01:56, boB Stepp wrote: > So if all of this is correct, does the documentation at > https://rogerbinns.github.io/apsw/pysqlite.html#pysqlitediffs give an > objective assessment of the differences between pysqlite and APSW? I believe so. I've never used APSW, only read a single web

Re: [Tutor] beginning to code

2017-09-10 Thread Alan Gauld via Tutor
For some reaspon I'm missing the original post so apologies to replying to Senthil instead of the OP directly... >> The code i should try is as following: >> >> while True: >> print ('who are you') >> name = input () >> if name != 'bert': >> continue >>

Re: [Tutor] How to sort float number from big numbers to small numbers?

2017-09-25 Thread Alan Gauld via Tutor
On 25/09/17 04:34, edmundo pierre via Tutor wrote: I am trying to sort float numbers input by an user from the bigger to smaller number. I do not know how to compare float numbers. Any ideas? Thank you! The same way you sort anything else. Using the comparison operations ==, <, >, <=, >=

Re: [Tutor] I want to learn how memory works!

2017-09-30 Thread Alan Gauld via Tutor
On 29/09/17 19:47, Michael C wrote: > Could you point me to a source of information about all the things someone > should know before he starts writing a memory scanner? Not a single source but wikipedia is a good start for anything technical. In particular you need to understand the

Re: [Tutor] Am I missing something obvious about "FizzBuzz"?

2017-10-01 Thread Alan Gauld via Tutor
On 01/10/17 16:09, Steven D'Aprano wrote: >> The fizzbuzz one is definitely a bit too simplistic, but the one >> cited by McConnel (reverse a linked list in C) is typical of >> the kind of question we used. And yes, most candidates failed. > > I would have *no idea* how to traverse a

Re: [Tutor] closing the window through code

2017-10-01 Thread Alan Gauld via Tutor
On 01/10/17 19:36, Max Patient wrote: > my task is to create a password checker and one of the > criteria is to have a quit option. What does the quit do? Quit the login? or quit the application? Based on your subject line I'm assuming just quit the login - but then how would you do anything

Re: [Tutor] Am I missing something obvious about "FizzBuzz"?

2017-10-01 Thread Alan Gauld via Tutor
On 01/10/17 22:39, Marc Tompkins wrote: >>> Probably the best programming test there is look at code >>> that's already been developed, >> >> It is what we did with the bug finding test. > My test was, fortunately for me, not a start-from-scratch FizzBuzz problem, > but debugging a report

Re: [Tutor] Am I missing something obvious about "FizzBuzz"?

2017-10-01 Thread Alan Gauld via Tutor
On 01/10/17 06:56, boB Stepp wrote: > I definitely was *not* looking for a pat on the back. I just could > not believe that "FizzBuzz" (Or similar questions.) would ever be > needed in a job interview for programming/software engineering. The fizzbuzz one is definitely a bit too simplistic,

Re: [Tutor] Beginner's guessing game

2017-10-01 Thread Alan Gauld via Tutor
On 01/10/17 09:38, Steve Lett wrote: > Can u please tell me why this program does not work in line 28? That is > guessesTaken. It reads 0 when it should be a larger number. > > I am a beginner having another try to get it! > > Thank you, Steve Welcome Steve, but I can't see any program? Did

Re: [Tutor] Most common words in a text file

2017-10-01 Thread Alan Gauld via Tutor
On 30/09/17 18:12, Sri G. wrote: > import sysimport collections I assume that should be two lines? But you can also import multiple modules on a single line. import sys, collections Although some folks don't like that style. > def find_most_common_words(textfile, top=10): > ''' Returns

Re: [Tutor] Python programming for the absolute beginner

2017-09-29 Thread Alan Gauld via Tutor
On 29/09/17 08:51, Peter Collidge wrote: > I have borrowed the above book from my local library but I believe it was > written in 2010 and as a result I am having difficulty in deciding which > version of Python to download. > Can anyone help? If you want to follow the book use the version the

Re: [Tutor] Directory Structure

2017-09-29 Thread Alan Gauld via Tutor
On 29/09/17 18:02, Chris wrote: > I'd like to store a directory tree in a python script. That doesn't make much sense. A directory tree is stored on the hard disk. A python script is the source code to a program you execute What do you mean by "store the directory tree in the script"? Do you

Re: [Tutor] problem with python3.5 headfirst python 2nd ed chpt 10 test drive example decorator issues

2017-09-29 Thread Alan Gauld via Tutor
On 28/09/17 23:35, peter wrote: > I am on chapter 10 of headfirst python second edition. got most of the > prior codes to work but am stuck on this one. I don;t know the book and only vaguely know Flask, but I'd start by adding some debug print statements to the functions. Something like def

Re: [Tutor] Directory Structure

2017-09-29 Thread Alan Gauld via Tutor
On 29/09/17 20:34, Chris wrote: > I want to store some kind of representation of the tree in memory when > the code runs. Then I could not only move the mails but also create > lists, e.g. a table with mail headers. Thanks for the extra detail but... Probably the reason you can't find any

Re: [Tutor] Does matplotlib.finance still work?

2017-08-24 Thread Alan Gauld via Tutor
On 24/08/17 14:51, C W wrote: > I have the following code, I get an error at the first line. So don't make us guess. What is the error(full text please)? > from matplotlib.finance import quotes_historical_yahoo_ochl And what does a dir() show for matplotlib.finance? Are you sure the name is

Re: [Tutor] When to use classes

2017-08-22 Thread Alan Gauld via Tutor
On 20/08/17 02:08, Steven D'Aprano wrote: > Raymond Hettinger has a good video presentation about the use of classes > and inheritance for delegating work. (That is not to be confused with > delegation as an alternative to inheritance.) No, but I think it would have been useful if he had made

Re: [Tutor] How to use subprocess module to get current logged in user?

2017-08-26 Thread Alan Gauld via Tutor
> My objective: Determine who the currently logged in user is and > determine if that user is in my list of users that I have authorized > to use my programs. In addition to Steve and Mats answers: import os os.getlogin() #-> 'alan' os.getuid() #-> 1001 import pwd pwd.getpwuid(os.getuid())

Re: [Tutor] easygui

2017-08-27 Thread Alan Gauld via Tutor
On 27/08/17 03:07, George Sconyers via Tutor wrote: > Hello all. Need some help with easygui which my son is trying to run for a > book he is working in. I'm not sure what the current status of easygui is, I read somewhere that it had been discontinued. But if you are still finding a download

Re: [Tutor] Does matplotlib.finance still work?

2017-08-25 Thread Alan Gauld via Tutor
On 25/08/17 15:19, C W wrote: > I did not mean to leave out the error message, it was very long. That just means it has a lot of information in it :-) > I think the package has been removed. I don;t think so based on the traceback... quotes = quotes_historical_yahoo_ochl('APX', start,

Re: [Tutor] help with subprocess module

2017-08-19 Thread Alan Gauld via Tutor
On 19/08/17 11:13, kay Cee wrote: > import subprocess > import time > import datetime > > class UpdateError(Exception): > pass In defining your own type of Exception you implicitly say that you will be raising it somewhere. But you never raise this exception in your code... > def update():

Re: [Tutor] When to use classes

2017-08-19 Thread Alan Gauld via Tutor
On 19/08/17 17:00, boB Stepp wrote: > I try to keep this in mind. Another thing I'm currently struggling > with is when to use inheritance vs. separate, independent classes. The golden rule is if the child is not a kind-of the parent then it should be delegation not inheritance. Never use

Re: [Tutor] When to use classes

2017-08-20 Thread Alan Gauld via Tutor
On 20/08/17 02:47, Steven D'Aprano wrote: > since then feels like going back to the Dark Ages. Having to care about > low-level details like creating buttons, installing callbacks and so > forth just feels wrong. To be fair most GUI frameworks come with a GUI builder that remove the manual

Re: [Tutor] Problems Plotting in 3D

2017-08-31 Thread Alan Gauld via Tutor
On 31/08/17 07:18, Kendall Evans wrote: > I am calculating the youngs modulus for a crystal > Find S=inv(C) > Modulus = S(1,1)^-1 I assume you will be using SciPy for this? There are dedicated fora for SciPy stuff where you might find someone who has been down

Re: [Tutor] Python 3 for Beginners was: (Re: intro book for python)

2017-09-03 Thread Alan Gauld via Tutor
On 03/09/17 11:02, Leam Hall wrote: > Anyone that uses python on Linux has to use Python 2. Errr, nope. I use python 3 on Linux all the time. My last significant Python 2 program was about 4 years ago. It may be true that the distro maintainers are still using python 2 for historical reasons

Re: [Tutor] using while loop for read process memory

2017-10-08 Thread Alan Gauld via Tutor
On 08/10/17 20:18, Michael C wrote: > This is the red part  >   index = current_address >         end = current_address + mbi.RegionSize > >         while index < end: >             if ReadProcessMemory(Process, index, ctypes.byref(buffer), \ >                                  

Re: [Tutor] ctypes wintypes

2017-10-03 Thread Alan Gauld via Tutor
On 03/10/17 22:30, Michael C wrote: > I am trying to create SYSTEM_INFO structure and MEMORY_BASIC_INFORMATION > structure > > I think there are modules for this purpose? Is it the ctypes.wintypes? wintypes does define many of the standard Win32 API types but sadly neither of the two you

Re: [Tutor] (no subject)

2017-10-03 Thread Alan Gauld via Tutor
On 03/10/17 22:49, steve.lett...@gmail.com wrote: > That is guessesTaken. It reads 0 when it should be a larger number. What makes you think so? You never increase it from its initial value so, quite correctly it stays at zero. > I am a beginner having another try to get it! Remember the

Re: [Tutor] Tkinter's Documentation

2017-10-06 Thread Alan Gauld via Tutor
ject, for this reason why I asked for an alternative. Sorry if my first message was not so clear -- From: Tutor <tutor-bounces+rikudou__sennin=outlook@python.org> on behalf of Alan Gauld

Re: [Tutor] sibling import

2017-10-12 Thread Alan Gauld via Tutor
On 12/10/17 12:15, Atar new wrote: > Here is my problem. I want to use sibling import but it is not working . I > know taht if we add the directory in sys.path ,it will work. > Why not put the package in the same folder as your top level script? I think that should work. > But I have to

Re: [Tutor] Variable list problem

2017-10-12 Thread Alan Gauld via Tutor
On 12/10/17 22:29, Le Mar wrote: > hi i'm wondering if anyone could help me with this exercise: > We can give you tips but we don;t do your homework for you. > 1. Read an integer number from the console, store the result in a variable > n > 2. Read ‘n’ integers from the console and store

Re: [Tutor] How to test for the existence of a table in a sqlite3 db?

2017-10-19 Thread Alan Gauld via Tutor
On 18/10/17 21:09, Albert-Jan Roskam wrote: > > On Oct 16, 2017 15:12, Neil Cerutti wrote: >> sqlite3 module. In sqlite modifying table definitions is limited >> to the simple addition of a new row of data. > > Really? How so? I used ALTER TABLE ADD COLUMN the other day,

Re: [Tutor] Coding question: How to call a function when the function is assigned a variable

2017-10-23 Thread Alan Gauld via Tutor
On 23/10/17 01:40, Historitical Show wrote: > Here is what I have so far: > > import time > coins = 0 > score = 0 > cptype = 1 > start = time.time() > end = time.time() Note that you are setting start and end to almost identical times and never change then later. > def main(): > global

[Tutor] Fwd: Re: (no subject)

2017-11-12 Thread Alan Gauld via Tutor
Forwarding to the list... From: RRRoy BBBean <rrroybbb...@gmail.com> Organisation: DDDead MMMail To: Alan Gauld <alan.ga...@yahoo.co.uk>, tutor@python.org On Sun, 2017-11-12 at 23:06 +, Alan Gauld via Tutor wrote: > On 12/11/17 15:54, 劉權陞 wrote

[Tutor] Updates to web tutor

2017-11-15 Thread Alan Gauld via Tutor
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

Re: [Tutor] failed installation of Python 2.7

2017-11-26 Thread Alan Gauld via Tutor
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

Re: [Tutor] Python

2017-11-30 Thread Alan Gauld via Tutor
On 30/11/17 08:20, Jeroen van de Ven wrote: > Hello, > Can you build these 4 programms for me? Nice try. The answer is yes we can, but no we won't. You wouldn't learn anything if we did and this list is here to teach. That means you need to write the code and we will offer help and suggestions.

Re: [Tutor] problem with a sub-class

2017-11-30 Thread Alan Gauld via Tutor
On 30/11/17 15:37, Shall, Sydney wrote: > My problem is with constructing a sub-class. > > My sub-class is constructed as follows: > > import Population_ProductivityV24 as POCWP Note that POCWP is an alias for the *module* Population_ProductivityV24. It is not a class. > line 27 : class

Re: [Tutor] calling function

2017-11-27 Thread Alan Gauld via Tutor
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) >

Re: [Tutor] Need help fixing some code for a project

2017-11-27 Thread Alan Gauld via Tutor
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

Re: [Tutor] failed installation of Python 2.7

2017-11-28 Thread Alan Gauld via Tutor
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

Re: [Tutor] get javascript output data from ssi file

2017-11-28 Thread Alan Gauld via Tutor
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

Re: [Tutor] Problem with 'IF' condition

2017-12-04 Thread Alan Gauld via Tutor
;. > But it doesnot. >   > Please let me know if you find any errors. >   > Best Regards, > Achyut Ajmera  >   >   > > - Original Message - > Subject: Re: [Tutor] Problem with 'IF' condition > From: "Alan Gauld via Tutor" <t

Re: [Tutor] Writing data to JSON Help

2017-12-15 Thread Alan Gauld via Tutor
On 15/12/17 18:46, Lloyd Walker wrote: > I'm currently using string formatting to create the json rather than > creating a dictionary and appending that dictionary to file via the JSON > lib. That's probably your mistake. The standard library is there to help you get difficult things right.

Re: [Tutor] Problem python script

2017-12-19 Thread Alan Gauld via Tutor
On 19/12/17 09:47, Antoan Hristov wrote: > I am using a script which extracts data from internet every Monday, but > sometimes I have a problem that the script is not finishing properly. In > terminal I stop it with Ctrl-C and the message it gives me is: It is very hard to comment on code which

Re: [Tutor] When do you know you're ready to start applying for jobs?

2017-12-14 Thread Alan Gauld via Tutor
On 14/12/17 20:30, Matthew Ngaha wrote: > direction on where I can learn about the principles of system design. > Also why isn't this taught in beginner tutorials, or is it an advanced > concept? It's advanced compared to programming, but there are lots of books on the subject, especially OO

<    3   4   5   6   7   8   9   10   11   12   >