Re: [Tutor] Splitting email headers when using imaplib
On 02/04/2014 06:38 PM, Some Developer wrote: I'm currently trying to download emails from an IMAP server using Python. I can download the emails just fine but I'm having an issue when it comes to splitting the relevant headers. Basically I'm using the following to fetch the headers of an email message: typ, msg_header_content = self.m.fetch(msg_id, '(BODY.PEEK[HEADER])') then I can get a string containing the headers by accessing msg_header_content[0][1]. This works fine but I need to split the Subject header, the From header and the To header out into separate strings so I can save the information in a database. I thought the following regular expressions would do the trick when using re.MULTILINE when matching them to the header string but apparently that appears to be wrong. msg_subject_regex = re.compile(r'^Subject:\.+\r\n') msg_from_regex = re.compile(r'^From:\.+\r\n') msg_to_regex = re.compile(r'^To:\.+\r\n') Can anyone point me in the right direction for this please? I'm at a loss here. I have no idea of the pattern or structure of email headers. Would you post some example of 'msg_header_content[0][1]'? In the meantine, try to suppress \r from the regex formats. (Shouldn't be here, because when reading strings from files, python converts newlines into \n; also try "'\r' in s" or "'\r\n' in s" to be sure.) d ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] I am teaching my students Python the second semester using www.LearnStreet.com ( http://www.learnstreet.com/ ). I am in need of some help. I am having a problem with the Lists-Set 1 exerci
On Tue, Feb 4, 2014 at 11:31 AM, Thomas Maher wrote: > Thank you for helping me. I used a similar code, but with an if statement. > if list1 in list2: > return len(list2[-1]) > > This is the code they sent me this morning. > > def len_of_innerlist(list2): > for ele in list2: > if isinstance(ele, list): > return len(ele) > > list1 = [1,2,3,4,5] > print len_of_innerlist([6,7,8,list1]) > > Tommy Maher +cc:tutor@python.org ... Wow. Holy wow. Ok. I don't know the LearnStreet folks, but if that's the quality of the problem set, that's a big warning sign for me. If that's their response, then I do stand by what I said earlier. Any "beginning tutorial" material that is using isinstance() there, as a motivating reason to use basic loops and conditions, is not to be trusted. That sounds like the school of "take grab-bag random features of the language and dole them out in lessons." I'd recommend a curriculum that respects their audience. Alan Gauld has written a good tutorial, which you can find here: http://www.alan-g.me.uk/ Also consider "How to Think like a Computer Scientist". http://www.greenteapress.com/thinkpython/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] I am teaching my students Python the second semester using www.LearnStreet.com ( http://www.learnstreet.com/ ). I am in need of some help. I am having a problem with the Lists-Set 1 exerci
The question as stated is fairly artificial and a bit nonsensical. Let me explain that statement, because it's a strong one. If we know the exact shape for list1 and list2 are, we can answer this question directly, without loops. len(list1[-1]) "Take the last element of the list1, and grab its length." Note: no loops, no if statements. It's the direct solution to this problem as stated. You need lists and loops when you're working with data of some dynamic size that can vary. But this problem doesn't demonstrate that need at all, so as far as I can tell. And there's no need for 'if' statements here either with the original problem statement. Again, the problem as stated is so static, so anemic, that there's no need for any branching, conditional logic. Hence the problem does not seems like a good question to ask. It's likely nonsensical to a professional programmer, and likely nonsensical to your students as well. If yo can, try to find a better source of good questions. Your students will be happier. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] Splitting email headers when using imaplib
I'm currently trying to download emails from an IMAP server using Python. I can download the emails just fine but I'm having an issue when it comes to splitting the relevant headers. Basically I'm using the following to fetch the headers of an email message: typ, msg_header_content = self.m.fetch(msg_id, '(BODY.PEEK[HEADER])') then I can get a string containing the headers by accessing msg_header_content[0][1]. This works fine but I need to split the Subject header, the From header and the To header out into separate strings so I can save the information in a database. I thought the following regular expressions would do the trick when using re.MULTILINE when matching them to the header string but apparently that appears to be wrong. msg_subject_regex = re.compile(r'^Subject:\.+\r\n') msg_from_regex = re.compile(r'^From:\.+\r\n') msg_to_regex = re.compile(r'^To:\.+\r\n') Can anyone point me in the right direction for this please? I'm at a loss here. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] unsigned int or char equivalent in Python?
On 04/02/14 15:01, Peter Otten wrote: Alan Gauld wrote: This led me to wonder if there is a way to get unsigned type behaviour in Python? I think you have to apply a mask: -2 & 0xff 254 Ah! obvious when you see it! :-) And I'm applying masks all over the place but didn't think of using it here. Thanks, -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] unsigned int or char equivalent in Python?
Alan Gauld wrote: > I'm playing with some bit twiddling code at present and started > to get some unexpected results which i eventually realized > were down to Python ints acting like signed ints in C (but > with a 'flexible' sign bit!) > > This led me to wonder if there is a way to get unsigned type > behaviour in Python? > > This could be very useful in bit twiddling scenarios, especially > now that Python is being used on RasberryPi type devices to > control Arduinos and the like. I had a quick hunt in the docs > but couldn't think of a way to fake it. I think you have to apply a mask: >>> -2 & 0xff 254 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] unsigned int or char equivalent in Python?
I'm playing with some bit twiddling code at present and started to get some unexpected results which i eventually realized were down to Python ints acting like signed ints in C (but with a 'flexible' sign bit!) This led me to wonder if there is a way to get unsigned type behaviour in Python? This could be very useful in bit twiddling scenarios, especially now that Python is being used on RasberryPi type devices to control Arduinos and the like. I had a quick hunt in the docs but couldn't think of a way to fake it. Any ideas? -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] strange errors
Gabriele Brambilla wrote: > ok. > the problem is that my "errors" are not always the same and sometimes they > are only differences in the results displayed (with the same starting data > and no random variables used between). Sometimes randomness lurks where you don't expect it. Are there any dicts or sets involved? If so set the environment variable PYTHONHASHSEED=0 and see if the error starts occuring in the same place. > so it's difficult for me to understand where the error is (and to give you > a piece of code that can run). Please understand that it is impossible to debug code that we don't have. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] strange errors
ok. the problem is that my "errors" are not always the same and sometimes they are only differences in the results displayed (with the same starting data and no random variables used between). so it's difficult for me to understand where the error is (and to give you a piece of code that can run). for example today I got this two warnings and the results displayed were wrong C:\Users\Gabriele\Anaconda1\lib\site-packages\matplotlib\colors.py:918: RuntimeWarning: overflow encountered in true_divide resdat /= (vmax - vmin) C:\Users\Gabriele\Anaconda1\lib\site-packages\matplotlib\colors.py:568: RuntimeWarning: overflow encountered in multiply xa *= self.N and when I search the maximum and the minimum in a matrix it has returned me two nan values. Gabriele 2014-02-03 Jerry Hill : > On Mon, Feb 3, 2014 at 2:17 PM, Gabriele Brambilla > wrote: > > No, i'm not using lowlevel stuff...which part of the script do you want > to > > see? > > Since you asked, what we'd really like to see is a Short, Self > Contained, Compilable Example (see http://sscce.org/). That is, an > example that is short enough to be read quickly, self contained enough > so that we can actually save the code and run it, compilable in that > the code will run, at least to the point where you're having a problem > (it's fine to have code that won't run, as long as the error that pops > up is the error you're actually looking for help with). > > We know that it can be a lot of work to create an example like that, > but if you do there are two things that are likely to happen. First, > probably 75% of the time, you will find your problem yourself without > ever having to post it to the list. The very act of trimming your > code into the piece that demonstrates your problem, will help you find > the problem yourself. > > Second, you are very, very likely to get people to pay attention to > your question and provide advice on how to fix your code when you make > it easy for them to help. > > -- > Jerry > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] My First Post
Danny Yoo Wrote in message: > (Sorry if you get this message twice: I think I accidently mis-sent > the message to the wrong address, so to make sure, I'm sending to what > I think is the right address this time.) > > --- > > Hi Premanshu, [deleting useful advice] Welcome to the list. When responding to a post on a mailing list, you should do a reply-list or reply-all. And usually keep the subject line intact. Many people don't read every message, but only those threads that look interesting, so you want to be in the same thread. -- DaveA ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] input python 3.3
Ian D Wrote in message: > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > When making an amendment to a post, please reply to that post; don't start a new thread, especially with a new subject. And please post in text, not html. Others have answered your question, but I wanted to point out that in 2.x, the program really has no idea what type of value will be returned to input (). Could easily be float, int, tuple, list, Nonetype, or thousands of other things, including many exceptions. With 3.x it's a string, and the programmer remains in control. -- DaveA ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] conditionals or comparison or expressions terminology
Ian D wrote: > Are: > > <= > == > != > > simple conditionals statements, conditionals, comparison operators, > conditional expressions or what? [comparison] operators: http://docs.python.org/3.3/reference/lexical_analysis.html#operators a <= b # expression (something is evaluated; ideally there are no side effects) c = a <= b # statement (something is done, ideally only the side effect matters) if a <= b: # conditional [expression] (some action is taken based on the result of the expression) ... while a <= b: # conditional [expression] ... Context is important: c(a <= b) # statement, assuming c does something permanent if c(a <= b): # expression, ideally only the result of c(...) matters. > I am looking at a few different pages and am unsure what I should be > calling these expressions. > > http://anh.cs.luc.edu/python/hands- on/3.1/handsonHtml/ifstatements.html#simple-conditions > > http://www.tutorialspoint.com/python/python_basic_operators.htm > > http://docs.python.org/2/library/stdtypes.html#truth-value-testing > > Thanks ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Any ideas
josh Malone Wrote in message: > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > First thing is to figure your goal. "Model" might mean anything from "figure out how far they each go" to "plot the four trajectories in real time on a screen. " Or even "make four robots traverse the course till they crash into each other." Next, figure how you'd solve it by hand. Probably that includes figuring how far each will go and where they'll end up. Assuming the real assignment is to come up with four lists of coordinates, figure you'll need a loop. Python's loop constructs are for and while. If you have already figured the formula for how long they'll take, a for loop is most reasonable, with an increment of perhaps a tenth of a second. Now please post some code, tell us what doesn't work, and make sure it's a text message, not html. -- DaveA ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] conditionals or comparison or expressions terminology
Hi Are: <= == != simple conditionals statements, conditionals, comparison operators, conditional expressions or what? I am looking at a few different pages and am unsure what I should be calling these expressions. http://anh.cs.luc.edu/python/hands-on/3.1/handsonHtml/ifstatements.html#simple-conditions http://www.tutorialspoint.com/python/python_basic_operators.htm http://docs.python.org/2/library/stdtypes.html#truth-value-testing Thanks ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] I am teaching my students Python the second semester using www.LearnStreet.com ( http://www.learnstreet.com/ ). I am in need of some help. I am having a problem with the Lists-Set 1 exerci
Thomas Maher wrote: > I am teaching my students Python the second semester using > www.LearnStreet.com ( http://www.learnstreet.com/ ). I am in need of some > help. I am having a problem with the Lists-Set 1 exercise 18. The > problem is below. I have put in several codes and the output is 5, which > is the right answer. But it is asking for List's index logic. I have > tried support with LearnStreet but they have yet to respond. Thank you > for your time. > > > Tommy Maher > 18 : Finding the length of nested lists. > > Create two lists list1 = [1,2,3,4,5] and list2 = [6,7,8,list1]. Write a > code to find the length of list1 in list2 using for loop. > > Use the if statement to check elements in the list2. > > > def len_of_innerlist(list2): > # your code here > > list1 = [1,2,3,4,5] > print len_of_innerlist([6,7,8,list1]) Was the isinstance() function already explained in the course? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Rsync script hangs after a while
Dayo wrote: > I wrote this script (http://bpaste.net/show/175284/) to help me > automate some rsync backups, and whenever I run the script for large > syncs, it just freezes after a while, and then I have to Ctrl+C it. I Maybe you are just lacking patience ;) > can find any clues in both source and target /var/log/* files. Any idea > how I can find out what's wrong with this thing? > def tuxsync(): > """ Rsync data to target backup dir.""" > # Get config file > config = ConfigParser.ConfigParser() > config.read(os.getenv('HOME') + '/.tuxsync.conf') > backupdirparent = config.get("backupsdir","backupsdir") > remoteusername = "root" > > # Get the client hostname and path to the source directory which are to be > # synced to the backup server > for client in [sec for sec in config.sections() if sec.startswith('clients.')]: > delim = '.' > # section header is in the format [clients.]. > # So split away the 'clients.' part, because we need just the hostname > clienthostname = client.split(delim)[1] > clientpath = config.get(client, "path") > print "clienthostname: %s\n" %(clienthostname) > print "path: %s\n" %(clientpath) You are throwing away all but the last clienthostname/clientpath. Is that intentional? > # First check for old backups and delete those > deleteoldbackups(backupdirparent) > > # Create new backup > subprocess.call(["/usr/bin/rsync", "-aEPhu", "--log-file=" + os.getenv('HOME') + "/tuxsync.log", remoteusername + '@' + clienthostname + ':' + clientpath, backupdirparent + '/' + clienthostname + strftime("%Y%m%d_%H%M%S") + '/']) > First, I'd make sure that python is involved. If it hangs on the rsync invocation you could replace subprocess.call(...) with print subprocess.list2cmd(...) and then run the resulting line from the shell, without python. If that freezes, too, you have to look elsewhere. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Rsync script hangs after a while
On 04/02/14 09:10, Dayo wrote: I wrote this script (http://bpaste.net/show/175284/) to help me automate some rsync backups, and whenever I run the script for large syncs, it just freezes after a while, and then I have to Ctrl+C it. You have quite a few prints in there so you should have some idea what it was doing when it freezes? If not add a few debug prints to show entry/exit of the functions, that should narrow it down a bit. The most likely places for a freeze are loops and calls to external programs so again wrap your loops and subprocess calls up with debug prints to see if you can identify which one causes the freeze. hth -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] input python 3.3
On 04/02/14 09:01, Ian D wrote: I used to use 2.7 and the input was pretty when inputting a numeric value, it would just get cast to an int. Just to be picky it would get converted to an int not cast as an int. casting and converting are two very different things. casting means treat a bit pattern in memory as if it is a particular type regardless of how that bit pattern got there. Converting to a type changes the bit pattern to give a value that is in some way related to the original's meaning. To give a simple example of the difference: var = '2' # the character two castVar = ord(2)# treat the character as an int convVar = int(var) # convert '2' to 2 casting is often done in C/C++ because it is common to return a pointer to a piece of data and the programmer has to tell the compiler how to treat that data. It looks like a conversion so casting is often mistaken for conversion. But they are not the same. (And C++ confused the issue further by introducing "dynamic casts" which often are conversions!) Sorry to be picky but failing to understand the difference has caused many a bug in C programs and I've suffered enough pain to be sensitive! :-) Seems a backwards step unless (and am sure this is the case)it is beneficial in so many other ways? Peter has explained why the v2 Python input() was a bad idea. Explicit conversion is much safer. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] JES question concerning syntax
Siobhan Wojcik wrote: > Hello, > > I've been having an issue with a program that I'm writing. The program > works until it has to compute something: > > def carPmt(): > cost = requestInteger("How much does the car cost?") > downPmt = requestInteger("If there is a down payment, how much?") > tradeIn = requestInteger("If there is a trade-in, what is its value?") > years = requestInteger("How many years will you be paying?") > air = requestInteger("What is the interest rate?") > > payment = calculatePayment(cost,downPmt,tradeIn,years,air) > print "With a down payment of",downPmt," a trade-in value of",tradeIn, > print ", an annual interest rate of",air,", your new",cost, "car will > cost", > print "you only",payment, "per month." > > def calculatePayment(cost,downPmt,tradeIn,years,air): > carCostInitial = cost - downPmt > carCostIntermediate = carCostInitial - tradeIn > monIntRate = air/12 > compoundingFactor = (1.0+monIntRate)**12.0/(1+monIntRate**12.0)-1.0 > monthPmt = monIntRate*carCostIntermediate*compoundingFactor > return monthPmt > > > > The first two sections work; the third one does not. When inputting random > values, I get this: "With a down payment of 5000 ,a trade-in value of 7000 > ,an annual interest rate of 2 ,your new 25000 car will cost you only 0.0 > per month" Obviously I don't want my answer to be 0.0. I've had other > people look at it (although they aren't well-versed in Python) and they > couldn't help me isolate the problem. > > Thanks a million. Hint: >>> 2/12 0 Potential fixes: >>> 2/12.0 0.1 >>> float(2)/12 0.1 Or if you want to change the default behaviour for the whole module: >>> from __future__ import division # at the beginning of the file >>> 2/12 0.1 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] I am teaching my students Python the second semester using www.LearnStreet.com ( http://www.learnstreet.com/ ). I am in need of some help. I am having a problem with the Lists-Set 1 exercise 1
I am teaching my students Python the second semester using www.LearnStreet.com ( http://www.learnstreet.com/ ). I am in need of some help. I am having a problem with the Lists-Set 1 exercise 18. The problem is below. I have put in several codes and the output is 5, which is the right answer. But it is asking for List's index logic. I have tried support with LearnStreet but they have yet to respond. Thank you for your time. Tommy Maher 18 : Finding the length of nested lists. Create two lists list1 = [1,2,3,4,5] and list2 = [6,7,8,list1]. Write a code to find the length of list1 in list2 using for loop. Use the if statement to check elements in the list2. def len_of_innerlist(list2): # your code here list1 = [1,2,3,4,5] print len_of_innerlist([6,7,8,list1]) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] JES question concerning syntax
Hello, I've been having an issue with a program that I'm writing. The program works until it has to compute something: def carPmt(): cost = requestInteger("How much does the car cost?") downPmt = requestInteger("If there is a down payment, how much?") tradeIn = requestInteger("If there is a trade-in, what is its value?") years = requestInteger("How many years will you be paying?") air = requestInteger("What is the interest rate?") payment = calculatePayment(cost,downPmt,tradeIn,years,air) print "With a down payment of",downPmt," a trade-in value of",tradeIn, print ", an annual interest rate of",air,", your new",cost, "car will cost", print "you only",payment, "per month." def calculatePayment(cost,downPmt,tradeIn,years,air): carCostInitial = cost - downPmt carCostIntermediate = carCostInitial - tradeIn monIntRate = air/12 compoundingFactor = (1.0+monIntRate)**12.0/(1+monIntRate**12.0)-1.0 monthPmt = monIntRate*carCostIntermediate*compoundingFactor return monthPmt The first two sections work; the third one does not. When inputting random values, I get this: "With a down payment of 5000 ,a trade-in value of 7000 ,an annual interest rate of 2 ,your new 25000 car will cost you only 0.0 per month" Obviously I don't want my answer to be 0.0. I've had other people look at it (although they aren't well-versed in Python) and they couldn't help me isolate the problem. Thanks a million. Siobhan Wojcik ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] Any ideas
Hi, I'm very new to programming and python is my first language. I'm currently enrolled in a class at Oregon State University where we are taught to program in python. I'm stuck on one problem and i know what i want to do... i just have no idea how to write the program. The question is as follows Consider four missiles initially located at the four corners of a square with a side of 100m. Model their behavior if each missile moves with a speed of 5m/s in the direction pointing directly at the missile counter-clockwise from itself. I think i can do most of this, i'm just confused on how to make the spheres continually change their direction. I'm assuming it has something to do with a while loop or possibly an if statement. Any help you could give me would be great! thanks! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] input python 3.3
Ian D wrote: > Hello > > I used to use 2.7 and the input was pretty when inputting a numeric value, > it would just get cast to an int. > > Seems that 3.3 I have to cast each input so : > float(num1 = input("Enter a number") You mean num1 = float(input("Enter a number")) > Is this just they way it is now? Is there a way to get back to just > typing: > num1 = input("Enter a number ") > in python 33. > > Seems a backwards step unless (and am sure this is the case)it is > beneficial in so many other ways? input() in Python 2 did not just recognize numbers, it allowed you to evaluate an arbitrary Python expression. For example: $ touch important_file $ ls important_file $ python Python 2.7.2+ (default, Jul 20 2012, 22:15:08) [GCC 4.6.1] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> input("Enter a number: ") Enter a number: __import__("os").remove("important_file") >>> $ ls Oops, the file is gone. I'm sure you can see why this is dangerous. Therefore the recommendation for Python 2 is to use raw_input() instead of input() -- and for Python 3 raw_input() was renamed to the more obvious input(). You can get the old input() behaviour with num1 = eval(input(...)) which is still dangerous, but makes the risk more obvious. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] Rsync script hangs after a while
Hi I wrote this script (http://bpaste.net/show/175284/) to help me automate some rsync backups, and whenever I run the script for large syncs, it just freezes after a while, and then I have to Ctrl+C it. I can find any clues in both source and target /var/log/* files. Any idea how I can find out what's wrong with this thing? Thanks Dayo ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] input syntax I just posted totally wrong
num1 = float(input("enter a number ")) I meant not float(num1 = input("Enter a number")) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] input python 3.3
Hello I used to use 2.7 and the input was pretty when inputting a numeric value, it would just get cast to an int. Seems that 3.3 I have to cast each input so : float(num1 = input("Enter a number") Is this just they way it is now? Is there a way to get back to just typing: num1 = input("Enter a number ") in python 33. Seems a backwards step unless (and am sure this is the case)it is beneficial in so many other ways? Thanks ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor