Caching: Access a local file, but ensure it is up-to-date from a remote URL

2014-10-12 Thread Ben Finney
Howdy all, I'm hoping that the problem I currently have is one already solved, either in the Python standard library, or with some well-tested obvious code. A program I'm working on needs to access a set of files locally; they're just normal files. But those files are local cached copies of docu

Re: problem with pytz

2014-10-12 Thread Mark Lawrence
On 13/10/2014 03:55, ryguy7272 wrote: I just tried running the code from here. http://www.thealgoengineer.com/2014/download_sp500_data/ I got this error. Traceback (most recent call last): File "C:/Python27/stock_data.py", line 4, in Please don't put your code here, what happens when you u

problem with pytz

2014-10-12 Thread ryguy7272
I just tried running the code from here. http://www.thealgoengineer.com/2014/download_sp500_data/ I got this error. Traceback (most recent call last): File "C:/Python27/stock_data.py", line 4, in import pytz ImportError: No module named pytz So, I got here and download the files. https://p

Re: what is the easiest way to install multiple Python versions?

2014-10-12 Thread Rustom Mody
On Sunday, October 12, 2014 7:06:14 PM UTC+5:30, Albert-Jan Roskam wrote: > Hi, > > A few days ago I needed to check whether some Python code ran with Python > 2.6. What is the easiest way to install another Python version along side the > default Python version? My own computer is Debian Linux

Re: How to install and run a script?

2014-10-12 Thread ryguy7272
On Sunday, October 12, 2014 4:18:19 PM UTC-4, ryguy7272 wrote: > I'm an absolute noob to Python, although I have been programming in several > other languages for over 10 years. > > > > I'm trying to install and run some scripts, and I'm not having much success. > > > > I followed the steps

Re: what is the easiest way to install multiple Python versions?

2014-10-12 Thread Terry Reedy
On 10/12/2014 9:33 AM, Albert-Jan Roskam wrote: A few days ago I needed to check whether some Python code ran with Python 2.6. What is the easiest way to install another Python version along side the default Python version? My own computer is Debian Linux 64 bit, but a platform-independent solut

Re: while loop - multiple condition

2014-10-12 Thread Chris Angelico
On Mon, Oct 13, 2014 at 11:43 AM, Dennis Lee Bieber wrote: > ONE: Python uses short circuit evaluation: for an OR, the second > clause > is only looked at if the first clause is FALSE (for an AND, the first > clause has to be TRUE before the second is evaluated). Short-circuiting doesn't

Re: TypeError: 'kwarg' is an invalid keyword argument for this function

2014-10-12 Thread Terry Reedy
On 10/12/2014 2:45 PM, Ian Kelly wrote: On Sun, Oct 12, 2014 at 6:55 AM, roro codeath wrote: How to implement it in my class? class Str(str): def __init__(self, *args, **kwargs): pass Str('smth', kwarg='a') The error is coming from the __new__ method. Because str is an immutab

Re: while loop - multiple condition

2014-10-12 Thread Steven D'Aprano
Tim Chase wrote: > On 2014-10-12 22:16, Marko Rauhamaa wrote: >> is equivalent with >> >> while ans.lower()[0] != 'y': >> ans = input('Do you like python?') > > And still better improved with > > while ans[:1].lower() != 'y': > ans = input('Do you like python?') The intenti

Re: while loop - multiple condition

2014-10-12 Thread Tim Chase
On 2014-10-12 22:16, Marko Rauhamaa wrote: > is equivalent with > > while ans.lower()[0] != 'y': > ans = input('Do you like python?') And still better improved with while ans[:1].lower() != 'y': ans = input('Do you like python?') in the event that len(ans)==0 (a situation whi

Re: How to install and run a script?

2014-10-12 Thread Mark Lawrence
On 12/10/2014 21:17, Ryan Shuell wrote: I'm an absolute noob to Python, although I have been programming in several other languages for over 10 years. I'm trying to install and run some scripts, and I'm not having much success. I followed the steps at this site. https://docs.python.org/2/insta

Fwd: How to install and run a script?

2014-10-12 Thread Abhiram
Begin forwarded message: > From: Ryan Shuell > Subject: How to install and run a script? > Date: 13 October 2014 1:47:58 am IST > To: python-list@python.org > > I'm an absolute noob to Python, although I have been programming in several > other languages for over 10 years. > > I'm trying to

Re: How to install and run a script?

2014-10-12 Thread Chris Angelico
On Mon, Oct 13, 2014 at 7:17 AM, Ryan Shuell wrote: > I'm an absolute noob to Python, although I have been programming in several > other languages for over 10 years. > > I'm trying to install and run some scripts, and I'm not having much success. > > I followed the steps at this site. > https://

How to install and run a script?

2014-10-12 Thread Ryan Shuell
I'm an absolute noob to Python, although I have been programming in several other languages for over 10 years. I'm trying to install and run some scripts, and I'm not having much success. I followed the steps at this site. https://docs.python.org/2/install/ I have Python 2.7.6 Shell. If I type

Re: while loop - multiple condition

2014-10-12 Thread Denis McMahon
On Sun, 12 Oct 2014 17:08:00 +, Shiva wrote: > while ans.lower() != 'yes' or ans.lower()[0] != 'y': while ans.lower() is not equal to "yes" or ans.lower()[0] is not equal to "y" the loop will continue to run Note that if ans.lower() == 'y', then the first clause ( ans.lower() != 'yes' )

Re: while loop - multiple condition

2014-10-12 Thread Chris Angelico
On Mon, Oct 13, 2014 at 6:16 AM, Marko Rauhamaa wrote: > The corrected version > > while ans.lower() != 'yes' and ans.lower()[0] != 'y': > ans = input('Do you like python?') > > is equivalent with > > while ans.lower()[0] != 'y': It's true that the first part is redundant, but tr

Re: while loop - multiple condition

2014-10-12 Thread Marko Rauhamaa
Chris Angelico : > On Mon, Oct 13, 2014 at 4:59 AM, Shiva > wrote: >> Bit confusing to use in While loop - Should have used the 'and' condition >> instead of OR- then it works fine. >> for OR both condition need to be false to produce a false output and break >> the loop. > > Correct, what you're

Re: TypeError: 'kwarg' is an invalid keyword argument for this function

2014-10-12 Thread Ian Kelly
On Sun, Oct 12, 2014 at 6:55 AM, roro codeath wrote: > How to implement it in my class? > > class Str(str): > def __init__(self, *args, **kwargs): > pass > > Str('smth', kwarg='a') The error is coming from the __new__ method. Because str is an immutable type, you should override the _

Re: Toggle

2014-10-12 Thread Chris Angelico
On Mon, Oct 13, 2014 at 5:38 AM, Tony the Tiger wrote: >> colour = 'red' if colour == 'blue' else 'blue' > > I call that a subtle bug that most likely will jump up and bite your > behind when you least expect it. More generally, I'd say that this is solving a (very) slightly different problem: it

Re: what is wrong with this script and how do I get the value in a php script

2014-10-12 Thread Denis McMahon
On Sun, 12 Oct 2014 07:24:52 -0700, martijnperdaan wrote: > what is wrong with this script and how do I get the value Rij1 and Rij2 > and Rij3 and Rij4 and Rij5 and Rij6 in a php script I can see several pythonic errors in your script, however as for "what is wrong", I see no indication from you

Re: while loop - multiple condition

2014-10-12 Thread Chris Angelico
On Mon, Oct 13, 2014 at 4:59 AM, Shiva wrote: > Bit confusing to use in While loop - Should have used the 'and' condition > instead of OR- then it works fine. > for OR both condition need to be false to produce a false output and break > the loop. Correct, what you're looking for here is indeed a

Re: while loop - multiple condition

2014-10-12 Thread Shiva
Bit confusing to use in While loop - Should have used the 'and' condition instead of OR- then it works fine. for OR both condition need to be false to produce a false output and break the loop. More of SET operations. Thanks, Shiva -- https://mail.python.org/mailman/listinfo/python-list

Re: while loop - multiple condition

2014-10-12 Thread Chris Angelico
On Mon, Oct 13, 2014 at 4:21 AM, Shiva wrote: >> The loop will continue while either part is true - that's what "or" >> means. Is that what you intended it to be doing? >> >> ChrisA >> > > > Yes..however, the second part of the or condition doesn't get evaluated. > So if I enter a 'y' - I expe

Re: while loop - multiple condition

2014-10-12 Thread Roy Smith
In article , Shiva wrote: > Why is the second part of while condition not being checked? > > while ans.lower() != 'yes' or ans.lower()[0] != 'y': > ans = input('Do you like python?') > > > My intention is if either of the conditions are true the loop should break. > But the condition aft

Re: while loop - multiple condition

2014-10-12 Thread Shiva
> The loop will continue while either part is true - that's what "or" > means. Is that what you intended it to be doing? > > ChrisA > Yes..however, the second part of the or condition doesn't get evaluated. So if I enter a 'y' - I expect the second part to evaluate and the loop to break -

Re: Butterflow installation on windows

2014-10-12 Thread Mark Lawrence
On 11/10/2014 16:20, Virgil Stokes wrote: The butterflow package (https://pypi.python.org/pypi/butterflow/0.1.4a1) has recently been released. I would like to know if anyone has been able to install it on a windows platform. Short answer no. Long answer follows. c:\Users\Mark\PythonIssues>pip

Re: while loop - multiple condition

2014-10-12 Thread Chris Angelico
On Mon, Oct 13, 2014 at 4:08 AM, Shiva wrote: > Why is the second part of while condition not being checked? > > while ans.lower() != 'yes' or ans.lower()[0] != 'y': > ans = input('Do you like python?') > > > My intention is if either of the conditions are true the loop should break. > But th

while loop - multiple condition

2014-10-12 Thread Shiva
Why is the second part of while condition not being checked? while ans.lower() != 'yes' or ans.lower()[0] != 'y': ans = input('Do you like python?') My intention is if either of the conditions are true the loop should break. But the condition after 'or' doesn't seem to evaluate. Thanks, Sh

Re: what is wrong with this script and how do I get the value in a php script

2014-10-12 Thread Peter Pearson
On Sun, 12 Oct 2014 07:24:52 -0700 (PDT), martijnperd...@gmail.com wrote: > what is wrong with this script and how do I get the value Rij1 and > Rij2 and Rij3 and Rij4 and Rij5 and Rij6 in a php script > > import RPi.GPIO as GPIO > GPIO.setmode(GPIO.BCM) > > GPIO.setup(17, GPIO.IN) > GPIO.setup(18

Re: what is the easiest way to install multiple Python versions?

2014-10-12 Thread Gayathri J
I have been using Anaconda's (Continnum) conda installation for system installation (python 2.7) and for python 3 conda lets us maintain diferent environments with different python and different combinations of other packages like numpy etc... sure not to disappoint! On 10/12/14, Albert-Jan Ros

what is wrong with this script and how do I get the value in a php script

2014-10-12 Thread martijnperdaan
what is wrong with this script and how do I get the value Rij1 and Rij2 and Rij3 and Rij4 and Rij5 and Rij6 in a php script import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(17, GPIO.IN) GPIO.setup(18, GPIO.IN) GPIO.setup(21, GPIO.IN) GPIO.setup(22, GPIO.IN) GPIO.setup(23, GPIO.IN) GPIO.

Re: what is the easiest way to install multiple Python versions?

2014-10-12 Thread Chris Angelico
On Mon, Oct 13, 2014 at 12:33 AM, Albert-Jan Roskam wrote: > *) Make altinstall > sudo apt-get install libsqlite3-dev libbz2-dev libgdbm-dev libncurses5-dev > tk-dev zlib1g-dev > wget https://www.python.org/ftp/python/2.6.8/Python-2.6.8.tgz > tar -zxvf Python-2.6.8.tgz > cd Python-2.6.8/ > ./conf

Re: Flask and Django

2014-10-12 Thread Chris Angelico
On Sat, Oct 11, 2014 at 9:22 AM, Juan Christian wrote: > So, I'm already familiar with Flask and I fell comfortable using it, but I > see that no one uses it in "real business", everywhere I look regarding jobs > and web dev, people always talk about Django, no one mentions Flask, no one > uses Fl

Re: TypeError: 'kwarg' is an invalid keyword argument for this function

2014-10-12 Thread Rustom Mody
Whats the problem?? Seems to work (python 2.7.8) [Ive added a line so that that you can see] class C: def __init__(self): pass class C2(C): def __init__(self, *args, **kwargs): self.dic = kwargs pass x = C2(kwarg='a') y = C2(kwarg='a', kwarg2=8) ==

Re: Flask and Django

2014-10-12 Thread Juan Christian
Anyone? On Fri, Oct 10, 2014 at 7:22 PM, Juan Christian wrote: > So, I'm already familiar with Flask and I fell comfortable using it, but I > see that no one uses it in "real business", everywhere I look regarding > jobs and web dev, people always talk about Django, no one mentions Flask, > no o

what is the easiest way to install multiple Python versions?

2014-10-12 Thread Albert-Jan Roskam
Hi, (sorry for cross-posting) A few days ago I needed to check whether some Python code ran with Python 2.6. What is the easiest way to install another Python version along side the default Python version? My own computer is Debian Linux 64 bit, but a platform-independent solution would be bes

TypeError: 'kwarg' is an invalid keyword argument for this function

2014-10-12 Thread roro codeath
How to implement it in my class? class Str(str): def __init__(self, *args, **kwargs): pass Str('smth', kwarg='a') # How to implement in my class class C: def __init__(self): pass class C2(C): def __init__(self, *args, **kwargs): pass C2(kwarg='a') -- https://

Re: Parse bad xml file

2014-10-12 Thread Rustom Mody
On Friday, October 10, 2014 6:03:58 PM UTC+5:30, David Jobes wrote: > On Friday, October 10, 2014 8:21:17 AM UTC-4, Peter Otten wrote: > That did it, thank you, and in a lot fewer lines of code than i had, i was > trying to use strings and regex. i will read up more on the xml.etree stuff. Tho

[RELEASED] Python 3.2.6, Python 3.3.6

2014-10-12 Thread Georg Brandl
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On behalf of the Python development team, I'm happy to announce the release of Python 3.2.6 and 3.3.6. Both are security-fix releases, which are provided source-only on python.org. The list of security-related issues fixed in the releases is given in