Re: [Tutor] arrangement of datafile

2014-01-10 Thread Amrita Kumari
Hi Peter, Thankyou very much for your kind help. I got the output like the way I wanted (which you have also shown in your output). I really appreciate your effort. Thanks for your time. Amrita On Thu, Jan 9, 2014 at 8:41 PM, Peter Otten __pete...@web.de wrote: Amrita Kumari wrote: On

[Tutor] Python Question

2014-01-10 Thread Amy Davidson
Hi, I am a university student who is struggling with writing functions in Python. I’ve been attempting to write a function in Python for over 2 hours with no progress. The function must be called, printID and take a name and student number as parameter and prints them to the screen. This is

[Tutor] How can a CGI program get the URL that called it?

2014-01-10 Thread Terry Carroll
How can my Python 2.7 CGI program find the URL that caused the program to be called? I have a program that creates a JPG or PNG file on the fly, and needs to construct a URL to it. I know the path relative to my program is, for example, ../temp/tmpiicack.png (the filename generated by

Re: [Tutor] Python Question

2014-01-10 Thread Mark Lawrence
On 10/01/2014 00:11, Amy Davidson wrote: Hi, I am a university student who is struggling with writing functions in Python. I’ve been attempting to write a function in Python for over 2 hours with no progress. The function must be called, printID and take a name and student number as

Re: [Tutor] Python Question

2014-01-10 Thread jargon
On 01/10/2014 02:11 AM, Amy Davidson wrote: Hi, I am a university student who is struggling with writing functions in Python. I’ve been attempting to write a function in Python for over 2 hours with no progress. The function must be called, printID and take a name and student number as

Re: [Tutor] Python Question

2014-01-10 Thread Keith Winston
Amy, you may want to get a little clearer on the difference between defining a function, and calling one. The definition is sort of a generic process, it's when you are calling it that you really fill in the blanks, and the function does what it's designed for (whether you like it or not!). You

Re: [Tutor] Python Question

2014-01-10 Thread Alan Gauld
On 10/01/14 00:11, Amy Davidson wrote: Hi, I am a university student who is struggling with writing functions in Python. You could try reading the functions and modules topic in my tutorial.(see below) The function must be called, printID and take a name and student number as parameter

Re: [Tutor] How can a CGI program get the URL that called it?

2014-01-10 Thread Alan Gauld
On 09/01/14 22:30, Terry Carroll wrote: How can my Python 2.7 CGI program find the URL that caused the program to be called? You don't say what modules or toolkits you are using but I'll assume for now its the standard library cgi module? I'm not sure what you are looking for. Is it the url

Re: [Tutor] Python Question

2014-01-10 Thread Keith Winston
Amy, be aware that there are slightly different versions of Python floating around, and the example Dayo gave you uses a slightly different print statement (no parens) than the example you provided (which probably indicates that your Python requires them). Good luck, you're on your way! Keith

Re: [Tutor] Python Question

2014-01-10 Thread spir
On 01/10/2014 01:11 AM, Amy Davidson wrote: Hi, I am a university student who is struggling with writing functions in Python. I’ve been attempting to write a function in Python for over 2 hours with no progress. The function must be called, printID and take a name and student number as

Re: [Tutor] arrangement of datafile

2014-01-10 Thread Albert-Jan Roskam
Ok, it's clear already that the OP has a csv file so the following is OFF-TOPIC. I was reading Python Cookbook and I saw a recipe to read fixed width files using struct.unpack. Much shorter and faster (esp. if you use compiled structs) than indexing. I thought this is a pretty cool approach:

Re: [Tutor] Python Question

2014-01-10 Thread Danny Yoo
Hi Amy, Have you seen any other examples of functions in your instruction, either in your books or notes? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python Question

2014-01-10 Thread Danny Yoo
I repeat my question in the hopes that you read it. Do you have other examples of functions you have written or seen? I ask this because if you have never seen a function definition, our advice is radically different than if you have. Just giving us the homework statement is fairly useless to

Re: [Tutor] Python Question

2014-01-10 Thread Keith Winston
Amy, judging from Danny's replies, you may be emailing him and not the list. If you want others to help, or to report on your progress, you'll need to make sure the tutor email is in your reply to: Often, people prefer you to respond to the list, if there isn't something particularly personal in

Re: [Tutor] How can a CGI program get the URL that called it?

2014-01-10 Thread Danny Yoo
On Thu, Jan 9, 2014 at 2:30 PM, Terry Carroll carr...@tjc.com wrote: How can my Python 2.7 CGI program find the URL that caused the program to be called? Hi Terry, According to the description of CGI: http://en.wikipedia.org/wiki/Common_Gateway_Interface there should be a set of

Re: [Tutor] Python Question

2014-01-10 Thread Danny Yoo
On Fri, Jan 10, 2014 at 2:00 PM, Keith Winston keithw...@gmail.com wrote: Amy, judging from Danny's replies, you may be emailing him and not the list. If you want others to help, or to report on your progress, you'll need to make sure the tutor email is in your reply to: Hi Amy, Very much so.

Re: [Tutor] How can a CGI program get the URL that called it?

2014-01-10 Thread Terry Carroll
Ah, I discovered what my problem was... On Fri, 10 Jan 2014, Alan Gauld wrote: its calling your file. You should know where your file is? My problem was that, I know where the file is in the host's file system, and relative to my CGI program. I do not have a URL to that file. If you want

Re: [Tutor] How can a CGI program get the URL that called it?

2014-01-10 Thread Steven D'Aprano
On Fri, Jan 10, 2014 at 02:44:35PM -0800, Terry Carroll wrote: As it turns out, since I was testing on a Windows box, os.path.relpath was (reasonably) using a '\' as the separator character (surprisingly, so does posixpath.relpath). Are you sure about that? If it did, that would be an

Re: [Tutor] Python Django

2014-01-10 Thread Lee Harr
I am very interested to hear your opinion on which version of Python to use in conjunction with Django. Currently, I am taking a class at Udemy and they recommend using Python 2.7 with Django 1.6. because both versions work well with each other. Over the last few months I got pretty much

Re: [Tutor] Python Question

2014-01-10 Thread Amy Davidson
Hey Danny, I just started taking the course (introduction to Computer Science) on last Tuesday, so I am not to familiar. I have been doing my best to understand the material by reading the text book, Learn Python the hard way. In my quest to answer the question given to me, I have searched

Re: [Tutor] How can a CGI program get the URL that called it?

2014-01-10 Thread Terry Carroll
On Sat, 11 Jan 2014, Steven D'Aprano wrote: However, if you pass a path using \ to posixpath, it treats them as non-separators: That's apparenbtly what's happening. I didn't investigate much, once I found out that using posixpath didn't address the issue I was having; using replace() was

Re: [Tutor] Python Question

2014-01-10 Thread Danny Yoo
On Fri, Jan 10, 2014 at 5:57 PM, Amy Davidson amydavid...@sympatico.ca wrote: Hey Danny, I just started taking the course (introduction to Computer Science) on last Tuesday, so I am not to familiar. I have been doing my best to understand the material by reading the text book, Learn Python

[Tutor] Question about subprocess

2014-01-10 Thread daedae11
p = subprocess.Popen(['E:/EntTools/360EntSignHelper.exe', 'E:/build/temp/RemoteAssistSetup.exe'], stdout=subprocess.PIPE, shell=True).stdout temp = p.readline(); print temp p.close() When I run the above code in command line, it works formally. However, when I writed it

Re: [Tutor] Question about subprocess

2014-01-10 Thread Danny Yoo
There is a warning in the documentation on subprocess that might be relevant to your situation: Warning: Use communicate() rather than .stdin.write, .stdout.read or .stderr.read to avoid deadlocks due to any of the other OS pipe buffers filling up and blocking the child process.

Re: [Tutor] Question about subprocess

2014-01-10 Thread Steven D'Aprano
On Sat, Jan 11, 2014 at 12:48:13PM +0800, daedae11 wrote: p = subprocess.Popen(['E:/EntTools/360EntSignHelper.exe', 'E:/build/temp/RemoteAssistSetup.exe'], stdout=subprocess.PIPE, shell=True).stdout temp = p.readline(); print temp p.close() When I run the above