Re: [Tutor] Case Insensitive Globing

2019-05-18 Thread Alan Gauld via Tutor
On 18/05/2019 03:14, Richard Damon wrote: > The same directory, running the same program under Mac OS X, which also > is a case insensitive file system, That is your mistake. Darwin, the core of the MacOS X system is a version of BSD Unix and like all Unix OS is very much case sensitive. Some

Re: [Tutor] simple question about scope

2019-05-18 Thread Alan Gauld via Tutor
On 18/05/2019 09:20, marcus lütolf wrote: > in learning the principles of Python I came across scope in the > control structure's section. > There I read the notion that variables createted inside a > control structute can't be seen or accessed from outside that > structure, Python would raise a

Re: [Tutor] Looking for some direction

2019-05-17 Thread Alan Gauld via Tutor
On 16/05/2019 04:17, Alex Kleider wrote: >> Alt-Tab and the X cut 'n paste mechanism provides >> enough integration between windows. > > I tried this (Ubuntu 18.4) and Alt-Tab cycles between terminal and > browser but I can't make it cycle from one terminal to another. How do > you do that?

Re: [Tutor] Looking for some direction

2019-05-12 Thread Alan Gauld via Tutor
On 12/05/2019 23:19, boB Stepp wrote: > I may be mistaken, but I think that a terminal multiplexer like tmux > (https://github.com/tmux/tmux/wiki) is capable of session management. > I have no personal use of tmux, but have been intrigued enough about > others referring to it that eventually I

Re: [Tutor] What is this code doing? What is it?

2019-05-12 Thread Alan Gauld via Tutor
On 12/05/2019 12:31, Matthew Polack wrote: > result = str(' Cost: ' + '${:.2f}'.format(cost)) > > But I don't understamd what the curly brace part is actually doing: > ..curly braces apparenly are for dictionaries...but I don't get how this is > a dictionary..or what this {:} command is

Re: [Tutor] Collating date data from a csv file

2019-05-12 Thread Alan Gauld via Tutor
On 12/05/2019 11:27, Dave Hill wrote: > I found out by accident that the Megger PAT 420 data backup is actually > an SQLite database, so that is my route for access. Having played with > Python on Raspberry Pi's, I thought I would explore Python for data > processing, and now, I have a set of

Re: [Tutor] Looking for some direction

2019-05-12 Thread Alan Gauld via Tutor
On 12/05/2019 10:15, David L Neil wrote: > Interestingly, I split these into two - my laziness for running/testing > is 'Save, Alt-Tab, Up-arrow, Enter' which would be 'ruined' by using the > cmdLN for anything else. In a bash shell I use Ctr-R (for reverse search) and hit py to run the last

Re: [Tutor] Local variable look up outside the function and method

2019-05-12 Thread Alan Gauld via Tutor
On 12/05/2019 14:04, Arup Rakshit wrote: The first case x is a global variable - which in Python really means module level. In the second case you have placed it inside Foo so you need to specify that that is where it is located. Classes encapsulate their own methods and attributes, that is one

Re: [Tutor] Looking for some direction

2019-05-12 Thread Alan Gauld via Tutor
On 12/05/2019 00:24, David L Neil wrote: > "3 consoles": what is the purpose of each? > (my first reaction stemmed from many editors including a built-in console) One for vim, One for the Python interpreter One for an OS shell used for running/testing the app plus any miscellaneous Unixy type

Re: [Tutor] Looking for some direction

2019-05-11 Thread Alan Gauld via Tutor
On 11/05/2019 19:59, Cranky Frankie wrote: > I'm a long time IT professional trying to teach myself object-oriented > programming. As such I want to build a traditional PC app using MVC (Model > - View - Controller) architecture. One important thing to realoze about MVC is that there are very

Re: [Tutor] Collating date data from a csv file

2019-05-09 Thread Alan Gauld via Tutor
On 09/05/2019 14:06, Dave Hill wrote: > Thank you, I now have > > defaultdict(, {736697: 10, 736677: 14, 736980: 9, 737109: > 50, 736919: 15, 736652: 19, 736502: 14, 736710: 2, 736674: 6, 736672: 5, > 736933: 2, 736932: 6, 736658: 7, 736671: 5, 736499: 6, 736707: 4, > 737181: 4, 736686: 2, ...

Re: [Tutor] don't steel my code Mister user

2019-05-04 Thread Alan Gauld via Tutor
On 04/05/2019 15:35, nathan tech wrote: > It has to be said, after extensive research, and responses here, it > seems python was just not designed to be a commercial product. That depends. Python wasn't designed to be a commercial product in that it is an open source programming language and

Re: [Tutor] don't steel my code Mister user

2019-05-04 Thread Alan Gauld via Tutor
On 04/05/2019 00:45, nathan tech wrote: > There are tools like py2exe and pyinstaller that are able to compile > your python code into .exe format. > > but why bother? It's easier and more convenient to distribute a single .exe file than a swathe of individual .py or .pyc files. It also

Re: [Tutor] pip issue

2019-05-03 Thread Alan Gauld via Tutor
On 03/05/2019 17:11, Anil Duggirala wrote: >> Try this (as _yourself_, not as root): >> >>   pip3 install --verbose --user 'aiorpcX<0.18,>=0.17.0' > > I tried this and got a lot of messages like: ... > 9a0d86eb (from https://pypi.org/simple/aiorpcx/) (requires- > python:>=3.6) is incompatible

Re: [Tutor] self.name is calling the __set__ method of another class

2019-05-02 Thread Alan Gauld via Tutor
On 02/05/2019 16:25, Arup Rakshit wrote: > such frustrated abstractions. :) I don't know why python exposed so many > things, Because by exposing it those few who do need to play with the internals can(*). Most of us just ignore it > Python doesn't work the way I am thinking it, and I am far

Re: [Tutor] execute_from_command_line(sys.argv)

2019-05-01 Thread Alan Gauld via Tutor
On 01/05/2019 20:08, Miguel Angel Ramos Herrera via Tutor wrote: > This line of code gives me an error I assume you mean this line: execute_from_command_line(sys.argv) But that's not a line of standard Python so I can only assume that this is a function that you have defined yourself. But

[Tutor] Fwd: Re: feedparser in python

2019-04-30 Thread Alan Gauld via Tutor
r, so am not quite used to having back and forth like these yet. Especially not with someone who knows what they're talking about. :) Thanks Nate On 30/04/2019 08:47, Alan Gauld via Tutor wrote: > On 30/04/2019 00:23, nathan tech wrote: > >> The results were as follows: >> >> ??

Re: [Tutor] feedparser in python

2019-04-30 Thread Alan Gauld via Tutor
On 30/04/2019 00:23, nathan tech wrote: > The results were as follows: > >     tim( a url): 2.9 seconds > >     tim(the downoaded file(: 1.8 seconds > > > That tells me that roughly 1.1 seconds is network related, fair enough. Or about 30% of the time. Since the network element will

Re: [Tutor] feedparser in python

2019-04-29 Thread Alan Gauld via Tutor
On 29/04/2019 01:26, nathan tech wrote: > Most recently, I have started work using feedparser. I've never heard of it let alone used it so there may be another forum where you can get specific answers. But let me ask... > I noticed, almost straight away, it's a  bit slow. How do you measure

Re: [Tutor] Help request ERROR installing beautifulsoup

2019-04-29 Thread Alan Gauld via Tutor
On 28/04/2019 17:11, Dr. Luca T wrote: ^ > SyntaxError: Missing parentheses in call to 'print'. Did you mean > print("Unit tests have failed!")? > > I use windows 10, python 3.7.3 ... The problem is you are running python

Re: [Tutor] When you think to setup the __class__ of a module object to a subclass of ModuleType

2019-04-28 Thread Alan Gauld via Tutor
On 28/04/2019 15:56, David wrote: > I'm sorry to hear it's such a headache. It sounds like the list > manager interface for that task is dreadful. It should be able to take > you straight to the configuration for the user who wrote the message. Its not that bad but it does involve copying the

Re: [Tutor] urlGET information

2019-04-28 Thread Alan Gauld via Tutor
On 28/04/2019 06:00, Nathan D'Elboux wrote: > import urlGET > # No information on urlGET as of yet > > https://pypi.org/project/urlget/ > > this is a learning exercise for me so how do more experienced python coders > approach modules like this, when you encounter a module that has sparse >

Re: [Tutor] When you think to setup the __class__ of a module object to a subclass of ModuleType

2019-04-27 Thread Alan Gauld via Tutor
On 27/04/2019 01:22, David wrote: > It's no big deal, but I wonder why you wouldn't approve an address > the first time you see that it is being used for legitimate discussion. Time... It takes about 10 seconds to scan a message and click the button to pass it through (or reject it). It takes

Re: [Tutor] When you think to setup the __class__ of a module object to a subclass of ModuleType

2019-04-26 Thread Alan Gauld via Tutor
On 26/04/2019 13:48, Arup Rakshit wrote: > BTW, one thing I would like to know about this list is that, everytime I > send an email I see it the in list after 2 hours approx. Is this for me > or everybody? I am just curious. Just for you! ...And every other new poster :-) It stays on

Re: [Tutor] str.replace error

2019-04-26 Thread Alan Gauld via Tutor
On 26/04/2019 05:29, Steven D'Aprano wrote: > (deliberately? accidently?) run into one of the slightly advanced > corners of Python: unbound methods. Ooh, good catch. I completely forgot that the string class' name is str... That's why he didn't get a name error... -- Alan G Author of the

Re: [Tutor] str.replace error

2019-04-25 Thread Alan Gauld via Tutor
On 25/04/2019 18:46, Roger Lea Scherer wrote: > Here is my code: > > import csv > > with open('somefile') as csvDataFile: > csvReader = csv.reader(csvDataFile) > for row in range(100): what happens if there are more rows in the file than 100? Or even if there are less!? > a =

Re: [Tutor] help with colormode

2019-04-25 Thread Alan Gauld via Tutor
On 25/04/2019 11:54, Mark Alderson wrote: > tried screen.colormode(255) Peter has shown you how to make that work but there is a wee issue below I need to point out. > -code- > from turtle import Turtle > t = Turtle() > t.speed(0) > > b = 180

Re: [Tutor] When you think to setup the __class__ of a module object to a subclass of ModuleType

2019-04-24 Thread Alan Gauld via Tutor
On 24/04/2019 12:22, Arup Rakshit wrote: > In the simple code like what are the advantages we get from? I'm not really sure what you are asking about? > Is this so that we can implement more special methods > than just __getattr__ and __dir__ in the module level? Is it just the inheritance

Re: [Tutor] Syntac Error

2019-04-24 Thread Alan Gauld via Tutor
On 24/04/2019 00:31, Bob Griffin wrote: > Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit (Intel)] > on win32 > Type "copyright", "credits" or "license()" for more information. print("Game Over") > Game Over > When I run the program and get a syntac error invalid

Re: [Tutor] What protocol to follow when need to pick either one from __getattr__ and __getattribute__ ?

2019-04-23 Thread Alan Gauld via Tutor
On 23/04/2019 15:52, Arup Rakshit wrote: > If I replace __getattr__ with __getattribute__ I found the program works > exactly same. Now my questions is in real world when  you have to pick > between these 2 pair of special method which protocols a Python dev > checks to pick either of the one?

Re: [Tutor] Question on implmenting __getitem__ on custom classes

2019-04-23 Thread Alan Gauld via Tutor
On 23/04/2019 07:16, Arup Rakshit wrote: > which way the community encourages more in Python: if isinstance(key, > slice): or if type(key) == slice: ? I think isinstance is usually preferred although I confess that I usually forget and use type()... But isinstance covers you for subclasses too.

Re: [Tutor] Question about the object.__del__(self) method

2019-04-22 Thread Alan Gauld via Tutor
On 22/04/2019 10:18, Arup Rakshit wrote: > Consider the below in simple class: > > class RandomKlass: > def __init__(self, x): > self.x = x > > def __del__(self): > print("Deleted…") > > Now when I delete the object created from RandomKlass using `del` operator I >

Re: [Tutor] Trouble with SUM()

2019-04-21 Thread Alan Gauld via Tutor
On 20/04/2019 21:51, Ju Bo wrote: > Hi, I'm trying to write a program that uses a while loop to ask a user for > multiple values then use the program to add all the values, however many > there may be, then print the sum. Your code very nearly does that, it just needs a slight tweak. > I'm

Re: [Tutor] pygame help please

2019-04-18 Thread Alan Gauld via Tutor
On 18/04/2019 15:16, fatima butt wrote: > however the following error is coming: > Traceback (most recent call last): > File "C:\Users\ammah\OneDrive\Documents\project1\myCode.py.py", line 304, > in > draw_lives(screen,WIDTH - 100,5, player.lives, player_mini_img) > File

Re: [Tutor] Off-Topic: Tutor group specific to Java

2019-04-17 Thread Alan Gauld via Tutor
On 17/04/2019 16:29, Karthik Bhat wrote: > This is kind of off-topic, but I would really appreciate it if > anyone could provide me with a tutor mailing list/group specific to Java. > I am a beginner, and it would be really helpful for me. While thee are similar groups for some other

Re: [Tutor] Fwd: uploading images in pygame

2019-04-17 Thread Alan Gauld via Tutor
On 17/04/2019 10:14, fatima butt wrote: > the python version is 3.7.3 > computer is acer SWIFT > The error I get is following: > Traceback (most recent call last): > File "C:\Users\ammah\OneDrive\Documents\project1\myCode.py.py > ", line 84, in > background =

Re: [Tutor] Fwd: IDLE Terminal

2019-04-16 Thread Alan Gauld via Tutor
On 16/04/2019 20:54, fatima butt wrote: > [image: image.png]please I need help with IDLE teminal..its giving me error. The mail server drops attachments because they are a potential security threat. Please post the error text (cut 'n paste if possible) Also describe what you are trying to do.

Re: [Tutor] Fwd: uploading images in pygame

2019-04-16 Thread Alan Gauld via Tutor
On 16/04/2019 20:54, fatima butt wrote: > please i am getting error.. Hi, we need to be quite specific here about the details because it is not clear exactly what you are trying to do. > i am trying to upload image from openspaceart > from internet . Just to be clear. Uploading means going from

Re: [Tutor] Problem with Saved File

2019-04-06 Thread Alan Gauld via Tutor
On 05/04/2019 19:59, Stephen P. Molnar wrote: > I am using Spyder v-3.3.3 on Debian Stretch and have written a script to > process data from another application. I am having a problem saving the > resulting file [A] as a column vector. > > The vector is saved by np.savetxt(name_s,[A]). > >

Re: [Tutor] What is the correct way of signalling and slots in PyQt5?

2019-04-03 Thread Alan Gauld via Tutor
On 03/04/2019 09:57, Ali M wrote: > The application crashes without errors every time any signal is called It's very unusual to get no errors at all. How are you running it? Are you using an OS terminal? It may be that you are simply not seeing the errors... However... This list is for the core

Re: [Tutor] Encrypting shipped sqlite db in app directory

2019-03-30 Thread Alan Gauld via Tutor
On 30/03/2019 07:22, Alan Gauld via Tutor wrote: > On 29/03/2019 18:01, Ali M wrote: >> I want to encrypt my sqlite databases which are shipped with the app in >> it's directory, so that the user can't modify or use it elsewhere, and they >> will only be accessible for the

Re: [Tutor] Encrypting shipped sqlite db in app directory

2019-03-30 Thread Alan Gauld via Tutor
On 29/03/2019 18:01, Ali M wrote: > I want to encrypt my sqlite databases which are shipped with the app in > it's directory, so that the user can't modify or use it elsewhere, and they > will only be accessible for the app to read from, how can i do that? It all depends on how rigorous you want

Re: [Tutor] cant get it to run right

2019-03-28 Thread Alan Gauld via Tutor
On 28/03/2019 23:55, Sveum, Christian wrote: > I am new and I have tried everything I can think I of. I want it to run like > a converstion. Its always good to be as specific as possible. What exactly do you mean by "can't get it to run right"? Does it crash? Do you get an error message? If so

Re: [Tutor] Help with code

2019-03-28 Thread Alan Gauld via Tutor
On 28/03/2019 21:12, lucasbreault2...@gmail.com wrote: > I’m trying to make a password that must contain a number in it. I assume you mean you want to check whether a password has a number in it? Does it need to be a single digit or can there be multiple? > Which method do I use for that?

Re: [Tutor] issues running python

2019-03-26 Thread Alan Gauld via Tutor
On 26/03/2019 21:41, Drew Jakala wrote: > Hello, > I'm having issues running python and sublime on my computer. Every time I > try to run either one I get an error message that looks something like this: > "Traceback (most recent call last): > File "", line 1, in > python > NameError: name

Re: [Tutor] [OT] Problem with auto-complete package installation in Atom [Was: Re: After virtualenv, how to use ide]

2019-03-24 Thread Alan Gauld via Tutor
On 24/03/19 18:32, boB Stepp wrote: apologize in advance! But that is okay. I am not a professional nor expert programmer myself. Because of this, I recall agonizing over the choice of code editor, or, possibly even worse, deciding whether to use an IDE or editor. This is a difficult

Re: [Tutor] (no subject)

2019-03-22 Thread Alan Gauld via Tutor
On 22/03/19 21:45, Matthew Herzog wrote: I need to tell my script to ignore any filename that does not conform to the standard eight leading numerical characters, example: 20180922 or erased_20171207_1oIkZf.so. Normally we try to dissuade people from using regex when string methods will do

Re: [Tutor] LPTHW ex15 question

2019-03-21 Thread Alan Gauld via Tutor
On 21/03/19 12:43, Jones, Kayla wrote: ...getting an error message in powershell that I can't figure out. > I've attached a screenshot to help. Any suggestions would be appreciated. First suggestion is not to send images as attachments since the server strips them out as potential security

Re: [Tutor] error message

2019-03-21 Thread Alan Gauld via Tutor
On 21/03/19 05:13, Glenn Dickerson wrote: Thank you for all of your responses to: class Student(): def__init__(self, name, major, gpa, is_on_probation): self.name = name self.major = major self.gpa = gpa self.is_on_probation = is_on_probation

Re: [Tutor] is there a graphics library for common tkinter Button functions?

2019-03-21 Thread Alan Gauld via Tutor
On 21/03/19 00:28, Chris Roy-Smith wrote: Yes I knew that buttons need a function to do anything. I was hoping that the wheel didn't need re-inventing. So far as the button images go a Google search should throw up lots of free icons you can use and a program like ImageMagick can resize

Re: [Tutor] is there a graphics library for common tkinter Button functions?

2019-03-20 Thread Alan Gauld via Tutor
On 20/03/19 22:43, Chris Roy-Smith wrote: Is there a "graphics library" of common button uses? that is things like forward record, back record, 1st record, last record, printer, save and the likes. The short answer is no. But you can assign any bitmap image to a button. (You can use other

Re: [Tutor] Help

2019-03-20 Thread Alan Gauld via Tutor
On 20/03/19 14:30, Eric Oh Yeah Yeah wrote: How do I make Python 3 pick a random variable out of a set of variables I give it? There are several options but if you look in the random module you should find one that suits your particular needs. choice() or randrange() may be good options.

Re: [Tutor] Merge a dictionary into a string

2019-03-16 Thread Alan Gauld via Tutor
On 16/03/2019 18:44, Peter Otten wrote: > > In Python 3.6 and above you can use f-strings: > d = dict(a="hello", b="world") " ".join(f'{k} "{v}"' for k, v in d.items()) > 'a "hello" b "world"' Cool, I'd missed f-strings. Time for some reading Thanks Peter, -- Alan G Author of

Re: [Tutor] Merge a dictionary into a string

2019-03-16 Thread Alan Gauld via Tutor
On 16/03/2019 17:39, Valerio Pachera wrote: > I wish to get a single string like this: > > 'a "hallo" b "world"' > > Notice I wish the double quote to be part of the string. > In other words I want to wrap the value of a and b. When dealing with string layouts I tend to go to string

Re: [Tutor] (no subject)

2019-03-16 Thread Alan Gauld via Tutor
On 16/03/2019 01:54, Glenn Dickerson wrote: > class Student(): > > def__init__(self, name, major, gpa, is_on_probation): > self.name = name > self.major = major > self.gpa = gpa > self.is_on_probation = is_on_probation > > > import Student > student1 =

Re: [Tutor] Question for tutoring page

2019-03-13 Thread Alan Gauld via Tutor
On 11/03/2019 16:10, Diana Katz wrote: > What is the best way to ..program using python - that could recognize > a 3D object and then rank drawings of the object as to which are more > accurate. I notice nobody has responded so I thought I'd let you know your mail was received. Unfortunately

Re: [Tutor] How to create a structure from a Log file

2019-03-09 Thread Alan Gauld via Tutor
On 09/03/2019 13:08, Asad wrote: >I would like to know , how can I approach this problem to create > a easy structure from the logfile using python so I can review the logfiles > quite efficiently . Please share suggestion tip or already written codes. That depends on several things:

Re: [Tutor] Tkinter: Can's figure out how to put a frame in a second window

2019-03-09 Thread Alan Gauld via Tutor
On 09/03/2019 02:53, Chris Roy-Smith wrote: > What is happening is that the contents of the frame appear in the master > window. I was expecting them to show in the second window. Also I > expected the frame to be sunken, but there is no obvious signs of the > frame, not even a colored

Re: [Tutor] directory structure with tests?

2019-03-06 Thread Alan Gauld via Tutor
On 06/03/2019 22:38, Mats Wichmann wrote: > "It depends". ... > How's that for a definitive answer? :) Pretty good! and I agree with all of it :-) Although personally I always use a test subdirectory and then, for building a distributable, use a file filter (eg find in *nix) to prune those

Re: [Tutor] how to get the weeks of a month

2019-03-04 Thread Alan Gauld via Tutor
On 04/03/2019 22:30, Ben Finney wrote: > john fabiani writes: > >> My understanding is - a week starts on Monday and ends on Sunday. > > That's behaviour specific to a timezone. Which one are you using, and > does your program know to consult the timezone data for when a week > begins and ends?

Re: [Tutor] how to get the weeks of a month

2019-03-04 Thread Alan Gauld via Tutor
On 04/03/2019 18:54, john fabiani wrote: > I need to print out the weeks of the month - given any month and any year. > I'm not totally clear how you define a week. In your example the first week starts on Friday and ends on Sunday. Subsequent weeks start on Monday and run to Sunday. So, is

Re: [Tutor] My problem in simple terms

2019-03-04 Thread Alan Gauld via Tutor
On 04/03/2019 11:44, Edward Kanja wrote: > Hi there , > Earlier i had sent an email on how to use re.sub function to eliminate > square brackets. I have simplified the statements. Attached txt file named > unon.Txt has the data im extracting from. Thankyou, that's much better. Although the code

Re: [Tutor] Python Regular Expressions (Re.sub) Function

2019-03-04 Thread Alan Gauld via Tutor
On 04/03/2019 08:04, Edward Kanja wrote: > ... Unfortunately after i extract the data > my output has too much of square brackets and by so doing the output cant > be well exported in a csv file. I can't see the data so can't be definitive but the number of square brackets shouldn't affect a CSV

Re: [Tutor] systemd

2019-03-03 Thread Alan Gauld via Tutor
On 03/03/2019 14:46, Dave Hill wrote: > on power up, and I thought that I would use 'systemd'. This is really a Linux question not Python so you might like to try the Mint forums too. They are usually pretty responsive. > [Service] > Type=idle > > User=pi > ExecStart=/bin/bash

Re: [Tutor] Exception not working as expected?

2019-03-01 Thread Alan Gauld via Tutor
On 01/03/2019 19:23, Chip Wachob wrote: > I'm not sure what you mean by putting the except close to the int(). He means you should have a try/except for the int conversion, typically something like: # wait for it... try: num_items = int(raw_input(": ")) except ValueError: # try a

Re: [Tutor] Exception not working as expected?

2019-03-01 Thread Alan Gauld via Tutor
why there's no exception listed. On Thu, Feb 28, 2019 at 8:34 PM Alan Gauld via Tutor <[1]tutor@python.org> wrote: On 28/02/2019 21:03, Chip Wachob wrote: > it does work properly in Linux.** So I'm guessing I need to test for a > different excep

Re: [Tutor] Exception not working as expected?

2019-02-28 Thread Alan Gauld via Tutor
On 28/02/2019 21:03, Chip Wachob wrote: > it does work properly in Linux. So I'm guessing I need to test for a > different exception along with the KeyboardInterrupt?? Don't guess, test. Write a single line script raw_input('> ') Run it in a console. Hit Ctrl-C while it waits for input. See

Re: [Tutor] schedulers

2019-02-28 Thread Alan Gauld via Tutor
On 28/02/2019 14:45, nathan tech wrote: > but I'm thinking, should I do this? No. fOr several reasons... > def do_backup >  # backup code here, > > def scheduler(): >  global tus # tus=time until schedule > >  while(time.time()>tus): >   time.sleep(5) >  scheduler() scheduler doesn't

Re: [Tutor] ANSI / VT100 Escape Codes in Windows 7 Environment

2019-02-27 Thread Alan Gauld via Tutor
On 27/02/2019 18:28, Chip Wachob wrote: > Windows 7 vintage machine this morning. Caveat: I have no direct experience on Windows 7 - I jumped from XP to Windows 8... Also I haven't used ANSIO codes in Windows since the heady days of Windows 98! But... > run in the command window in Windows,

Re: [Tutor] Only appending one object to list, when I am expecting more than 1

2019-02-27 Thread Alan Gauld via Tutor
On 27/02/2019 13:25, AdamC wrote: > That's great - bug found. Thanks. However the next question is, how do I > create an instance of a class with variable parameters (i.e. with dateAdded > already computed and stored, or with dateAdded created for the first time)? > > I hope that makes sense.

Re: [Tutor] I flip a coin 1 million times what is the consecutive times it will come up head and come up tails

2019-02-27 Thread Alan Gauld via Tutor
On 27/02/2019 09:35, Abdur-Rahmaan Janhangeer wrote: > maybe try dpaste.de or something like that for code pasting ^^_ That can be useful if it's very long code but this is actually quite a short program and it's much easier to reply to if the code is in the message so I think the OP did the

Re: [Tutor] I flip a coin 1 million times what is the consecutive times it will come up head and come up tails

2019-02-26 Thread Alan Gauld via Tutor
On 26/02/2019 20:34, shaef...@q.com wrote: > I am learning python. I assume you are coming from some other language? If not you have managed to come up with the most convoluted and un-pythonic way imaginable to do a fairly simple task! > I wanted to test my ability by making a program to >

Re: [Tutor] Doubt

2019-02-26 Thread Alan Gauld via Tutor
On 26/02/2019 18:36, Maninath sahoo wrote: > is it possible reverse inheritance? > mean child class to parent class I have no idea what you mean by that. How would it work? Can you give an example of the kind of thing you want to do? For example Circles and Rectangles are kinds of Shape so their

Re: [Tutor] How to use "curses.resizeterm(nlines, ncols)"

2019-02-25 Thread Alan Gauld via Tutor
On 24/02/2019 23:25, boB Stepp wrote: >> Secondarily, resizeterm() does not make a change to the terminal itself. > > I realized this before I sent my original post. I really think the > name chosen, resizeterm, is a very misleading name! Only in a world of GUIs. Remember that curses is pre

Re: [Tutor] How to use "curses.resizeterm(nlines, ncols)"

2019-02-24 Thread Alan Gauld via Tutor
On 24/02/2019 05:00, boB Stepp wrote: > curses.resizeterm(nlines, ncols)¶ > > Resize the standard and current windows to the specified dimensions, > and adjusts other bookkeeping data used by the curses library that > record the window dimensions (in particular the SIGWINCH handler). > > >

Re: [Tutor] Help Please

2019-02-20 Thread Alan Gauld via Tutor
On 20/02/2019 14:30, Mario Ontiveros wrote: > Hello, > I am new to python and have been stuck on this for a while. What I am > trying to do is to remove rows with void, disconnected, and error on lines. > The code I have does that, the only problem is that it removes my header > because

Re: [Tutor] Putting a Bow on It

2019-02-18 Thread Alan Gauld via Tutor
On 18/02/2019 13:41, Chip Wachob wrote: > The code that I've written is entirely Python. There are necessary > libraries that go along with that, and, due to my inexperience, I am not > 100% certain they are pure Python or not. Some of the drivers from the IC > manufacturer (FTDI) are .dll

Re: [Tutor] Python Websocket Server

2019-02-14 Thread Alan Gauld via Tutor
On 14/02/2019 16:44, Simon Connah wrote: > I was wondering what the best practice for writing web socket servers in > Python was in 2019? I can't answer that directly since I've never used web sockets in Python (and only played with them in Java). But... > I found an old example on the web

Re: [Tutor] Good tutorials about Python 2 and 3 OOP by Leonardo Giordani

2019-02-14 Thread Alan Gauld via Tutor
On 14/02/2019 00:30, boB Stepp wrote: > I have stumbled upon some articles by Leonardo Giordani that deal with > OOP in Python. He has two sets of articles. The one concerning > Python 2 is located at: > http://blog.thedigitalcatonline.com/blog/2014/03/05/oop-concepts-in-python-2-dot-x-part-1/

Re: [Tutor] Putting a Bow on It

2019-02-11 Thread Alan Gauld via Tutor
On 11/02/2019 13:48, Chip Wachob wrote: > I realize that choosing a tool is always a case of personal preference. I > don't want to start a 'this is better than that' debate. > > If the 'pros' out there have more input, I'm all ears. To be fair this is not just a Python problem but applies to

Re: [Tutor] regarding minhash and lsh

2019-02-11 Thread Alan Gauld via Tutor
On 11/02/2019 10:10, Alan Gauld via Tutor wrote: >> def minhash(s, prime=4294967311): >> vec = [float('inf') for i in range(N)] >> >> for val in s: >> if not isinstance(val, int): val = hash(val) >> >> for perm_idx, perm_vals in e

Re: [Tutor] regarding minhash and lsh

2019-02-11 Thread Alan Gauld via Tutor
On 11/02/2019 09:13, lokesh kumar wrote: > i want to make a code to run few DNA seg. so that i will be able to find > similarity in them. file are in million as well as seq. are large so i > tried developing program but fails in it i think minhash and lsh can able > to solve my problem. Bear in

Re: [Tutor] text processing lines variable content

2019-02-07 Thread Alan Gauld via Tutor
On 07/02/2019 08:58, ingo janssen wrote: >try: > lbl = f_label(label) >except NameError as e: > lbl = f_number(label) > label=[lbl] Just a minor point but since you aren't doing anything with the error you don't need the 'as e' bit at the end of each

Re: [Tutor] learning python from scratch

2019-02-07 Thread Alan Gauld via Tutor
On 06/02/2019 21:22, Michael Munn wrote: > dear fellow programmeers, this is michael. I have a question for Python. > I'm a beginner Pythonist. I havee been learning the history and it's use > for past years. My main focus this year is to learn it's code and begin > coding. Can you program in any

Re: [Tutor] help

2019-02-05 Thread Alan Gauld via Tutor
On 05/02/2019 14:15, Peter Otten wrote: >> Error: >> ./python2.py: line 1: syntax error near unexpected token `(' > > That is not a Python error, that's a complaint of your shell. Oh, good catch Peter. I never noticed the start of the line I just read the text and saw the weird backtick... --

Re: [Tutor] help

2019-02-05 Thread Alan Gauld via Tutor
On 05/02/2019 12:32, Sonia Miglani wrote: > OS Linux > Python version 2.7.13 Can you tell us how you are creating the file? Which editor are you using? It looks like there may be some spurious characters in your file. > def demo(s, exclaim): > #""" > # Returns the string 's' repeated 3

Re: [Tutor] Recommended Resurce or strategy for beginning students

2019-02-04 Thread Alan Gauld via Tutor
On 04/02/2019 05:14, Matthew Polack wrote: > We had our first lesson today Congrats, hope it goes well. But... > 2.) Another smaller group started to hit the wall... I'm not a professional or trained teacher but over the last 30 years or so I've been involved in classes teaching everything

Re: [Tutor] Webinterface for python script

2019-01-30 Thread Alan Gauld via Tutor
On 30/01/2019 14:06, Asad wrote: > I have created certain python scripts to analyze log files and > suggest solution based on logic which I invoke on the command line . I need > some information on how to execute these through browser . I am using : > > python test.py file1 file2 > >

Re: [Tutor] Not able to get to Script Mode

2019-01-29 Thread Alan Gauld via Tutor
On 29/01/2019 21:07, jetspacejt wrote: > Using version 3.7.1 > Where is File Edit Shell...etc. > Not at the top of my screen Vanilla python is just a language interpreter, it has no GUI. If you want a GUI environment you need to use an IDE - there are dozens to choose from. There is a very

Re: [Tutor] python-files

2019-01-27 Thread Alan Gauld via Tutor
On 27/01/2019 14:57, Asad wrote: > print("first:", args.first) > print("second:", args.second) > > When I execute the script it gives error : > > python python_json_20001_oratest_v1.py "file1" > ('first:', 'file1') > ('second:', None) Note that the second file is None. > Traceback (most

Re: [Tutor] python - files

2019-01-26 Thread Alan Gauld via Tutor
On 26/01/2019 08:20, Asad wrote: >At present I using : > > if len(sys.argv) == 3: > first = sys.argv[1] > second = sys.argv[2] > else: > print "enter the second argument" > It works well for the following command : > python test.py file1 file2 Correct because it tests if

Re: [Tutor] exporting lists into CSV issue.

2019-01-22 Thread Alan Gauld via Tutor
On 22/01/2019 09:25, mhysnm1...@gmail.com wrote: > being exported to the CSV. But when I bring it into Excel. I am getting a > blank row between each row. The exported data looks like this: I can't see anything obvious. > import plistlib, pprint, csv > > with open("library.xml", "rb") as f: >

Re: [Tutor] Recommended Resurce or strategy for beginning students

2019-01-22 Thread Alan Gauld via Tutor
On 22/01/2019 06:57, Matthew Polack wrote: > In our growing school we're teaching Python programming for the first time > as an elective subject with Year 9 and 10 students. (Had a dabble at this > last year with 3 students in Year 11) > > I'm wondering what specific resource or stategy people

Re: [Tutor] Importing XML files.

2019-01-21 Thread Alan Gauld via Tutor
On 21/01/2019 03:17, mhysnm1...@gmail.com wrote: > confused with some XML terminology. > > What is: > Tag – I think it is the in the itunes library file. > > Text = The text between the > > Attrib -- don’t know. You really need to find a tutorial on XML (And maybe even start with one on

Re: [Tutor] Function not using updated variable?

2019-01-21 Thread Alan Gauld via Tutor
On 21/01/2019 00:14, Ello Solcraft wrote: > # currLocation doesn't use the updated variable. > > for x in inputList: > > currCalc.append(x) > currCalc2 = ''.join(currCalc) > currLocation = mapLocation(mapInput(currCalc2))#mapInput(currCalc2)) You haven't hgiven us any

[Tutor] Fwd: Re: Doubt in Python

2019-01-17 Thread Alan Gauld via Tutor
CCing the list. Please use Reply All or Reply List on responses to the list. On 17/01/2019 07:24, Maninath sahoo wrote: a=[100,50,30] b=[100,90,3] a True a>b > False > > > How it compares between two lists > The algorithm is probably described somewhere in the documentation

Re: [Tutor] Doubt in Python

2019-01-16 Thread Alan Gauld via Tutor
On 16/01/2019 18:26, Maninath sahoo wrote: > Using of relational operator i Python? > How to use relational operator in List. > Please answer me.. Relational operators are more commonly called comparisons (or predicates). You use them with a List much as you use any other object. if list1 ==

Re: [Tutor] Running Python 3 on Linux Mint

2019-01-13 Thread Alan Gauld via Tutor
On 13/01/2019 14:47, Cranky Frankie wrote: > I want to start developing an application in Python 3 on my main computer > which runs Linux Mint with Python 2.7. What is the best way to work with > Python 3 on this system? You don't say which Mint version but assuming its 17 or greater then you can

Re: [Tutor] Debugging a sort error.

2019-01-13 Thread Alan Gauld via Tutor
On 13/01/2019 02:16, mhysnm1...@gmail.com wrote: > Issue, following error is generated after trying to sort a list of strings. > > description.sort() > TypeError: unorderable types: float() < str() Please send the complete error message not just the last line summary. There is a lot of

Re: [Tutor] Best way to write this countdown code

2019-01-12 Thread Alan Gauld via Tutor
On 12/01/2019 15:44, Joseph Gulizia wrote: > I want to integrate the following working code into a website: First thing to note is that web sites speak HTML, so anything you output for display needs to be in HTML not plain text. (Plain text will usually be understood by a browser but will look

<    1   2   3   4   5   6   7   8   9   10   >