Re: [Tutor] Detect the folder of a file

2016-04-26 Thread Alex Kleider
On 2016-04-26 16:16, Oliver Bestwalter wrote: sys.executable '/home/obestwalter/.pyenv/versions/3.4.4/envs/tmp/bin/python3.4' Not sure if this helps but perhaps: alex@X301:~/Py$ which python /usr/bin/python alex@X301:~/Py$ . venv/bin/activate (venv)alex@X301:~/Py$ which python

Re: [Tutor] Detect the folder of a file

2016-04-26 Thread Oliver Bestwalter
Hi, >>> import sys >>> sys.base_exec_prefix == sys.prefix False In a virtualenv those are different: https://docs.python.org/3/library/sys.html#sys.base_exec_prefix >>> sys.executable '/home/obestwalter/.pyenv/versions/3.4.4/envs/tmp/bin/python3.4' >>> sys.prefix

Re: [Tutor] Detect the folder of a file

2016-04-26 Thread Kanika Murarka
Thanks Danny On 27 Apr 2016 04:22, "Danny Yoo" wrote: > On Tue, Apr 26, 2016 at 3:43 PM, Kanika Murarka > wrote: > > The folder which we create using command > > $ Virtualenv venv > > > Hi Kanika, > > > I think you need to ask the virtualenv

Re: [Tutor] Detect the folder of a file

2016-04-26 Thread Kanika Murarka
The folder which we create using command $ Virtualenv venv On 27 Apr 2016 00:57, "Danny Yoo" wrote: On Tue, Apr 26, 2016 at 6:47 AM, Kanika Murarka wrote: > Hi, > I want to detect whether a 'file1.py' belongs to virtual environment > folder(

Re: [Tutor] def __init__(self):

2016-04-26 Thread Steven D'Aprano
On Tue, Apr 26, 2016 at 12:31:28PM +0530, Santanu Jena wrote: > Hi, > > Pls let me why > " > def __init__(self): > > " > declaration required, what's the use of this one.Pls explain me in > details. Let's say that you have a class with a method: # A talking bird, says "Polly wants a cracker"

Re: [Tutor] Detect the folder of a file

2016-04-26 Thread Danny Yoo
On Tue, Apr 26, 2016 at 3:43 PM, Kanika Murarka wrote: > The folder which we create using command > $ Virtualenv venv Hi Kanika, I think you need to ask the virtualenv folks; it seems to be virtualenv-specific. Their forum is:

Re: [Tutor] def __init__(self):

2016-04-26 Thread Ben Finney
Santanu Jena writes: > I have idea regarding " __init__" method/ class.but still I have > confusion on "def __init__(self): " What is the confusion? Please say what you are expecting, and what is happening instead that confuses you. (Also, please don't top-post. Instead,

Re: [Tutor] def __init__(self):

2016-04-26 Thread Danny Yoo
On Tue, Apr 26, 2016 at 2:32 AM, Santanu Jena wrote: > Hi Oliver. > I have idea regarding " __init__" method/ class.but still I have confusion > on "def __init__(self): " Please share your under standing. A big point of an entry point, conceptually, is to establish

Re: [Tutor] Detect the folder of a file

2016-04-26 Thread Danny Yoo
On Tue, Apr 26, 2016 at 6:47 AM, Kanika Murarka wrote: > Hi, > I want to detect whether a 'file1.py' belongs to virtual environment > folder( generally 'venv') or not ( considering different people may have > different names for virtual environment folder.). I think we

[Tutor] Detect the folder of a file

2016-04-26 Thread Kanika Murarka
Hi, I want to detect whether a 'file1.py' belongs to virtual environment folder( generally 'venv') or not ( considering different people may have different names for virtual environment folder.). I am able to detect it on my machine, but how to make it generalized. I am not getting anything on

Re: [Tutor] def __init__(self):

2016-04-26 Thread Santanu Jena
Hi Oliver. I have idea regarding " __init__" method/ class.but still I have confusion on "def __init__(self): " Please share your under standing. Thanks & Regards, San On Tue, Apr 26, 2016 at 2:14 PM, Oliver Bestwalter wrote: > Hi Santanu, > > without knowing from which

Re: [Tutor] Using a dictionary to map functions

2016-04-26 Thread Colby Christensen
Thank you! This is what I was hoping to accomplish. > To: tutor@python.org > From: __pete...@web.de > Date: Tue, 26 Apr 2016 14:13:56 +0200 > Subject: Re: [Tutor] Using a dictionary to map functions > > Colby Christensen wrote: > > > templist = [] > > pt_table = {} > > cmd_table =

Re: [Tutor] Revised question-Make an object disappear

2016-04-26 Thread Peter Otten
Lisa Hasler Waters wrote: > Dear Tutors, > > I have a student who is creating a game in TKinter. He wants the ball > (object) to disappear when it hits when it hits the wall. He continues to > get a syntax error message when trying to print the coordinates (he was > printing the coordinates

Re: [Tutor] Revised question-Make an object disappear

2016-04-26 Thread Steven D'Aprano
On Tue, Apr 26, 2016 at 10:55:24AM -0400, Lisa Hasler Waters wrote: > Dear Tutors, > > I have a student who is creating a game in TKinter. He wants the ball > (object) to disappear when it hits when it hits the wall. He continues to > get a syntax error message when trying to print the

[Tutor] Revised question-Make an object disappear

2016-04-26 Thread Lisa Hasler Waters
Dear Tutors, I have a student who is creating a game in TKinter. He wants the ball (object) to disappear when it hits when it hits the wall. He continues to get a syntax error message when trying to print the coordinates (he was printing the coordinates because he wanted to use its output to use

Re: [Tutor] Using a dictionary to map functions

2016-04-26 Thread Steven D'Aprano
Hi Colby, and welcome! On Tue, Apr 26, 2016 at 12:30:38AM -0400, Colby Christensen wrote: > try: >     infile = open(raw_input("Enter input file name; name.txt:"),'r') > except: >     print "Invalid filename" >     exit() I'm afraid that code is misleading: your error message lies. It may not

Re: [Tutor] Using a dictionary to map functions

2016-04-26 Thread Peter Otten
Colby Christensen wrote: > templist = [] > pt_table = {} > cmd_table = {5:"store_point", 19: "line_line_int"} As Alan says, the values should be functions rather than function names. You could use string keys to save both the re.search() check and the conversion to integer. > count = 0 > >

Re: [Tutor] def __init__(self):

2016-04-26 Thread Oliver Bestwalter
Hi Santanu, without knowing from which level of understanding you are asking, it is hard to say what we should answer here, so let me ask a few questions: Do you understand the concept of classes already? Maybe from other programming languages, or are you a complete beginner? If you are a

Re: [Tutor] XML and ElementTree

2016-04-26 Thread Alan Gauld via Tutor
Forwarding to tutor list. Please always use "Reply All" or "Reply List" when responding to the tutor list. On 26/04/16 09:24, Marco Soldavini wrote: > On Tue, Apr 26, 2016 at 2:05 AM, Alan Gauld via Tutor > wrote: >> On 25/04/16 17:24, Marco Soldavini wrote: >>> I've a few

Re: [Tutor] def __init__(self):

2016-04-26 Thread Alan Gauld via Tutor
On 26/04/16 08:01, Santanu Jena wrote: > Hi, > > Pls let me why > " > def __init__(self): > > " > declaration required, what's the use of this one.Pls explain me in > details. It is used to initialise object instances. For example if you define a class Rectangle that has a length and width and

Re: [Tutor] Using a dictionary to map functions

2016-04-26 Thread Alan Gauld via Tutor
On 26/04/16 05:30, Colby Christensen wrote: > import re > from store_point import store_point > > try: > infile = open(raw_input("Enter input file name; name.txt:"),'r') > except: > print "Invalid filename" > exit() > > templist = [] > pt_table = {} > cmd_table = {5:"store_point",

[Tutor] def __init__(self):

2016-04-26 Thread Santanu Jena
Hi, Pls let me why " def __init__(self): " declaration required, what's the use of this one.Pls explain me in details. Thanks in advance. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

[Tutor] Using a dictionary to map functions

2016-04-26 Thread Colby Christensen
I am a novice self taught programmer learning with Python. I am working on a program to calculate coordinate geometry. The input file is a list of commands. A number is assigned to each command and followed by various inputs required to make the calculation. The input has the following format: