Re: Blog "about python 3"

2013-12-31 Thread Mark Lawrence

On 30/12/2013 22:38, Ethan Furman wrote:

On 12/30/2013 01:29 PM, Mark Lawrence wrote:

On 30/12/2013 20:49, Steven D'Aprano wrote:

On Mon, 30 Dec 2013 19:41:44 +, Mark Lawrence wrote:


http://alexgaynor.net/2013/dec/30/about-python-3/ may be of interest to
some of you.


I don't know whether to thank you for the link, or shout at you for
sending eyeballs to look at such a pile of steaming bullshit.


http://nuitka.net/posts/re-about-python-3.html is a response.


Wow -- another steaming pile!  Mark, are you going for a record?  ;)

--
~Ethan~


I wasn't, but I am now 
http://blog.startifact.com/posts/alex-gaynor-on-python-3.html. "The 
Python core developers somewhat gleefully slammed the door shut on 
Python 2.8 back in 2011, though.", which refers to PEP 404 which I 
mentioned a month or so ago.


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Re: Python 2.x and 3.x usage survey

2013-12-31 Thread Mark Lawrence

On 30/12/2013 21:56, Dan Stromberg wrote:

I keep hearing naysayers, nay saying about Python 3.x.

Here's a 9 question, multiple choice survey I put together about
Python 2.x use vs Python 3.x use.

I'd be very pleased if you could take 5 or 10 minutes to fill it out.

Here's the URL:
https://www.surveymonkey.com/s/N5N5PG2



People using 1.x will be miffed as their baby has been missed out :)

--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Re: Blog "about python 3"

2013-12-31 Thread Steven D'Aprano
Steven D'Aprano wrote:

> On Mon, 30 Dec 2013 19:41:44 +, Mark Lawrence wrote:
> 
>> http://alexgaynor.net/2013/dec/30/about-python-3/ may be of interest to
>> some of you.
[...]
> I'd like to know where Alex gets the idea that the transition of Python 2
> to 3 was supposed to be a five year plan. As far as I know, it was a ten
> year plan, 

I haven't been able to find anything in writing from Guido or the core
developers stating that the transition period was expected to be ten years,
although I haven't looked very hard. I strongly recall it being discussed,
so unless you want to trawl the python-dev mailing list, you'll just have
to take my word on it *wink*

PEP 3000 makes it clear that Guido van Rossum expected the transition period
to be longer than usual:

[quote]
I expect that there will be parallel Python 2.x and 3.x releases 
for some time; the Python 2.x releases will continue for a longer 
time than the traditional 2.x.y bugfix releases. Typically, we 
stop releasing bugfix versions for 2.x once version 2.(x+1) has 
been released. But I expect there to be at least one or two new 2.x
releases even after 3.0 (final) has been released, probably well 
into 3.1 or 3.2.
[end quote]

http://www.python.org/dev/peps/pep-3000/

A five year transition period, as suggested by Alex Gaynor, simply makes no
sense. Normal support for a single release is four or five years, e.g.
Python 2.4 and 2.5 release schedules:

* Python 2.4 alpha-1 was released on July 9 2004; the final security 
  update was December 19 2008; 

* Python 2.5 alpha-1 was released on April 5 2006; the final security
  update was May 26 2011.

(Dates may be approximate, especially the alpha dates. I'm taking them from
PEP 320 and 356.)

Now in fairness, Guido's comment about "well into 3.1 or 3.2" turned out to
be rather naive in retrospect. 3.4 alpha has been released, and support for
2.7 is expected to continue for *at least* two more years:

http://www.python.org/dev/peps/pep-0373/#maintenance-releases

which means that 2.7 probably won't become unmaintained until 3.5 is out. In
hindsight, this is probably a good thing. The early releases of 3.x made a
few mistakes, and it's best to skip them and go straight to 3.3 or better,
for example:

- 3.0 was buggy enough that support for it was dropped almost immediately;

- built-in function callable() is missing from 3.1;

- 3.1 and 3.2 both have exception chaining, but there's no way to 
  suppress the chained exceptions until 3.3;

- 3.1 and 3.2 don't allow u'' strings for compatibility with 2.x.


The 2.8 un-release schedule goes into more detail about the transition, and
why there won't be an official 2.8 blessed by the core developers:

http://www.python.org/dev/peps/pep-0404/

(Python is open source -- nothing is stopping people from forking the
language or picking up support for 2.7. I wonder how many Python3 naysayers
volunteer to support 2.x once the core devs drop it?)

As of June this year, over 75% of the top fifty projects hosted on PyPI
supported Python 3:

http://py3ksupport.appspot.com/

and the Python Wall Of Shame turned majority green, becoming the Wall Of
Superpowers, at least six months ago. (Back in June, I noted that it had
changed colour some time ago.) Alex's claim that "almost no code is written
for Python 3" is, well, I'll be kind and describe it as counter-factual.

Alex points out that the companies he is speaking to have no plans to
migrate to Python 3. Well, duh. In my experience, most companies don't even
begin planning to migrate until six months *after* support has ended for
the systems they rely on. (Perhaps a tiny exaggeration, but not much.)

I won't speak for the Windows or Mac world, but in the Linux world, Python 3
usage depends on the main Linux distros. Yes, ArchLinux has been Python 3
for years now, but ArchLinux is bleeding edge. Fedora is likely to be the
first mainstream distro to move to Python 3:

https://fedoraproject.org/wiki/Changes/Python_3_as_Default

Once Fedora moves, I expect Ubuntu will follow. Debian, Centos and RedHat
will probably be more conservative, but they *will* follow, at their own
pace. What are the alternatives? They're not going to drop Python, nor are
they going to take over support of 2.x forever. (RedHat/Centos are still
supporting Python 2.4 and possibly even 2.3, at least in name, but I
haven't seen any security updates come through Centos for a long time.)
Once the system Python is Python 3, the default, no-brainer choice for most
Python coding will be Python 3.

Alex says:

[quote]
Why aren't people using Python 3?

First, I think it's because of a lack of urgency. Many years ago, 
before I knew how to program, the decision to have Python 3 
releases live in parallel to Python 2 releases was made. In 
retrospect this was a mistake, it resulted in a complete lack 
of urgency for the community to move, and the lack of urgency 
has given way to letharg

Re: Blog "about python 3"

2013-12-31 Thread Steven D'Aprano
Mark Lawrence wrote:

> http://blog.startifact.com/posts/alex-gaynor-on-python-3.html.

I quote:

"...perhaps a brave group of volunteers will stand up and fork Python 2, and
take the incremental steps forward. This will have to remain just an idle
suggestion, as I'm not volunteering myself."

I expect that as excuses for not migrating get fewer, and the deadline for
Python 2.7 end-of-life starts to loom closer, more and more haters^W
Concerned People will whine about the lack of version 2.8 and ask for
*somebody else* to fork Python.

I find it, hmmm, interesting, that so many of these Concerned People who say
that they're worried about splitting the Python community[1] end up
suggesting that we *split the community* into those who have moved forward
to Python 3 and those who won't.





[1] As if the community is a single amorphous group. It is not. It is made
up of web developers using Zope or Django, and scientists using scipy, and
linguists using NLTK, and system administrators using nothing but the
stdlib, and school kids learning how to program, and professionals who know
seventeen different programming languages, and EVE Online gamers using
Stackless, and Java guys using Jython, and many more besides, most of whom
are sure that their little tiny part of the Python ecosystem is
representative of everyone else when in fact they hardly talk at all.

-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Mailing list erraticness

2013-12-31 Thread Devin Jeanpierre
I can't tell from your email who the original author of the forwarded
email is. :(

On Mon, Dec 30, 2013 at 9:19 PM, Ethan Furman  wrote:
> More mailing list erraticness:
> I see Ethan's comment on Devin but not Devin's post
> Neither in GG nor in my email

Nor on the archives:
https://mail.python.org/pipermail/python-list/2013-December/thread.html

I'd be interested in understanding what happened. The message was sent
to Ethan Furman  and Cc'd to "comp.lang.python"
.

-- Devin
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Blog "about python 3"

2013-12-31 Thread Devin Jeanpierre
On Mon, Dec 30, 2013 at 2:38 PM, Ethan Furman  wrote:
> Wow -- another steaming pile!  Mark, are you going for a record?  ;)

Indeed. Every post that disagrees with my opinion and understanding of
the situation is complete BS and a conspiracy to spread fear,
uncertainty, and doubt. Henceforth I will explain few to no specific
disagreements, nor will I give anyone the benefit of the doubt,
because that would be silly.

-- Devin
-- 
https://mail.python.org/mailman/listinfo/python-list


Fwd: Mailing list erraticness

2013-12-31 Thread Rustom Mody
On Tue, Dec 31, 2013 at 10:03 AM, Ethan Furman  wrote:
> On 12/30/2013 08:25 PM, Devin Jeanpierre wrote:
>>
>> On Mon, Dec 30, 2013 at 2:38 PM, Ethan Furman  wrote:
>>>
>>> Wow -- another steaming pile!  Mark, are you going for a record?  ;)
>>
>>
>> Indeed. Every post that disagrees with my opinion and understanding of
>> the situation is complete BS and a conspiracy to spread fear,
>> uncertainty, and doubt. Henceforth I will explain few to no specific
>> disagreements, nor will I give anyone the benefit of the doubt,
>> because that would be silly.
>
>
> Couldn't of said it better myself!  Well, except for the "my opinion" part
> -- obviously it's not my opinion, but reality!  ;)

More mailing list erraticness:
I see Ethan's comment on Devin but not Devin's post
Neither in GG nor in my email
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 2.x and 3.x usage survey

2013-12-31 Thread Steven D'Aprano
Mark Lawrence wrote:

> On 30/12/2013 21:56, Dan Stromberg wrote:
>> I keep hearing naysayers, nay saying about Python 3.x.
>>
>> Here's a 9 question, multiple choice survey I put together about
>> Python 2.x use vs Python 3.x use.
>>
>> I'd be very pleased if you could take 5 or 10 minutes to fill it out.
>>
>> Here's the URL:
>> https://www.surveymonkey.com/s/N5N5PG2
>>
> 
> People using 1.x will be miffed as their baby has been missed out :)

You laugh, but there was at least one attendee at the last PyCon who was
still using 1.5 professionally. Software never quite dies so long as there
is hardware capable of running it.


-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Blog "about python 3"

2013-12-31 Thread Antoine Pitrou
Steven D'Aprano  pearwood.info> writes:
> 
> I expect that as excuses for not migrating get fewer, and the deadline for
> Python 2.7 end-of-life starts to loom closer, more and more haters^W
> Concerned People will whine about the lack of version 2.8 and ask for
> *somebody else* to fork Python.
> 
> I find it, hmmm, interesting, that so many of these Concerned People who say
> that they're worried about splitting the Python community[1] end up
> suggesting that we *split the community* into those who have moved forward
> to Python 3 and those who won't.

Indeed. This would be extremely destructive (not to mention alienating the
people doing *actual* maintenance and enhancements on Python-and-its-stdlib,
of which at least 95% are committed to the original plan for 3.x to slowly
supercede 2.x).

Regards

Antoine.


-- 
https://mail.python.org/mailman/listinfo/python-list


PyImport_ImportModule(..) returns NULL

2013-12-31 Thread python satya
Hi,
  I am new to python, am trying to use embedding python API's in
C,as below

I have my python file test.py in  "/var/tmp" path and trying to fetch
objects and functions from python script as below, but
PyImport_ImportModule("test") returning NULL always(instead adding /var/tmp
path to syspath)

Please let me know, how to solve this?

$% more /var/tmp/test.py
#!/usr/bin/python

import sys

input = ""

==
#include 
#include 
#include 

int main(void)
{
const char *scriptDirectoryName = "/var/tmp";
Py_Initialize();
PyObject *sysPath = PySys_GetObject("path");
PyObject *path = PyString_FromString(scriptDirectoryName);
PyList_Insert(sysPath, 0, path);
PyObject *pModule = PyImport_ImportModule("test");
if (pModule == NULL) {
fp = fopen("/var/tmp/abc.txt", "w");
fprintf(fp, "Fail to search in /var/tmp path");
fclose(fp);
} else {
   /* Read input object ... */
   }

Py_Finalize();
return 0;
}



$% more /var/tmp/abc.txt
Fail to search in /var/tmp path

Thanks,
Satya
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 2.x and 3.x usage survey

2013-12-31 Thread Roy Smith
In article <[email protected]>,
 Steven D'Aprano  wrote:

> Mark Lawrence wrote:
> 
> > On 30/12/2013 21:56, Dan Stromberg wrote:
> >> I keep hearing naysayers, nay saying about Python 3.x.
> >>
> >> Here's a 9 question, multiple choice survey I put together about
> >> Python 2.x use vs Python 3.x use.
> >>
> >> I'd be very pleased if you could take 5 or 10 minutes to fill it out.
> >>
> >> Here's the URL:
> >> https://www.surveymonkey.com/s/N5N5PG2
> >>
> > 
> > People using 1.x will be miffed as their baby has been missed out :)
> 
> You laugh, but there was at least one attendee at the last PyCon who was
> still using 1.5 professionally. Software never quite dies so long as there
> is hardware capable of running it.

Oh, that's absurd.  He should have at least upgraded to 1.6.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Blog "about python 3"

2013-12-31 Thread Roy Smith
In article ,
 Antoine Pitrou  wrote:

> Steven D'Aprano  pearwood.info> writes:
> > 
> > I expect that as excuses for not migrating get fewer, and the deadline for
> > Python 2.7 end-of-life starts to loom closer, more and more haters^W
> > Concerned People will whine about the lack of version 2.8 and ask for
> > *somebody else* to fork Python.
> > 
> > I find it, hmmm, interesting, that so many of these Concerned People who say
> > that they're worried about splitting the Python community[1] end up
> > suggesting that we *split the community* into those who have moved forward
> > to Python 3 and those who won't.
> 
> Indeed. This would be extremely destructive (not to mention alienating the
> people doing *actual* maintenance and enhancements on Python-and-its-stdlib,
> of which at least 95% are committed to the original plan for 3.x to slowly
> supercede 2.x).
> 
> Regards
> 
> Antoine.

I'm using 2.7 in production.  I realize that at some point we'll need to 
upgrade to 3.x.  We'll keep putting that off as long as the "effort + 
dependencies + risk" metric exceeds the "perceived added value" metric.

I can't imagine the migration will happen in 2014.  Maybe not even in 
2015.  Beyond that, my crystal ball only shows darkness.  But, in any 
case, going with a fork of 2.x has zero appeal.  Given the choice 
between effort + risk to move forward vs. effort + risk to move 
sideways, I'll move forward every time.

To be honest, the "perceived added value" in 3.x is pretty low for us.  
What we're running now works.  Switching to 3.x isn't going to increase 
our monthly average users, or our retention rate, or decrease our COGS, 
or increase our revenue.  There's no killer features we need.  In 
summary, the decision to migrate will be driven more by risk aversion, 
when the risk of staying on an obsolete, unsupported platform, exceeds 
the risk of moving to a new one.  Or, there will be some third-party 
module that we must have which is no longer supported on 2.x.

If I were starting a new project today, I would probably start it in 3.x.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Blog "about python 3"

2013-12-31 Thread Chris Angelico
On Wed, Jan 1, 2014 at 2:41 AM, Roy Smith  wrote:
> To be honest, the "perceived added value" in 3.x is pretty low for us.
> What we're running now works.  Switching to 3.x isn't going to increase
> our monthly average users, or our retention rate, or decrease our COGS,
> or increase our revenue.  There's no killer features we need.  In
> summary, the decision to migrate will be driven more by risk aversion,
> when the risk of staying on an obsolete, unsupported platform, exceeds
> the risk of moving to a new one.  Or, there will be some third-party
> module that we must have which is no longer supported on 2.x.

The biggest killer feature for most deployments is likely to be that
Unicode "just works" everywhere. Any new module added to Py3 can be
back-ported to Py2 (with some amount of work - might be trivial, might
be a huge job), and syntactic changes are seldom a "killer feature",
but being able to depend on *every single library function* working
perfectly with the full Unicode range means you don't have to test
every branch of your code.

If that's not going to draw you, then yeah, there's not a lot to
justify switching. You won't get more users, it'll increase your costs
(though by a fixed amount, not an ongoing cost), and old code is
trustworthy code, new code is bug city.

> If I were starting a new project today, I would probably start it in 3.x.

And that's the right attitude (though I would drop the "probably").
Eventually it'll become more critical to upgrade (once Py2 security
patches stop coming through, maybe), and when that day does finally
come, you'll be glad you have just your 2013 codebases rather than the
additional ones dating from 2014 and on until whatever day that is.
The past is Py2; the future is Py3. In between, use whichever one
makes better business sense.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Blog "about python 3"

2013-12-31 Thread Mark Lawrence

On 31/12/2013 15:41, Roy Smith wrote:

In article ,
  Antoine Pitrou  wrote:


Steven D'Aprano  pearwood.info> writes:


I expect that as excuses for not migrating get fewer, and the deadline for
Python 2.7 end-of-life starts to loom closer, more and more haters^W
Concerned People will whine about the lack of version 2.8 and ask for
*somebody else* to fork Python.

I find it, hmmm, interesting, that so many of these Concerned People who say
that they're worried about splitting the Python community[1] end up
suggesting that we *split the community* into those who have moved forward
to Python 3 and those who won't.


Indeed. This would be extremely destructive (not to mention alienating the
people doing *actual* maintenance and enhancements on Python-and-its-stdlib,
of which at least 95% are committed to the original plan for 3.x to slowly
supercede 2.x).

Regards

Antoine.


I'm using 2.7 in production.  I realize that at some point we'll need to
upgrade to 3.x.  We'll keep putting that off as long as the "effort +
dependencies + risk" metric exceeds the "perceived added value" metric.



Do you use any of the features that were backported from 3.x to 2.7, or 
could you have stayed with 2.6 or an even older version?


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Python/Django Extract and append only new links

2013-12-31 Thread Max Cuban
 I am putting together a project using Python 2.7 Django 1.5 on Windows 7.
I believe this should be on the django group but I haven't had help from
there so I figured I would try the python list
I have the following view:
views.py:

def foo():
site = "http://www.foo.com/portal/jobs";
hdr = {'User-Agent' : 'Mozilla/5.0'}
req = urllib2.Request(site, headers=hdr)
jobpass = urllib2.urlopen(req)
soup = BeautifulSoup(jobpass)
for tag in soup.find_all('a', href = True):
tag['href'] = urlparse.urljoin('http://www.businessghana.com/portal/',
tag['href'])
return map(str, soup.find_all('a', href = re.compile('.getJobInfo')))
def example():
site = "http://example.com";
hdr = {'User-Agent' : 'Mozilla/5.0'}
req = urllib2.Request(site, headers=hdr)
jobpass = urllib2.urlopen(req)
soup = BeautifulSoup(jobpass)
return map(str, soup.find_all('a', href = re.compile('.display-job')))
 foo_links = foo()
 example_links = example()
def all_links():
return (foo_links + example_links)
def display_links(request):
name = all_links()
paginator = Paginator(name, 25)
page = request.GET.get('page')
try:
name = paginator.page(page)
except PageNotAnInteger:
name = paginator.page(1)
except EmptyPage:
name = paginator.page(paginator.num_pages)
return render_to_response('jobs.html', {'name' : name})

My template looks like this:


{% for link in name %}
   {{ link|safe }}
{% endfor %}
 
 

{% if name.has_previous %}
Previous
{% endif %}

Page {{ name.number }} of {{ name.paginator.num_pages}}.

{% if name.has_next %}
next
{% endif %}

 

 Right now as my code stands, anytime I run it, it scraps all the links on
the frontpage of the sites selected and presents them paginated *all afresh*.
However, I don't think its a good idea for the script to read/write all the
links that had previously extracted links all over again and therefore
would like to check for and append only new links. I would like to save the
previously scraped links so that over the course of say, a week, all the
links that have appeared on the frontpage of these sites will be available
on my site as older pages.

It's my first programming project and don't know how to incorporate this
logic into my code.

Any help/pointers/references will be greatly appreciated.

regards, Max
-- 
https://mail.python.org/mailman/listinfo/python-list


looking for a quote on age and technology

2013-12-31 Thread Rustom Mody
There is a quote which I vaguely remember seeing on this list.
It went something like this: (yeah my rendering is poor)

For a new technology:
  If you are a kid when it comes out, you just take it as a matter of course
  If you are a young adult, then it becomes a hot topic for discussion
  If you are past middle-age you never get it

Anyone knows/remembers it?
-- 
https://mail.python.org/mailman/listinfo/python-list


lookup xpath (other?) to value in html

2013-12-31 Thread Vincent Davis
I have a about 255 data fields that I am trying to verify on thousands of
webpages.
For example:
value: 255,000
sqft: 1800

Since I have the correct answer for several pages I would like to lookup
get the location (xpath?) of the data/field value in the page so that I can
check other pages.

Any suggestions?

Vincent Davis
720-301-3003
-- 
https://mail.python.org/mailman/listinfo/python-list


What does --no-skip do in nose?

2013-12-31 Thread Roy Smith
Environment:
  Python 2.7.3
  nose 1.3.0
  Ubuntu 12.04 Linux

I'm befuddled about how test skipping, and in particular, --no-skip,
is supposed to work in nose.  I've got a trivial test file:

> from nose import SkipTest
> def test_skip():
> raise SkipTest
> assert 0

If I run this, it skips the test, as expected:


> $ nosetests try.py
> S
> --
> Ran 1 test in 0.001s
> 
> OK (SKIP=1)


What's confusing is, if I use --no-skip, it STILL skips the test:

> $ nosetests --no-skip try.py
> 
> --
> Ran 1 test in 0.001s
> 
> OK

The only difference is it doesn't print the "S".  Am I just
mis-understanding what --no-skip is supposed to do?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: looking for a quote on age and technology

2013-12-31 Thread Joel Goldstick
On Tue, Dec 31, 2013 at 12:00 PM, Rustom Mody  wrote:

> There is a quote which I vaguely remember seeing on this list.
> It went something like this: (yeah my rendering is poor)
>
> For a new technology:
>   If you are a kid when it comes out, you just take it as a matter of
> course
>   If you are a young adult, then it becomes a hot topic for discussion
>   If you are past middle-age you never get it
>
> Anyone knows/remembers it?
> --
> https://mail.python.org/mailman/listinfo/python-list
>


sorry, don't remember it, but I disagree.  I'm pretty old (b. 1953) and
sometimes younger people think they get something that really isn't that
impressive.  I have an android phone and I like it, but as a phone,
compared to phones that sit on a desk it totally sucks.

And then there was the pet rock!

happy new year!


-- 
Joel Goldstick
http://joelgoldstick.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: looking for a quote on age and technology

2013-12-31 Thread Rustom Mody
On Tue, Dec 31, 2013 at 10:30 PM, Rustom Mody  wrote:
> There is a quote which I vaguely remember seeing on this list.
> It went something like this: (yeah my rendering is poor)
>
> For a new technology:
>   If you are a kid when it comes out, you just take it as a matter of course
>   If you are a young adult, then it becomes a hot topic for discussion
>   If you are past middle-age you never get it
>
> Anyone knows/remembers it?

And since the capacitance of the ether where mails seem to hang in
limbo after being sent and before being received seems now to be
reaching 24 hours, heres a
Happy New Year to all!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: looking for a quote on age and technology

2013-12-31 Thread Gene Heskett
On Tuesday 31 December 2013 13:19:21 Joel Goldstick did opine:

> On Tue, Dec 31, 2013 at 12:00 PM, Rustom Mody  
wrote:
> > There is a quote which I vaguely remember seeing on this list.
> > It went something like this: (yeah my rendering is poor)
> > 
> > For a new technology:
> >   If you are a kid when it comes out, you just take it as a matter of
> > 
> > course
> > 
> >   If you are a young adult, then it becomes a hot topic for discussion
> >   If you are past middle-age you never get it
> > 
> > Anyone knows/remembers it?
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> 
> sorry, don't remember it, but I disagree.  I'm pretty old (b. 1953) and
> sometimes younger people think they get something that really isn't that
> impressive.  I have an android phone and I like it, but as a phone,
> compared to phones that sit on a desk it totally sucks.
> 
> And then there was the pet rock!

Chuckle.  I had heard of it, but had not seen one until it showed up on the 
desk of a wannabe salesgal at the tv station I was the CE at back then, as 
somewhat smaller than a baseball and worn somewhat flattened by 20,000 
years of rolling along a river bottom.  It had a magic markered "Turn me 
over" on the top, so as it didn't look big enough to hide one of the local 
scorpions (this was New Mexico folks), I did, to be greeted with "Thanks, 
that felt good" on the other side.  And that was my intro to the craziness 
that was pet rocks.  I even recall at the peak of it, somebody was selling 
sandwich baggies of sand as pet rock food.  I was not impressed by other 
than the crowd mentality of such idiocy.

> happy new year!

Now theres a motion I'll second, have a happy, healthy, and prosperous new 
year all.

Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page 

"Don't hate me because I'm beautiful.  Hate me because I'm beautiful, smart
and rich."
-- Calvin Keegan
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
 law-abiding citizens.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: looking for a quote on age and technology

2013-12-31 Thread Rustom Mody
On Tue, Dec 31, 2013 at 10:40 PM, Joel Goldstick wrote:
>
>
> On Tue, Dec 31, 2013 at 12:00 PM, Rustom Mody  wrote:
>>
>> There is a quote which I vaguely remember seeing on this list.
>> It went something like this: (yeah my rendering is poor)
>>
>> For a new technology:
>>   If you are a kid when it comes out, you just take it as a matter of
>> course
>>   If you are a young adult, then it becomes a hot topic for discussion
>>   If you are past middle-age you never get it
>>
>> Anyone knows/remembers it?
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>
>
>
> sorry, don't remember it, but I disagree.  I'm pretty old (b. 1953) and
> sometimes younger people think they get something that really isn't that
> impressive.

You are disagreeing with a contrapositive:
That the oldies dont get it does not mean the young 'uns do!
In fact the whole point of that quote (however it went!) was that in
different ways no one 'gets' it

>  I have an android phone and I like it, but as a phone, compared
> to phones that sit on a desk it totally sucks.

I am reminded of a famous quote :
I have always wished for my computer to be as easy to use as my
telephone; my wish has come true because I can no longer figure out
how to use my telephone.
---
The double irony is the (supposed) utterer:
http://en.wikiquote.org/wiki/Bjarne_Stroustrup
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What does --no-skip do in nose?

2013-12-31 Thread Chris Angelico
On Wed, Jan 1, 2014 at 4:49 AM, Roy Smith  wrote:
>> from nose import SkipTest
>> def test_skip():
>> raise SkipTest
>> assert 0
>
> What's confusing is, if I use --no-skip, it STILL skips the test:
>

I don't know nosetests, but I'm fairly sure it's not going to be
mangling the Python language itself. Once you say "raise", the rest of
the code isn't going to run. If you were calling "skip_test()", then I
could imagine it either raising SkipTest or not based on a
command-line parameter, but if there's no such function and you
directly raise the exception, there's not a lot else Python can do.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: lookup xpath (other?) to value in html

2013-12-31 Thread Jason Friedman
> I have a about 255 data fields that I am trying to verify on thousands of
> webpages.
> For example:
> value: 255,000
> sqft: 1800
> 
> Since I have the correct answer for several pages I would like to lookup get
> the location (xpath?) of the data/field value in the page so that I can
> check other pages.

I'm not sure what you are looking for.  Do you have a sample web page,
and can you show us the output you'd like to see from that webpage?
Have you looked at http://www.crummy.com/software/BeautifulSoup/?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What does --no-skip do in nose?

2013-12-31 Thread Ned Batchelder

On 12/31/13 12:49 PM, Roy Smith wrote:

Environment:
   Python 2.7.3
   nose 1.3.0
   Ubuntu 12.04 Linux

I'm befuddled about how test skipping, and in particular, --no-skip,
is supposed to work in nose.  I've got a trivial test file:


from nose import SkipTest
def test_skip():
 raise SkipTest
 assert 0


If I run this, it skips the test, as expected:



$ nosetests try.py
S
--
Ran 1 test in 0.001s

OK (SKIP=1)



What's confusing is, if I use --no-skip, it STILL skips the test:


$ nosetests --no-skip try.py

--
Ran 1 test in 0.001s

OK


The only difference is it doesn't print the "S".  Am I just
mis-understanding what --no-skip is supposed to do?



I don't understand why, but my tests confirm what you found: if a test 
raises SkipTest, then it is marked as an S, and included in the count of 
tests run.  If you run with --no-skip, then the result of the test isn't 
displayed in the dots at all, but the test is still included in the 
total count:


$ nosetests
F.S
==
FAIL: test_fail (test_foo.Test)
--
Traceback (most recent call last):
  File "/Users/ned/lab/test_foo.py", line 8, in test_fail
assert 0
AssertionError

--
Ran 3 tests in 0.004s

FAILED (SKIP=1, failures=1)

$ nosetests --no-skip
F.
==
FAIL: test_fail (test_foo.Test)
--
Traceback (most recent call last):
  File "/Users/ned/lab/test_foo.py", line 8, in test_fail
assert 0
AssertionError

--
Ran 3 tests in 0.003s

FAILED (failures=1)


--
Ned Batchelder, http://nedbatchelder.com

--
https://mail.python.org/mailman/listinfo/python-list


Re: [sqlite] Happy New Year

2013-12-31 Thread Ryan Finnesey
Happy New Year to you as well. 

Sent from my iPad

> On Dec 31, 2013, at 7:46 PM, "Igor Korot"  wrote:
> 
> Hi, ALL,
> I want to wish everybody who is reading and involved with the list
> Happy and oyful New Year!
> Let's have a great time in it and lets make a lot of good products and
> new releases with the software that everybody involve with.
> 
> Thank you.
> ___
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: lookup xpath (other?) to value in html

2013-12-31 Thread Vincent Davis
>
> I'm not sure what you are looking for.  Do you have a sample web page,
> and can you show us the output you'd like to see from that webpage?
> Have you looked at http://www.crummy.com/software/BeautifulSoup/?


For example this URL;
http://jeffco.us/ats/displaygeneral.do?sch=001690
The the land sqft is 11082.
Google Chrome gives me the xpath to that data as;
//*[@id="content"]/p[1]/table[4]/tbody/tr[2]/td[8]

What I would like to do (using python) is given 11082 at what xpath can
that be found? (may be more that one)
The examples I can find using google refer to, given xpath what is the
value (the opposite of what I want)

Vincent Davis


On Tue, Dec 31, 2013 at 6:45 PM, Jason Friedman  wrote:

> > I have a about 255 data fields that I am trying to verify on thousands of
> > webpages.
> > For example:
> > value: 255,000
> > sqft: 1800
> > 
> > Since I have the correct answer for several pages I would like to lookup
> get
> > the location (xpath?) of the data/field value in the page so that I can
> > check other pages.
>
> I'm not sure what you are looking for.  Do you have a sample web page,
> and can you show us the output you'd like to see from that webpage?
> Have you looked at http://www.crummy.com/software/BeautifulSoup/?
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: lookup xpath (other?) to value in html

2013-12-31 Thread Jason Friedman
> For example this URL;
> http://jeffco.us/ats/displaygeneral.do?sch=001690
> The the land sqft is 11082.
> Google Chrome gives me the xpath to that data as;
> //*[@id="content"]/p[1]/table[4]/tbody/tr[2]/td[8]
>
> What I would like to do (using python) is given 11082 at what xpath can that
> be found? (may be more that one)
> The examples I can find using google refer to, given xpath what is the value
> (the opposite of what I want)

Which Chrome extension are you using to get that path?

Are you always interested in the square footage?  Here is a solution
using Beautiful Soup:

$ cat square-feet.py
#!/usr/bin/env python
import bs4
import requests
import sys
url = sys.argv[1]
request = requests.get(url)
soup = bs4.BeautifulSoup(request.text)
is_sqft_mark_found, is_total_mark_found = False, False
for line in soup.get_text().splitlines():
if line.startswith("Land Sqft"):
is_sqft_mark_found = True
continue
elif is_sqft_mark_found and line.startswith("Total"):
is_total_mark_found = True
continue
elif is_total_mark_found:
print(line.strip() + " total square feet.")
break

$ python3 square-feet.py http://jeffco.us/ats/displaygeneral.do?sch=001690
11082 total square feet.
-- 
https://mail.python.org/mailman/listinfo/python-list


PySerial for Python 2 vs. Python 3

2013-12-31 Thread Travis McGee
I've been working with a simple serial device that attaches to a USB 
port. It takes as commands short strings.


I wanted to use PySerial under Python 3, and, of course had the Devil's 
own time getting it installed and working since everything is geared 
towards Python 2.


Anyway, I finally got it installed, but when I try to use a statement of 
the sort ser.write("string") I get an exception which seems to imply 
that the argument needs to be an integer, rather than a string.


With some minor adjustments it works just fine under Python 2, so, in a 
sense, this is a non-issue. However, I'd be interested to hear from 
anyone who can comment on what the problem is.


Thanks,

Travis
--
https://mail.python.org/mailman/listinfo/python-list


Re: PySerial for Python 2 vs. Python 3

2013-12-31 Thread Devin Jeanpierre
On Tue, Dec 31, 2013 at 10:39 PM, Travis McGee  wrote:
> Anyway, I finally got it installed, but when I try to use a statement of the
> sort ser.write("string") I get an exception which seems to imply that the
> argument needs to be an integer, rather than a string.

You will get the most help if you provide a minimal, self-contained,
runnable example, and an example of its exact output.

-- Devin
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PySerial for Python 2 vs. Python 3

2013-12-31 Thread Chris Angelico
On Wed, Jan 1, 2014 at 5:39 PM, Travis McGee  wrote:
> Anyway, I finally got it installed, but when I try to use a statement of the
> sort ser.write("string") I get an exception which seems to imply that the
> argument needs to be an integer, rather than a string.

Quoting the full exception would help!

My suspicion is that it works with byte strings, not Unicode strings.
So you could do:

ser.write(b"string")

or:

ser.write("string".encode())

to turn it into a stream of bytes (the latter uses UTF-8, the former
would use your source file encoding).

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: lookup xpath (other?) to value in html

2013-12-31 Thread Vincent Davis
>
> Which Chrome extension are you using to get that path?

Built in, right click on source > copy xpath​​

Ya that gets square footage and I like how you did it, are you interested
in doing that for all information on the page and also the historical pages
;-)
Since I have the data for some of the pages, I got this from the county on
a cd, I thought defining the xpath would be easier using bs4 or
http://lxml.de/




Vincent Davis
720-301-3003


On Tue, Dec 31, 2013 at 10:30 PM, Jason Friedman  wrote:

> > For example this URL;
> > http://jeffco.us/ats/displaygeneral.do?sch=001690
> > The the land sqft is 11082.
> > Google Chrome gives me the xpath to that data as;
> > //*[@id="content"]/p[1]/table[4]/tbody/tr[2]/td[8]
> >
> > What I would like to do (using python) is given 11082 at what xpath can
> that
> > be found? (may be more that one)
> > The examples I can find using google refer to, given xpath what is the
> value
> > (the opposite of what I want)
>
> Which Chrome extension are you using to get that path?
>
> Are you always interested in the square footage?  Here is a solution
> using Beautiful Soup:
>
> $ cat square-feet.py
> #!/usr/bin/env python
> import bs4
> import requests
> import sys
> url = sys.argv[1]
> request = requests.get(url)
> soup = bs4.BeautifulSoup(request.text)
> is_sqft_mark_found, is_total_mark_found = False, False
> for line in soup.get_text().splitlines():
> if line.startswith("Land Sqft"):
> is_sqft_mark_found = True
> continue
> elif is_sqft_mark_found and line.startswith("Total"):
> is_total_mark_found = True
> continue
> elif is_total_mark_found:
> print(line.strip() + " total square feet.")
> break
>
> $ python3 square-feet.py http://jeffco.us/ats/displaygeneral.do?sch=001690
> 11082 total square feet.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PySerial for Python 2 vs. Python 3

2013-12-31 Thread Steven D'Aprano
Travis McGee wrote:

> I've been working with a simple serial device that attaches to a USB
> port. It takes as commands short strings.
> 
> I wanted to use PySerial under Python 3, and, of course had the Devil's
> own time getting it installed and working since everything is geared
> towards Python 2.
> 
> Anyway, I finally got it installed, but when I try to use a statement of
> the sort ser.write("string") I get an exception which seems to imply
> that the argument needs to be an integer, rather than a string.

"Seems to imply"?


> With some minor adjustments it works just fine under Python 2, so, in a
> sense, this is a non-issue. However, I'd be interested to hear from
> anyone who can comment on what the problem is.

While I'd love to tell you exactly what the problem is, my crystal ball is
out of action. If you'd be so kind as to copy and paste the actual
exception, assuming it isn't a secret, perhaps we'll be able to tell you
what it actually says.


-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list