Re: PyCon Australia 2011: Schedule Announced

2011-07-14 Thread Laura Creighton

Hi Ryan.

Best of luck with the conference.

>Thanks also to Linux Australia, who provide the overarching legal and
>organisational structure for PyCon Australia.

I want to talk to somebody from Linux Australia about this overarching legal 
and organisational structure.
Do you have an email address of whom I should talk to?  I think the structure 
that we have here
in Europe could stand some refactoring, and I was talking with Stephen Thorne 
at Europython
and what Linux Australia is doing looks very neat to me.

There is nothing urgent about this, and in no way should this distract you from 
your conference,
but sometime I would like to have an email.

Thanks very much,
Laura Creighton


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


After 40 years ... Knuth vol 4 is to be published!!

2005-02-06 Thread Laura Creighton
"More than forty years in the making, the long-anticipated Volume 4
of The Art of Computer Programming is about to make its debuta. in
parts. Rather than waiting for the complete book, Dr. Knuth and
Addison-Wesley are publishing it in installments ("fascicles") a la
Charles Dickens.

See http://www.bookpool.com/.x/xx/ct/163 for an excerpt and more info
on Volume 4.

And Addison-Wesley is offering Bookpool customers an exclusive sneak
peek -- the first official excerpt from the series."

(above from the same site)
Yippee!
Laura

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


Re: ANN: Wing IDE 2.0.1 released

2004-12-07 Thread Laura Creighton
Congratulations!

Laura
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What is a function parameter =[] for?

2015-11-24 Thread Laura Creighton
In a message of Wed, 25 Nov 2015 11:39:54 +1100, "Steven D'Aprano" writes:
>I'm not sure what value [ha, see what I did there?!] there is in inventing
>two new words for things that we already have standard terms for.

Done correctly, you can get clarity.

>"Referent" is just a funny way of saying "object", and "evalue" is just a
>misspelling of "value".

If I had a time machine, I would go back to early days of Python and
ban the use of the term 'assignment' and 'value' both.  I would insist
that the term 'binding' be used instead, though if you want to use the
verb refer, to be synonymous with bind, well, I think that would work.
(If not, next trip with the time machine, I ban that one as well.)
Then you make it perfectly clear that what are bound are _objects_
not values (or evalues).  The object has an evalue, but it is the
object that is bound.

It is crystal clear than people on this list mean very different
things when they use the term 'value', and every one of them thinks
that Python agrees with them.  Cutting this knot may require a new
word.

Laura

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


Re: Istalling python

2015-11-25 Thread Laura Creighton
In a message of Wed, 25 Nov 2015 04:22:54 +, ARONA KANAGARATHNA via Python-
list writes:
>I tried to install this software python 3.4.3 to my pc which run windows Xp 
>32. i could installed but it doesnot run.it gives this message 
>"python35-32/python.exe isnot a valid win32 app.Please help me to get solved 
>this problem
>Thanks
>Aruna

The 'python35-32' part means that what you were trying to do was
install python3.5 not 3.4.3

And that is what did not work.  The reason that it did not work is
that 3.5 does not run on windows xp.  3.4 is the latest version you
can use.  So, you can either change your operating system, and
then get 3.5, or you can find 3.4.3 over here:
https://www.python.org/downloads/release/python-343/
(downloads on the bottom of the page).

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


Re: Late-binding of function defaults (was Re: What is a function parameter =[] for?)

2015-11-25 Thread Laura Creighton
In a message of Wed, 25 Nov 2015 07:13:41 -0800, Ned Batchelder writes:
>That's because it's a programming language, and very very little about
>programming languages is obvious.  The best we can hope for is "familiar,"
>and even then, familiar to who?  High school algebra students will at
>first be baffled by "x = x + 1", an equation which is clearly
>unsatisfiable.

The great sticking point for the children I am teaching is
'*' means multiplication.  You can really see that some people 
have to make extensive mental modifications in order to handle
the concept that mathematical truths are expressed in linguistic
and orthographic conventions, and that one can swap out a particular
convention 'x means multiply' and swap in another one '* means
multiply' while leaving the underlying truth unchanged.

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


Re: Multiplication [was Re: Late-binding of function defaults]

2015-11-25 Thread Laura Creighton
In a message of Thu, 26 Nov 2015 05:09:13 +1100, "Steven D'Aprano" writes:
>On Thu, 26 Nov 2015 02:59 am, Laura Creighton wrote:
>
>> The great sticking point for the children I am teaching is
>> '*' means multiplication.  You can really see that some people
>> have to make extensive mental modifications in order to handle
>> the concept that mathematical truths are expressed in linguistic
>> and orthographic conventions, and that one can swap out a particular
>> convention 'x means multiply' and swap in another one '* means
>> multiply' while leaving the underlying truth unchanged.
>
>Wow. What age children are you talking about?

12 and 13 and 14 year olds. Smart 12, 13 and 14 year olds.

They want to build web servers and host pictures of their pets.
and use the gimp to do image manipulation like crazy. They are
as interested in art as much as, or perhaps even more so than
in programming -- they just need to learn enough programming to
get to make the art and serve it up.

Designing your own Magic The Gathering cards, which has manipulated
pictures of your friends on them, and then using them to play games 
with said friends has been the craze since September.

It's not that the idea of we will use '*' is hard, but if you have
never thought about the difference between THE TRUTH and the notation
used to express the truth before, then well, you may need some time
to get used to the idea.

Laura


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


Re: Help needed with compiling python

2015-11-25 Thread Laura Creighton
In a message of Wed, 25 Nov 2015 22:52:23 +0100, Cecil Westerhof writes:
>
>My system python was all-ready damaged: that is why I wanted to build
>myself.

Your Suse system probably wants to use python for something.  If your
system python is damaged, you badly need to fix that, using the 
system package managers tools, before Suse does some sort of update
on you, using the broken python, which damages more of your system.

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


Re: Python on windows 10

2015-11-26 Thread Laura Creighton
In a message of Wed, 25 Nov 2015 20:34:01 +, francis funari writes:
>I have tried installing Python 3 on windows 10 it install OK but I do not get 
>Idle. When I type Idle in the interpreter nothing happen can you send me a 
>link to latest release of Python 3 with Idle that will run on windows 10 64 bit
>   
>Thankyou Francis Funari
>
>Sent from Mail<http://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
>-- 
>https://mail.python.org/mailman/listinfo/python-list

Sorry to hear you are having problems.

Can you please go to a command window and type

python -m idlelib  

This should fail.  However, it should fail with a meaningful traceback
which indicates where the problem is.  Copy and paste that traceback 
into mail and post that here so we have proceed.

If 'python' isn't the command you need to use to get python3.5 
perhaps py -3.5 -m idlelib will work.  But the idea is we want to
catch idle failing, so we can figure out what is going on.

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


Re: read 4D binary data

2015-11-26 Thread Laura Creighton
In a message of Thu, 26 Nov 2015 15:15:43 -0200, jorge.conr...@cptec.inpe.br wr
ites:
>Hi,
>
>
>I'm startig in Python and I have a 4D binary data. The dimension of my 
>data is:
>
>67 > longitude points
>41 > latitude points
>10 > pressure levels points
>33 > time points
>
>
>How can I read this data and what can I do to get a 2D array 
>(longitude,latitude) for a specific pressure  and time dimension.
>
>
>Conrado

If your binary data is all of the same type -- these are all floats,
or all ints -- you can use the python array module to read it.
https://docs.python.org/3/library/array.html

If they are heterogenous then you cannot use array, but can use struct
https://docs.python.org/3.5/library/struct.html

If I were you, I would want to get my data into pandas, which is
the best tool for data analysis
http://pandas.pydata.org/

And I would do this pretty much exactly as 
Albert Jan outlines in this stackoverflow question.
http://stackoverflow.com/questions/16573089/reading-binary-data-into-pandas
though, as I said, if your data is homogeneous you can use the array
module instead of using the struct one.  But struct will work on
homogenous data as well -- it is just slower.  You may not care.

Note that Albert Jan's answer is the one on the bottom, i.e. not the
one that got the checkmark from the original poster.

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


Re: Help with this program???

2015-11-27 Thread Laura Creighton
In a message of Fri, 27 Nov 2015 01:43:53 -0800, justin bloomer via Python-list
 writes:
>Your program should contain a function that:
>1. Seeks input from the user (via the keyboard);
>2. To build a list of student exam results;
>3. For each student their name (first and last), student number, and mark
>out of 100 should be captured;
>4. For full marks regular expressions or similar mechanisms should be used
>to ensure the data appears valid.

Hello.

We don't do people's assignments for them.
However, over on the tutor mailing list,
https://mail.python.org/mailman/listinfo/tutor
we do help people who are learning Python.

You will have to post your code, along with any error messages
you get and explain what you were trying to do.

Laura


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


Re: python response slow when running external DLL

2015-11-27 Thread Laura Creighton
In a message of Fri, 27 Nov 2015 13:20:03 +0100, Peter Otten writes:

>A cleaner solution can indeed involve threads; you might adapt the approach 
>from  (Python 2 code).

But it is probably better to use threading

http://code.activestate.com/recipes/82965-threads-tkinter-and-asynchronous-io/

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


Re: What is a function parameter =[] for?

2015-11-27 Thread Laura Creighton
In a message of Fri, 27 Nov 2015 23:57:29 +1100, "Steven D'Aprano" writes:
>On Fri, 27 Nov 2015 01:56 pm, MRAB wrote:
>
>> On 2015-11-27 02:44, Steven D'Aprano wrote:
>
>>> The PyPy implementation has to take special actions to preserve the ID
>>> across object recreations. That is what I mean by "faked".
>>>
>> You could argue that it _does_ continue to exist, it just changes its
>> form...
>
>*Something* continues to exist, but it is no longer an object.
>
>I like Chris' analogy of it being like quantum mechanics -- the *object*
>isn't guaranteed to exist except when you try to access it, until then you
>don't know what form it will take at any instance.

I think it's just another instance of Just-In-Time Manufacturing
https://en.wikipedia.org/wiki/Just-in-time_manufacturing

"As soon as you need a object, we'll have one ready". :)

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


Re: Python 3 virtualenvs

2015-11-27 Thread Laura Creighton
In a message of Sat, 28 Nov 2015 00:37:21 +, D.M. Procida writes:
>I have a new installation of Debian Jessie, with Python 2.7 and 3.4
>installed.
>
>I want to use Python 3.4 by default for most things, so I want
>virtualenv to create Python 3.4 virtualenvs unless I ask it to
>otherwise.
>
>It turns out that this seems to be inordinately complex.
>
>The best solution I have come up with is to alias virtualenv to
>'virtualenv -p python3.5', which seems really ugly and clunky.

This will get you python3.5 which I infinitely prefer over 3.4. 
But you said you wanted to use 3.4 ...

>Then I discover things like
>
>and realise it's not just me, it really is a nasty mess and nobody seems
>to understand what's going on.
>
>Daniele

What I found out.
https://bugs.python.org/issue25151
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=732703
https://bugs.python.org/issue25152
https://bugs.python.org/issue25154

pyenv is going away.  use python -m venv instead, if you want a 
venv.  You will never (unless somebody does a backport, which seems
very unlikley) be able to get a venv with 2.7.

I've long ago aliased virtualenv to v, so things aren't as clunky
for me.

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


Re: Faviourite improvements in Python 3.5 (was: Python 3 virtualenvs)

2015-11-27 Thread Laura Creighton
In a message of Sat, 28 Nov 2015 12:42:30 +1100, Ben Finney writes:
>Laura Creighton  writes:
>
>> […] python3.5 which I infinitely prefer over 3.4. 
>
>That's strong language :-)
>
>Laura – and anyone else – what in your opinion are the best improvements
>brought by Python 3.5 (over Python 3.4)?

The interactive console started working again.
https://bugs.python.org/issue23441

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


Re: python response slow when running external DLL

2015-11-28 Thread Laura Creighton
In a message of Sat, 28 Nov 2015 11:13:38 +0100, Peter Otten writes:
>jf...@ms4.hinet.net wrote:
>> Using thread is obviously more logical. I think my mistake was the "while
>> busy:  pass" loop which makes no sense because it blocks the main thread,
>> just as the time.sleep() does. That's why in your link (and Laura's too)
>> the widget.after() scheduling was used for this purpose.

I never saw the reply that Peter is replying to.
The threading module constructs a higher level interface on top of the
low level thread module.  Thus it is the preferred way to go for
standard Python code -- and even Fredrik's recipe contains the
line:
import thread # should use the threading module instead!

Laura

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


Re: askopenfilename()

2015-11-28 Thread Laura Creighton
Maybe Wei Li Jiang's  hack will work for you?
http://stackoverflow.com/questions/3375227/how-to-give-tkinter-file-dialog-focus

But then see if it works under MacOS.  I fear it will not.

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


Re: Find relative url in mixed text/html

2015-11-28 Thread Laura Creighton
In a message of Sun, 29 Nov 2015 00:25:07 +0800, Rob Hills writes:
>All that said, I'd be interested to see specific (and hopefully
>unbiased) info about phpBB's failings...

People I know of who run different bb software say that the spammers
really prefer phpBB.  So keeping it spam free is about 4 times the
work as for, for instance, IPB.

Hackers seem to like it too -- possibly due to this:
http://defensivedepth.com/2009/03/03/anatomy-of-a-hack-the-phpbbcom-attack/

make sure you aren't vulnerable.

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


Re: Does Python allow variables to be passed into function for dynamic screen scraping?

2015-11-28 Thread Laura Creighton
In a message of Sat, 28 Nov 2015 14:03:10 -0800, ryguy7272 writes:
>I'm looking at this URL.
>https://en.wikipedia.org/wiki/Wikipedia:Unusual_place_names
>
>If I hit F12 I can see tags such as these:
>And so on and so forth.  
>
>I'm wondering if someone can share a script, or a function, that will allow me 
>to pass in variables and download (or simply print) the results.  I saw a 
>sample online that I thought would work, and I made a few modifications but 
>now I keep getting a message that says: ValueError: All objects passed were 
>None
>
>Here's the script that I'm playing around with.
>
>import requests
>import pandas as pd
>from bs4 import BeautifulSoup
>
>#Get the relevant webpage set the data up for parsing
>url = "https://en.wikipedia.org/wiki/Wikipedia:Unusual_place_names";
>r = requests.get(url)
>soup=BeautifulSoup(r.content,"lxml")
>
>#set up a function to parse the "soup" for each category of information and 
>put it in a DataFrame
>def get_match_info(soup,tag,class_name):
>info_array=[]
>for info in soup.find_all('%s'%tag,attrs={'class':'%s'%class_name}):
>return pd.DataFrame(info_array)
>
>#for each category pass the above function the relevant information i.e. tag 
>names
>tag1 = get_match_info(soup,"td","title")
>tag2 = get_match_info(soup,"td","class")
>
>#Concatenate the DataFrames to present a final table of all the above info 
>match_info = pd.concat([tag1,tag2],ignore_index=False,axis=1)
>
>print match_info
>
>I'd greatly appreciate any help with this.

Post your error traceback.  If you are getting Value Errors about None,
then probably something you expect to return a match, isn't.  But without
the actual error, we cannot help much.

Laura

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


Re: Does Python allow variables to be passed into function for dynamic screen scraping?

2015-11-28 Thread Laura Creighton
In a message of Sat, 28 Nov 2015 14:37:26 -0800, ryguy7272 writes:
>On Saturday, November 28, 2015 at 5:28:55 PM UTC-5, Laura Creighton wrote:
>> In a message of Sat, 28 Nov 2015 14:03:10 -0800, ryguy7272 writes:
>> >I'm looking at this URL.
>> >https://en.wikipedia.org/wiki/Wikipedia:Unusual_place_names
>> >
>> >If I hit F12 I can see tags such as these:
>> >> >> >And so on and so forth.  
>> >
>> >I'm wondering if someone can share a script, or a function, that will allow 
>> >me to pass in variables and download (or simply print) the results.  I saw 
>> >a sample online that I thought would work, and I made a few modifications 
>> >but now I keep getting a message that says: ValueError: All objects passed 
>> >were None
>> >
>> >Here's the script that I'm playing around with.
>> >
>> >import requests
>> >import pandas as pd
>> >from bs4 import BeautifulSoup
>> >
>> >#Get the relevant webpage set the data up for parsing
>> >url = "https://en.wikipedia.org/wiki/Wikipedia:Unusual_place_names";
>> >r = requests.get(url)
>> >soup=BeautifulSoup(r.content,"lxml")
>> >
>> >#set up a function to parse the "soup" for each category of information and 
>> >put it in a DataFrame
>> >def get_match_info(soup,tag,class_name):
>> >info_array=[]
>> >for info in soup.find_all('%s'%tag,attrs={'class':'%s'%class_name}):
>> >return pd.DataFrame(info_array)
>> >
>> >#for each category pass the above function the relevant information i.e. 
>> >tag names
>> >tag1 = get_match_info(soup,"td","title")
>> >tag2 = get_match_info(soup,"td","class")
>> >
>> >#Concatenate the DataFrames to present a final table of all the above info 
>> >match_info = pd.concat([tag1,tag2],ignore_index=False,axis=1)
>> >
>> >print match_info
>> >
>> >I'd greatly appreciate any help with this.
>> 
>> Post your error traceback.  If you are getting Value Errors about None,
>> then probably something you expect to return a match, isn't.  But without
>> the actual error, we cannot help much.
>> 
>> Laura
>
>
>Ok.  How do I post the error traceback?  I'm using Spyder Python 2.7.

You cut and paste it out of wherever you are reading it, and paste it
into the email, along with your code, also cut and pasted from somewhere
(like an editor).  That way we get the exact code that caused the exact
traceback you are getting.

Laura

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


Re: Python 3 virtualenvs

2015-11-29 Thread Laura Creighton
In a message of Sun, 29 Nov 2015 13:19:46 +0100, Lele Gaifax writes:
>Jon Ribbens  writes:
>
>> On 2015-11-28, D.M. Procida  
>> wrote:
>>>
>>> Is something else required?
>>
>> Debian's package management is mysterious and apparently bizarre
>> and frankly in respect to Python, not very good.
>
>I do not agree with you on the quality of Python support on Debian systems,
>but I think Daniele is missing the package "pythonX.Y-venv": they install the
>needed stuff, and in particular /usr/bin/pyvenv-X-Y.
>
>ciao, lele.

No, Pyvenv is precisely what Daniele can not use.
The problem is that venv does not come with a big sign saying

ONLY FOR PYTHON 3.x
ABSOLUTELY DOES NOT WORK FOR BUILDING 2.7 VIRTUALENVS
USE virtualenv INSTEAD for Python 2.7



which means you can waste a whole lot of time finding this out
the hard way.

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


Re: Python 3 virtualenvs

2015-11-29 Thread Laura Creighton
In a message of Sun, 29 Nov 2015 13:23:19 +, Jon Ribbens writes:
>I don't know if, in future, pyvenv will be the way to go and
>virtualenv will be deprecated, but either way we do not appear
>to be there yet.

pyenv is going away.  python -m venv is the preferred way to get a venv

https://bugs.python.org/issue25154

Of course if you try it, you may get:

  Error: Command '['/bin/python3.4', '-Im', 'ensurepip', 
'--upgrade', '--default-pip']' returned non-zero exit status 1

which turns out to mean:

Your Python isn't configured with ensure-pip!

.

Right now, I personally don't know why there is a venv at all.  Despite
the similarity of names, it doesn't seem to be about doing what virtualenv
does.  I think it is only meant to be used by people who want to install
packages but not site-wide, but I am not sure about that.  I don't think
there are any plans to give venv the functionality of virtualenv, so
presumably there are people who like it just fine the way it is now.
They must have very different needs than I do.

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


Re: What use is this class?

2015-11-29 Thread Laura Creighton
In a message of Sun, 29 Nov 2015 13:36:58 -0800, fl writes:
>Hi,
>
>When I search around tutorial about None, I came across this link:
>
>http://jaredgrubb.blogspot.ca/2009/04/python-is-none-vs-none.html
>
>I don't understand what use of this class example:
>
>
>
 class Zero(): # a class that is zero
>...def __nonzero__(self):
>...   return False
>
>
>I can only get the following code running:
>
>cz1=Zero()
>cz1.__nonzero__()
>Out[119]: False
>
>
>Here are my questions:
>1. Is there any other means to use class Zero?
>2. What connection to None on the original author's intention?

The person who wrote this was curious as to why PEP 8 says:
"Comparisons to singletons like None should always be done 
 with 'is' or 'is not', never the equality operators."

He wrote this class to play around with, to see if it really made
a difference whether you write:

if x is None:

vs

if x == None:

and it does.  A class is free to implement its own version of '==' if
if likes, and there, 'being equal to None' might means something
complicated and crazy.  People who are just testing against None will
burn their fingers if they use '==' there.

Also its a bad problem when porting code to Jython.
A java null is supposed to be None.
But using '==' will call the underlying .equals method.
If you call that on a null, Java will spit out a Null Pointer Exception.

Laura

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


Re: How can I count word frequency in a web site?

2015-11-29 Thread Laura Creighton
In a message of Sun, 29 Nov 2015 21:31:49 -0500, Cem Karan writes:
>You might want to look into Beautiful Soup 
>(https://pypi.python.org/pypi/beautifulsoup4), which is an HTML 
>screen-scraping tool.  I've never used it, but I've heard good things about it.
>
>Good luck,
>Cem Karan

http://codereview.stackexchange.com/questions/73887/finding-the-occurrences-of-all-words-in-movie-scripts

scrapes a site of movie scripts and then spits out the 10 most common
words.  I suspect the OP could modify this script to suit his or her needs.

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


Re: Caret key quits idle on pt keyboard

2015-11-30 Thread Laura Creighton
In a message of Tue, 01 Dec 2015 02:57:15 +1100, Chris Angelico writes:
>On Tue, Dec 1, 2015 at 2:10 AM, Random832  wrote:
>> On 2015-11-30, Chris Angelico  wrote:
>>> Hmm. This could be part of the known issues with Tk (on which Idle
>>> depends) and non-BMP characters, but a caret should be safe.
>>
>> Is there a known issue with dead keys? From what I can find the
>> Portuguese keyboard doesn't have a "proper" caret, it has a
>> circumflex dead key which you can press space or any non-vowel to
>> get a caret.  Seems to work fine for me though.
>
>Ah, that might explain it. I don't have a system to test it on,
>though. Definitely needs OS/Python version details.
>
>ChrisA

I have a Swedish keyboard which has a caret dead-key that works 
as Random832 describes.  Idle works perfectly well for me.

There are a bunch of MacOS specific idle keyboard bugs.  I wonder
if this is (possibly another) one of them.

Laura

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


Re: Python 3 virtualenvs

2015-11-30 Thread Laura Creighton
In a message of Mon, 30 Nov 2015 09:32:27 -0700, Carl Meyer writes:
>Hi Laura,

>I don't know what you mean by this. Venv is intended to do _exactly_
>what virtualenv does, only better. Unless by "what virtualenv does" you
>mean "also support Python 2."

That is exactly what I mean.

>> I think it is only meant to be used by people who want to install
>> packages but not site-wide, but I am not sure about that.
>
>I don't know what you mean by this either. Isn't the ability to "install
>packages but not site-wide" precisely what virtualenv (and venv) give you?

I rarely use it for that.  What I nearly always want is different
python interpreters.  CPython, PyPy, Jython for anything from 2.6 to
3.6.

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


Re: Python 3 virtualenvs

2015-11-30 Thread Laura Creighton
In a message of Mon, 30 Nov 2015 10:28:46 -0700, Carl Meyer writes:

>So I agree that for now you should be sticking with virtualenv (I use it
>too), but I hope you'll take another look at venv a few years down the
>road, if you find yourself in a situation where all the interpreters you
>need are 3.3+.

I will, but these days I am playing with fades, which I only discovered
a week ago, when Facundo made an announcment.
https://pypi.python.org/pypi/fades/3

And it looks like this will make my life a whole lot easier.

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


python domain in China. This showed up on Python list

2015-12-01 Thread Laura Creighton
I think we have just dodged a bullet, let us now go thank the
nice people who sent us this and figure out how we should
secure the domain.

Laura


--- Forwarded Message

Return-Path: 
Date: Tue, 1 Dec 2015 15:12:58 +0800
From: "Ian Liu" 
To: 
Subject: python CN domain and keyword
Message-ID: <20151201151310456...@chinaregistry.org.cn>
X-mailer: Foxmail 6, 13, 102, 15 [cn]
Mime-Version: 1.0

(Please forward this to your CEO, because this is urgent. Thanks)


We are a Network Service Company which is the domain name registration
center in Shanghai, China. On Nov 30, 2015, we received an application
from Huasu Holdings Ltd requested "python" as their internet keyword
and China (CN) domain names. But after checking it, we find this name
conflict with your company name or trademark. In order to deal with
this matter better, it's necessary to send email to you and confirm
whether this company is your distributor or business partner in China?

Kind regards


Ian Liu
General Manager 
China Registry (Headquarters)
8052, Douhai Building, No. 59 Baolian Road, 
Shanghai, China
Tel: +86 21 6191 8696
Mobile: +86 138 1642 8671
Fax: +86 21 6191 8697
Web: www.chinaregistry.org.cn
- -- 
https://mail.python.org/mailman/listinfo/python-list

--- End of Forwarded Message
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python domain in China. This showed up on Python list

2015-12-01 Thread Laura Creighton
In a message of Tue, 01 Dec 2015 02:51:21 -0800, Chris Rebert writes:
>I hate to break it to you, but this seems to be just another of those
>come-ons spammed out by various scummy businesses that trawl WHOIS
>databases for people to scam into buying extra/unnecessary domain
>names. Google "chinese domain scam" for more info. I've received
>similar spams after having registered some .com domains that no
>corporation could possibly legitimately want the .cn equivalents of.

Ah...  Thank you Chris.  Sure fooled me.

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


Re: Installation Problem

2015-12-02 Thread Laura Creighton
In a message of Wed, 02 Dec 2015 12:08:02 +, Packie Kelly writes:
>Hi my name is Patrick,
>
>I have a problem regarding the installation of the latest version of
>python, everytime I install the program I keep getting the message modify,
>repair, uninstall. I've tried different versions but with no luck. Before
>you ask I have already completely removed the program.
>
>Looking forward to your reply

What Operating System?  If it is Windows XP, that is your problem.
Python 3.5 is not supported on Windows XP.  Either stick with 3.4 or
upgrade your OS to something more recent.

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


Re: Installation Problem

2015-12-02 Thread Laura Creighton
In a message of Wed, 02 Dec 2015 13:30:38 +, Mark Lawrence writes:
>0) before asking search for "python installation problem" just in case 
>you're not the first person to have this issue.

That is not a good idea, there are so many different hits for that.
The first one I get is this:
http://superuser.com/questions/613820/error-installing-python-on-windows-7-x64

which is unlikely to be the OP's problem.

I'd like it if people would stop mentioning crystal balls and the like
around here, which was funny once, but which has gotten extremely stale
since.  And if people whose first take on others is 'does this give me
an opportunity to be sarcastic' took it someplace else.  I get very
tired of hanging around people who think that sarcastic is clever.

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


Re: Installation Problem

2015-12-02 Thread Laura Creighton
In a message of Wed, 02 Dec 2015 14:42:48 +, Mark Lawrence writes:
>On 02/12/2015 13:59, Laura Creighton wrote:
>> In a message of Wed, 02 Dec 2015 13:30:38 +, Mark Lawrence writes:
>>> 0) before asking search for "python installation problem" just in case
>>> you're not the first person to have this issue.
>>
>> That is not a good idea, there are so many different hits for that.
>> The first one I get is this:
>> http://superuser.com/questions/613820/error-installing-python-on-windows-7-x64
>>
>> which is unlikely to be the OP's problem.
>
>So you are advocating that people keep on asking the same question, even 
>if it has been asked twice a day for the last month?

Yes.  It is old for us, but nobody should be giving 2 hoots about 
our feelings.  Since we can just ignore such things.  The problem 
is always fresh and new for the poster.

>  Wouldn't it be 
>better to advise people to restrict their search to maybe the last month 
>or even week, or do a site specific search, or even check the mailing 
>list archives?

They are already getting the advice to ask the question on python-list.
This is the preferred way to get such problems solved.  We even have
automated mailer responses telling people to ask such questions here.
We don't warn them that they are about to meet anti-social and egotistical
people who think that they should take every opportunity to be 
sarcastic that presents itself.

You also have a woefully inadequate understanding of ignorance.
See Kruger Dunnign effect:
https://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
People in the bottom quartile of comprehension of anything -- i.e.
the most ignorant -- lack the metacognative skills to recognise
the solutions to their problems even when they are presented in
a clear and logical fashion.  Thus the most ignorant can not be expected 
to just google up an answer, because even if they got one, they wouldn't 
be able to recognise it.

It's bad enough when they miss solutions out there.  It's worse when
they try to do things that work for one OS on another, or one version
of an OS on another, and so on and so forth.  

Much, much better that these people come and ask quesitons.

>It's not funny, but it does show the number of times that the question 
>asked is often less than useless.  Personally I'm tired of the fit bib, 
>spoon feed, change nappy brigade, who IMHO are doing far more harm than 
>good.

I think you should stay away from python-list, then, until your sense
of humour returns and your ability to deal with the abysmally ignorant
matures.  Because this is where we actually want to get a hold of 
such people so we can teach them things, and the active and vocal
presence of people who resent them for being ignorant makes the job
a whole lot harder.

Laura

>Mark Lawrence

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


Re: Is Microsoft Windows secretly downloading childporn to your computer ?!

2015-12-02 Thread Laura Creighton
In a message of Wed, 02 Dec 2015 08:36:24 -0800, Keith Thompson writes:

>"We must do something.  This is something.  Therefore, we must do this."
>-- Antony Jay and Jonathan Lynn, "Yes Minister"

This is one of my favourite quotes of all time.  Unfortunately, you
have it slightly wrong.  The quote is:
Something must be done.  This is something.  Therefore we must do it.

cheers!
Laura

https://www.google.se/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&ved=0ahUKEwjZvrXl0L3JAhVmJHIKHTBjCugQtwIIIjAB&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dtrw1PbQt_Yo&usg=AFQjCNHEKrgju4vVOH_hmwnbn0zAWU0aEg&sig2=VwmILBUKi-vz7YCA5k_0ew

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


Re: python message

2015-12-02 Thread Laura Creighton
In a message of Wed, 02 Dec 2015 15:53:08 -0200, jorge.conr...@cptec.inpe.br wr
ites:
>
>
>
>Hi,
>
>
>I'm a new user of Pyhton and I run my code lenetcdf1.py and I plot the 
>figure but I had this message:
>
>
>/usr/lib64/python2.7/site-packages/matplotlib/collections.py:590: 
>FutureWarning: elementwise comparison failed; returning scalar instead, 
>but in the future will perform elementwise comparison
>   if self._edgecolors == str('face'):
>
>I do not understand this message. Atached it my code.
>
>
>What can I do to solve this message.
>
>Thanks in advance.
>
>
>Conrado

Your code did not get attached, but no matter.
Just ignore this one.
https://github.com/matplotlib/matplotlib/issues/5209

next release of matplotlib should fix it.

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


Re: stuff and nonsense

2015-12-02 Thread Laura Creighton
In a message of Wed, 02 Dec 2015 22:51:13 +, Denis McMahon writes:
>On Wed, 02 Dec 2015 11:32:25 -0600, Ian Kelly wrote:
>
>> In what way is discussion of a tangential topic feeding the troll? Said
>> troll is not even participating in the discussion.
>
>Reposting / responding / following up with the original subject boosts 
>the visibility of the subject to internet search engines because of the 
>way newsgroups get gated to websites.
>
>-- 
>Denis McMahon, denismfmcma...@gmail.com

That is not what I was told.  I was told that these days it is all
done by References: lines.  Thus changing the Subject no longer has
this effect.  Wrong?

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


Re: Does Python 2.7 do Open Office

2015-12-02 Thread Laura Creighton
In a message of Wed, 02 Dec 2015 18:50:34 -0500, Seymore4Head writes:
>I have a text file I would like to search through but I have tried it
>before.  I don't remember why they are not compatible together, but I
>wanted to ask to make sure.
>
>I know I can convert the file to plain text but it would be nice not
>to have to do that.
>
>-- 
>https://mail.python.org/mailman/listinfo/python-list

You are looking for PyUNO.Unfortuntately it is not well
documented, but I have heard good things about this as documentation.
https://documenthacker.wordpress.com/2013/03/05/first-draft-released/

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


Re: filter a list of strings

2015-12-03 Thread Laura Creighton
In a message of Thu, 03 Dec 2015 10:27:19 +0100, c.bu...@posteo.jp writes:
>Thank you for your suggestion. This will help a lot.
>
>On 2015-12-03 08:32 Jussi Piitulainen  wrote:
>> list = [ item for item in list
>>  if ( 'Banana' not in item and
>>   'Car' not in item ) ]
>
>I often saw constructions like this
>  x for x in y if ...
>But I don't understand that combination of the Python keywords (for,
>in, if) I allready know. It is to complex to imagine what there really
>happen.
>
>I understand this
>  for x in y:
>if ...
>
>But what is about the 'x' in front of all that?

This is a list comprehension.
see: https://docs.python.org/2/tutorial/datastructures.html#list-comprehensions

But I would solve your problem like this:

things_I_do_not_want = ['Car', 'Banana', ]
things_I_want = []

for item in list_of_everything_I_started_with:
if item not in things_I_do_not_want:
   things_I_want.append(item)

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


Re: getting fileinput to do errors='ignore' or 'replace'?

2015-12-03 Thread Laura Creighton
In a message of Thu, 03 Dec 2015 15:12:15 +, Adam Funk writes:
>I'm having trouble with some input files that are almost all proper
>UTF-8 but with a couple of troublesome characters mixed in, which I'd
>like to ignore instead of throwing ValueError.  I've found the
>openhook for the encoding
>
>for line in fileinput.input(options.files, 
>openhook=fileinput.hook_encoded("utf-8")):
>do_stuff(line)
>
>which the documentation describes as "a hook which opens each file
>with codecs.open(), using the given encoding to read the file", but
>I'd like codecs.open() to also have the errors='ignore' or
>errors='replace' effect.  Is it possible to do this?
>
>Thanks.

This should be both easy to add, and useful, and I happen to know that
fileinput is being hacked on by Serhiy Storchaka right now, who agrees
that this would be easy.  So, with his approval, I stuck this into the
tracker.  http://bugs.python.org/issue25788  

Future Pythons may not have the problem.

Laura

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


Idle, tk and MacOS

2015-12-03 Thread Laura Creighton
This in to webmaster.  Somebody got an error message about their
Tcl/Tk when they started using IDLE.  

They went to https://www.python.org/download/mac/tcltk/
and, yes indeed, their tk is 8.5.9, their OS is 10.8.5 so they
have a problem.  They downloaded the patch from ActiveState,
and did _something_ which reported 'installation successful'.

But when they restart Idle it still has 8.5.9

What else do they need to do?

Laura

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


Re: getting fileinput to do errors='ignore' or 'replace'?

2015-12-03 Thread Laura Creighton
In a message of Thu, 03 Dec 2015 19:17:51 +, Adam Funk writes:
>On 2015-12-03, Laura Creighton wrote:
>
>> In a message of Thu, 03 Dec 2015 15:12:15 +, Adam Funk writes:
>>>I'm having trouble with some input files that are almost all proper
>>>UTF-8 but with a couple of troublesome characters mixed in, which I'd
>>>like to ignore instead of throwing ValueError.  I've found the
>>>openhook for the encoding
>>>
>>>for line in fileinput.input(options.files, 
>>>openhook=fileinput.hook_encoded("utf-8")):
>>>do_stuff(line)
>>>
>>>which the documentation describes as "a hook which opens each file
>>>with codecs.open(), using the given encoding to read the file", but
>>>I'd like codecs.open() to also have the errors='ignore' or
>>>errors='replace' effect.  Is it possible to do this?
>>>
>>>Thanks.
>>
>> This should be both easy to add, and useful, and I happen to know that
>> fileinput is being hacked on by Serhiy Storchaka right now, who agrees
>> that this would be easy.  So, with his approval, I stuck this into the
>> tracker.  http://bugs.python.org/issue25788  
>>
>> Future Pythons may not have the problem.
>
>Good to know, thanks.

Well, we have moved right along to 'You write the patch, Laura' so I
can pretty much guarantee that future Pythons won't have the problem. :)

Laura

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


Re: Idle, tk and MacOS

2015-12-03 Thread Laura Creighton
In a message of Thu, 03 Dec 2015 20:34:10 +0100, Laura Creighton writes:
>This in to webmaster.  Somebody got an error message about their
>Tcl/Tk when they started using IDLE.  
>
>They went to https://www.python.org/download/mac/tcltk/
>and, yes indeed, their tk is 8.5.9, their OS is 10.8.5 so they
>have a problem.  They downloaded the patch from ActiveState,
>and did _something_ which reported 'installation successful'.
>
>But when they restart Idle it still has 8.5.9
>
>What else do they need to do?
>
>Laura

The OP reported that trying to do it again seems to have worked
great, so I guess something went wrong the first time.

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


Re: python 3.5.0rc1 problem opening IDLE in windows

2015-12-04 Thread Laura Creighton
In a message of Fri, 04 Dec 2015 11:26:59 +, Nicky Mac writes:
>Dear python team
>since windows applied some updates last night to my windows 10 and windows
>7 systems,
>I can't open anything with IDLE as I usually do.
>On windows 10 (64bit with 64bit python), I performed the installation
>repair procedure.
>* Edit with IDLE does not appear as an installed windows program.
>* when I open my usual shortcut to IDLE (
>C:\Python\Python35\Lib\idlelib\idle.py)
> something briefly flashes on the screen *and immediately disappears.*
>* if I directly open a python program in windows, I get these options (as
>usual):-
>edit with IDLE (-> python launcher for windows console)
>edit with IDLE  (-> edit with IDLE (64bit))  - which I always
>use, *nothing
>happens*
>
>Any ideas gratefully received!!!
>sincerely
>Nick "Mac" McElwaine

Go to a console window and type python -m idlelib

See if you get a useful traceback, and post it here.  (If idle just
works, tell us that, instead.)

Laura Creighton

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


Re: problem

2015-12-04 Thread Laura Creighton
In a message of Thu, 03 Dec 2015 21:25:53 +0200, Dylan Goodwin writes:
>Every time I try and run python 3.5 it keeps coming up with modify, repair
>or uninstall
>-- 
>https://mail.python.org/mailman/listinfo/python-list

What OS are you running?

If windows XP, your problem is that your OS is too old.  Python 3.5 is
not supported.  Stick with 3.4 or upgrade your OS.

If something else, you need to install 
the available service packs.  For instance, if you are running
Windows 7, https://www.microsoft.com/en-us/download/details.aspx?id=5842
is where you get service pack 1.

Laura Creighton

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


Re: Python 3.5 not work in Windows XP

2015-12-06 Thread Laura Creighton
In a message of Sat, 05 Dec 2015 22:22:41 +0600, am...@mail.ru writes:
>Installer: only 'Cancel' button visible on dialog. 'Install now...' and  
>'Customize...' work but invisible (also when deinstalling).
>
>After installing interpreter and launcher not runs (with message 'Access  
>denied)'

Yes, when 3.5.1 we will make that a lot clearer.  Windows XP is not
supported for 3.5 (and later).  Either stick with 3.4 or upgrade
your OS to something more recent.

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


Re: Issue

2015-12-06 Thread Laura Creighton
In a message of Sun, 06 Dec 2015 15:48:18 +, James Gilliver writes:
>Hi!
>I have recently installed Python 3.5.0 but cannot open the application! Could 
>you help me resolve this issue?
>Thanks,James
> 
>-- 
>https://mail.python.org/mailman/listinfo/python-list

What OS version are you running.
What happens when you try to open the application?

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


Re: issues

2015-12-06 Thread Laura Creighton
In a message of Fri, 04 Dec 2015 22:44:53 +, Anna Szaharcsuk via Python-lis
t writes:
>Hello there,
>
>I was trying to install PyCharm, but didn't worked and needed interpreter.
>the computer advised to install the python for windows.
>
>Can you help me, please, PyCharm stillnot working...allways gives a message
>for repair, after- the repair successful and again message for repair...
>
>
>Kind regards,
>Anna

What OS version do you have?  

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


Re: Message-IDs on Usenet gateway

2015-12-06 Thread Laura Creighton
In a message of Sun, 06 Dec 2015 15:51:54 -0500, Random832 writes:
>Something weird is going on. On google groups, this message has
>a different Message-ID:
>

I think it is this problem.  Start here.
https://mail.python.org/pipermail/mailman-developers/2015-November/025225.html

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


Re: Problems using celery and pyelasticsearch

2015-12-06 Thread Laura Creighton
In a message of Mon, 07 Dec 2015 02:37:15 +0100, nonami writes:

>Does anyone have any idea what could be going on or how I can further 
>inspect running tasks.

Not sure this will help, but it might ...
https://www.caktusgroup.com/blog/2013/10/30/using-strace-debug-stuck-celery-tasks/

Laura

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


Re: define the area plot

2015-12-07 Thread Laura Creighton
In a message of Mon, 07 Dec 2015 10:51:10 -0200, jorge.conr...@cptec.inpe.br wr
ites:
>
>
>Hi,
>
>I'm changing from the IDL to PYTHON. I would like know how can I define 
>the size of the window plot in Python. On IDL I define the size of area 
>plot by:
>
>
>window,1,xsize=1000,ysize=1000
>
>
>It is possible define the size of the window before my data is plotted.
>
>
>Conrado

What package are you using to plot with?

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


Re: install issue

2015-12-07 Thread Laura Creighton
In a message of Sun, 06 Dec 2015 20:44:03 +, "John Robinson" writes:
>When I run the installer (python-3.5.0.exe [win32]) I see this:
>
> 
>
>
>
> 
>
>There seems to be "hidden" buttons as clicking in the middle of this dialog
>box does continue the process. 
>
>However, when complete, and I start python, I get an error saying its not a
>valid win32 application.
>
>So, I uninstalled, and there is the same issue with the un-installer - I
>have to click random places in the dialog box to "find" the uninstall
>button, that is not shown.
>
> 
>
>(plus AVG shows this as the Heri virus - and, yes, I did disable AVG while
>attempting the installation.)
>
>Win xp, SP3, AMD Phenom, 1100, 8gb (dual boot with win7) 
>
> 
>
>Rgds

AVG, like most antivirus software, gets tons and tons of false positives.

Regardless of weirdnesses in the installer, your real problem is that
3.5 and later does not run on XP, period.  The new Python 3.5.1 released
yesterday was supposed to be able to detect your XP, and tell you that
you needed to upgrade your OS in order to run 3.5.1

Looks like things are still not working perfectly on that front, but
that's the problem.  You need to either stick with 3.4 or upgrade your OS.

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


Re: Packages installing problem

2015-12-07 Thread Laura Creighton
In a message of Mon, 07 Dec 2015 00:32:37 +, lalith writes:
>Dear sir.
>
>I was using Python2.7 and i move to Python3.5.
>I face big trouble with installing software packages, i need in my 
>development.
>
>Lalith
>-- 
>https://mail.python.org/mailman/listinfo/python-list

Do you want to install your packages system-wide?

Try py -3.5 -m install 

Do you want to install your python packages in a virtual environment?

Start reading here:
https://docs.python.org/3/library/venv.html

If you sometimes want a python 2.7 virtual env you cannot get it with
venv.  You will have to use the older virtualenv. 
https://virtualenv.readthedocs.org/en/latest/

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


Re: python 3.5: upgrading smart_open package

2015-12-07 Thread Laura Creighton
In a message of Mon, 07 Dec 2015 22:45:44 +0530, Anupam Mediratta writes:
>Hello,
>
>I have to use python 3.5 in my use case and one of the packages I use
>(gensim), in turn uses smart_open (https://github.com/piskvorky/smart_open/)
>
>smart_open depends on boto and boto fails on my machine running ubuntu
>15.10.
>
>So in order for me to be able to run gensim, I need to be able to migrate
>smart_open from boto to boto3 (boto3 works fine with python 3 and ubuntu
>15.10).
>
>There is an open github issue:
>https://github.com/piskvorky/smart_open/issues/43
>
>I am not sure how to go about doing this migration. If someone has any
>directions or guidelines I will appreciate.
>
>Thanks


You have a bad problem.
https://github.com/piskvorky/smart_open/labels/help%20wanted
is the other name of https://github.com/piskvorky/smart_open/issues/43

This issue is because the author of smart_open wishes very badly to
move to boto3, but hasn't, because he wants help with something.
Thus you cannot migrate until he does.

You should send mail to the author, which I looked up for you
and you can find here.
http://radimrehurek.com/contact/

Tell him that you want smart_open to work with boto3, and that you want
to help making that happen.  Then see what he says is needed and see if
that is something you can do.

Laura

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


Re: Python Script - Windows Task Scheduler - Logging

2015-12-08 Thread Laura Creighton
In a message of Mon, 07 Dec 2015 23:53:10 +, Raheel Rao writes:
>Hello there,I created a python script that connects to an ftp and downloads 
>files to a specifed folder and logs each event in a log file. This script 
>works perfectly fine as i want it to however when i put this in a task 
>scheduler, the script runs and downloads the file just fine except that there 
>is no log created. Any suggestions? I remember task scheduler have a bug where 
>you have to put something in "start in". Have been searching froums but so far 
>no luck. Thanks in advance!
>
>-- 
>https://mail.python.org/mailman/listinfo/python-list


Maybe related to this?
tackoverflow.com/questions/20196049/problems-running-python-script-by-windows-task-scheduler-that-does-pscp

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


Re: manually build a unittest/doctest object.

2015-12-08 Thread Laura Creighton
In a message of Tue, 08 Dec 2015 07:04:39 -0700, Vincent Davis writes:
>On Tue, Dec 8, 2015 at 2:06 AM, Peter Otten <__pete...@web.de> wrote:
>
>> But why would you want to do that?
>
>
>Thanks Peter, I want to do that because I want to test jupyter notebooks.
>​The notebook is in JSON and I can get the source and result out but it was
>unclear to me how to stick this into a test. doctest seemed the simplest
>but maybe there is a better way.
>
>I also tried something like:
>assert exec("""print('hello word')""") == 'hello word'
>
>
>Vincent Davis
>720-301-3003
>-- 
>https://mail.python.org/mailman/listinfo/python-list

Check out this:
https://pypi.python.org/pypi/pytest-ipynb

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


Re: Problem

2015-12-08 Thread Laura Creighton
In a message of Tue, 08 Dec 2015 20:03:27 +0500, Namrah Anwar writes:
>Dear Administration,
>
>I am Namrah Anwar writing to you from Pakistan. I downloaded Python version
>3.5.1 and 2.7 and after installation at first, upon opening again it asked
>for Modify, repair or uninstall options. I tried to fix it but could not.
>Can you please help me out how to fix this and why it is asking every time
>for same option?
>
>Thanking you in anticipation.
>
>-- 
>
>
>*Regards,Namrah Anwar*
>*PhD Student (Fellowship) - Cancer Biology - Agha Khan University-Karachi*
>*Masters in Health care Biotechnology  (ASAB) NUST, Islamabad*
>*Pakistan.*

What OS version are you running?

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


Re: Problem

2015-12-08 Thread Laura Creighton
In a message of Tue, 08 Dec 2015 16:11:53 +0100, Fabien writes:
>On 12/08/2015 04:03 PM, Namrah Anwar wrote:
>> Dear Administration,
>>
>> I am Namrah Anwar writing to you from Pakistan. I downloaded Python version
>> 3.5.1 and 2.7 and after installation at first, upon opening again it asked
>(snip)
>> -- *Regards,Namrah Anwar* *PhD Student (Fellowship) - Cancer Biology -
>
>I can see from your signature that you are going to use python for 
>scientific purposes. I recommend to go directly for Anaconda:
>
>https://www.continuum.io/downloads
>
>Cheers,
>
>Fabien

That is a very good idea.

Laura

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


Problem with sqlite3 and Decimal (fwd)

2015-12-11 Thread Laura Creighton
>From python-list.
Very weird.
Another reason not to use sqlite3

--- Forwarded Message

To: python-list@python.org
From: "Frank Millman" 
Subject: Problem with sqlite3 and Decimal
Date: Fri, 11 Dec 2015 11:21:53 +0200
Lines: 71

Hi all

I need to store Decimal objects in a sqlite3 database, using Python 3.4 on
Windows 7.

I followed the instructions here -


http://stackoverflow.com/questions/6319409/how-to-convert-python-decimal-to-sqlite-numeric

It seemed to work well, but then I hit a problem. Here is a stripped-down
example -

"""
from decimal import Decimal as D
import sqlite3

# Decimal adapter (store Decimal in database as str)
sqlite3.register_adapter(D, lambda d:str(d))

# Decimal converter (convert back to Decimal on return)
sqlite3.register_converter('DEC', lambda s: D(s.decode('utf-8')))

conn = sqlite3.connect(':memory:', detect_types=sqlite3.PARSE_DECLTYPES)
cur = conn.cursor()

cur.execute("CREATE TABLE fmtemp (acno INT, bal DEC)")
cur.execute("INSERT INTO fmtemp (acno, bal) VALUES (?, ?)", ('A001',
D('0')))

sql1 = "SELECT bal FROM fmtemp"
sql2 = "UPDATE fmtemp SET bal = bal + ?"

while True:
print(cur.execute(sql1).fetchone()[0])
cur.execute(sql2, (D('123.45'),))
q = input()
if q == 'q':
break
"""

It initialises a decimal value in the database, then loops adding a decimal
value and displaying the result.

It runs fine for a while, and then the following happens -

5802.15

5925.6

6049.05

6172.49

6295.94

It consistently switches to floating point at the same position. If you
carry on for a while, it reverts back to two decimal places.

If I initialise the value as D('6049.05'), the next value is 6172.5, so it
is not the number itself that causes the problem.

I tried displaying the type - even when it switches to 6172.4999, it is
still a Decimal type.

I noticed one oddity - I am asking sqlite3 to store the value as a string,
but then I am asking it to perform arithmetic on it.

Any suggestions will be much appreciated.

Frank Millman 


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

--- End of Forwarded Message
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python script for dwonload free anything?

2015-12-11 Thread Laura Creighton
In a message of Fri, 11 Dec 2015 06:29:33 -0800, hienm...@gmail.com writes:
>i want create script for download free 3d model from nonecg.com like 
>https://github.com/nishad/udemy-dl-windows , this script download free udemy 
>video lesson. Anyone can tell e, how to create script like that?
>-- 
>https://mail.python.org/mailman/listinfo/python-list

I think you will find this PyPi project interesting.
https://github.com/rg3/youtube-dl/

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


Re: 2to3 translation problem

2015-12-12 Thread Laura Creighton
In a message of Sat, 12 Dec 2015 16:31:54 +, Tony van der Hoff writes:
>On 12/12/15 15:09, Mark Lawrence wrote:
>> On 12/12/2015 14:42, Tony van der Hoff wrote:
>>> Debian Jessie, python 2.7; python 3.4
>>>
>>> I have an application, using pygame for graphics, that works fine under
>>> python2.7. I have run it through 2to3, but when running the result under
>>> python 3.4, I get the error :
>>>
>>> Traceback (most recent call last):
>>>File "ppm304.py", line 9, in 
>>>  import pygame
>>> ImportError: No module named 'pygame'
>>>
>>> So, python 3.4 can't find the library, whilst python 2.7 can.
>>> How do I track down/fix the missing dependency.
>>
>> This isn't a 2to3 translation problem.  You've installed pygame under
>> 2.7 at some point, repeat the process for 3.4.  I've no idea how you'd
>> do that on Debian Jessie but on Windows it'd be "pip3.4 install pygame".
>>
>Thanks, Mark, for the pointer. I'm pretty sure I installed Pygame from 
>Debian's repository, via apt-get install python-pygame. I believe that 
>should be effective for any version of Python.

You are mistaken here.
python-pygame is only a python 2.7 pygame.

you want python3-pygame.
https://packages.debian.org/search?keywords=python3-pygame

Speaking as a debian user are going to have a _whole lot of this_.
If you don't know about apt-cache search  
let me recommend it to you.

This on debian unstable:

lac@smartwheels:~$  apt-cache search pygame
lightyears - single player real-time strategy game with steampunk sci-fi
psychopy - environment for creating psychology stimuli in Python
python-pygame - SDL bindings for games development in Python
python-pyglet - cross-platform windowing and multimedia library
pyntor - flexible and componentized presentation program
solarwolf - Collect the boxes and don't become mad
python-soya - high level 3D engine for Python
python-soya-dbg - high level 3D engine for Python - debug extension
python-soya-doc - high level 3D engine for Python
python3-pygame - SDL bindings for games development in Python (Python 3)

So, too many hits, alas, but it does tend to find such things.

Laura

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


Re: 2to3 translation problem

2015-12-12 Thread Laura Creighton
In a message of Sat, 12 Dec 2015 17:59:52 +0100, Peter Otten writes:
>Tony van der Hoff wrote:
>
>> On 12/12/15 15:09, Mark Lawrence wrote:
>>> On 12/12/2015 14:42, Tony van der Hoff wrote:
 Debian Jessie, python 2.7; python 3.4

 I have an application, using pygame for graphics, that works fine under
 python2.7. I have run it through 2to3, but when running the result under
 python 3.4, I get the error :

 Traceback (most recent call last):
File "ppm304.py", line 9, in 
  import pygame
 ImportError: No module named 'pygame'

 So, python 3.4 can't find the library, whilst python 2.7 can.
 How do I track down/fix the missing dependency.
>>>
>>> This isn't a 2to3 translation problem.  You've installed pygame under
>>> 2.7 at some point, repeat the process for 3.4.  I've no idea how you'd
>>> do that on Debian Jessie but on Windows it'd be "pip3.4 install pygame".
>>>
>> Thanks, Mark, for the pointer. I'm pretty sure I installed Pygame from
>> Debian's repository, via apt-get install python-pygame. I believe that
>> should be effective for any version of Python.
>
>No, that is the version for Python 2. If there is a Python 3 version it will 
>be called
>
>python3-pygame
>
>but no such package seems to be available:
>
>https://packages.debian.org/search?suite=jessie&arch=any&searchon=names&keywords=python3-pygame

There is one in unstable, I forgot to check for jessie, sorry about that.

Laura

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


Re: 2to3 translation problem

2015-12-12 Thread Laura Creighton
In a message of Sun, 13 Dec 2015 04:50:43 +1100, Chris Angelico writes:
>On Sun, Dec 13, 2015 at 4:30 AM, Tony van der Hoff  wrote:
>> Thanks, Laura, and others who have replied. You're right; python-3-pygame
>> exists in unstable, but has not yet made it to jessie, even in backports.
>>
>> So, I'll stick with python 2.7 for the time being; really no hardship :)
>
>The easiest solution is simply:
>
>python3 -m pip install pygame
>
>Don't worry about it not being in the Jessie repo - you can always
>grab things using pip.
>
>ChrisA

What Chris said. :)

If you are about to move your life from being python2.7 based to 
being 3.x, you are not going to be able to depend on things getting
to jessie in a timely fashion.  So you will be doing this a whole lot.

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


Re: 2to3 translation problem

2015-12-12 Thread Laura Creighton
In a message of Sat, 12 Dec 2015 20:24:10 +, Tony van der Hoff writes:
>On 12/12/15 17:54, Laura Creighton wrote:
>> In a message of Sun, 13 Dec 2015 04:50:43 +1100, Chris Angelico writes:
>>> On Sun, Dec 13, 2015 at 4:30 AM, Tony van der Hoff  
>>> wrote:
>>>> Thanks, Laura, and others who have replied. You're right; python-3-pygame
>>>> exists in unstable, but has not yet made it to jessie, even in backports.
>>>>
>>>> So, I'll stick with python 2.7 for the time being; really no hardship :)
>>>
>>> The easiest solution is simply:
>>>
>>> python3 -m pip install pygame
>>>
>>> Don't worry about it not being in the Jessie repo - you can always
>>> grab things using pip.
>>>
>>> ChrisA
>>
>> What Chris said. :)
>>
>> If you are about to move your life from being python2.7 based to
>> being 3.x, you are not going to be able to depend on things getting
>> to jessie in a timely fashion.  So you will be doing this a whole lot.
>
>No:
>tony@tony-lx:~$ python3 -m pip install pygame
>/usr/bin/python3: No module named pip
>
>Hmm, apt-get install python3-pip: OK
>
>tony@tony-lx:~$ python3 -m pip install pygame
>Downloading/unpacking pygame
>   Could not find any downloads that satisfy the requirement pygame
>   Some externally hosted files were ignored (use --allow-external 
>pygame to allow).
>Cleaning up...
>No distributions at all found for pygame
>Storing debug log for failure in /home/tony/.pip/pip.log
>
>I really can't be bothered...
>
>Thanks for the hints.

Sorry, I forgot to warn you.  Debian, in its wisdom breaks python
up into several pieces, and so if you install python as a debian
package, you have to install the ability to use pip separately.

apt-get install python-pip  (for 2.x)
apt-get install python3-pip (for 3.x)

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


Re: Why doesn't response pydoc on my Python 2.7?

2015-12-12 Thread Laura Creighton
In a message of Sat, 12 Dec 2015 15:01:54 -0800, Robert writes:
>Hi,
>
>I want to use pydoc as some online tutorial shows, but it cannot run as 
>below. What is wrong?
>
>
>Thanks,
>
>
>
>
 import pydoc
 pydoc
>
 pydoc sys
>SyntaxError: invalid syntax
 import sys
 pydoc sys
>SyntaxError: invalid syntax
 help(pydoc)
>Help on module pydoc:
>..
>-- 
>https://mail.python.org/mailman/listinfo/python-list

You aren't supposed to type 
pydoc sys
from __inside__ your python command interpreter.

You type this at a command prompt.

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


Re: codecs.StreamRecoder not doing what I expected.

2015-12-13 Thread Laura Creighton
In a message of Sun, 13 Dec 2015 01:35:45 -0500, "D'Arcy J.M. Cain" writes:
>When I try to print it to the web page it fails because the \xe9
>character is not valid ASCII.  However, my default encoding is utf-8.
>Other web pages on the same server display fine.
>
>I have the following in the Apache config by the way.
>
>SetEnv PYTHONIOENCODING utf8
>
>So, my file is utf-8, I am reading it as utf-8, my Apache server output
>is set to utf-8.  How is ASCII sneaking in?

What is your sys.stdout.encoding ?

just import sys and print the thing.

I think you will find that it is not what you expect.

Laura

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


Re: Weird list conversion

2015-12-13 Thread Laura Creighton
In a message of Sun, 13 Dec 2015 11:45:19 -0800, high5stor...@gmail.com writes:
>Hi all,
>
>  f = open("stairs.bin", "rb") 
>  data = list(f.read(16))
>  print data
>
>returns
>
>['=', '\x04', '\x00', '\x05', '\x00', '\x01', '\x00', '\x00', '\x00', '\x00', 
>'\x00', '\x00', '\x00', '\x00', '\x00', '\x00']
>
>The first byte of the file is 0x3D according to my hex editor, so why does 
>Python return '=' and not '\x3D'?
>
>As always, thanks for any help!

0x3d is the ascii code for '='
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: cannot open file with non-ASCII filename

2015-12-14 Thread Laura Creighton
In a message of Mon, 14 Dec 2015 13:34:56 -0500, Terry Reedy writes:
>On 12/14/2015 11:24 AM, Ulli Horlacher wrote:
>> With Python 2.7.11 on Windows 7 my users cannot open/read files with
>> non-ASCII filenames.
>
>Right.  They should either restrict themselves to ascii (or possibly 
>latin-1) filenames or use current 3.x.  This is one of the (known) 
>unicode problems fixed in 3.x by making unicode the core text class, 
>replacing the implementation of unicode, and performing further work 
>with the new implementation.
>
>-- 
>Terry Jan Reedy
>
>-- 
>https://mail.python.org/mailman/listinfo/python-list

Given that Ulli is in Germany, latin-1 is likely to work fine for him.  And
you do it like this:

# -*- coding: latin-1 -*-
from Tkinter import *
root = Tk()
s = 'Välkommen till Göteborg'  # Welcome to Gothenburg (where I live)
u = unicode(s, 'iso8859-1')
Label(root, text=u).pack()

root.mainloop()

Laura



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


Re: cannot open file with non-ASCII filename

2015-12-14 Thread Laura Creighton
In a message of Mon, 14 Dec 2015 23:41:21 +0100, "Thomas 'PointedEars' Lahn" wr
ites:

>Why do you have to use msvcrt?
>
>I would use curses for user input, but:
>
>,-
>,-
>| 
>| No one has made a Windows port of the curses module. On a Windows 
>| platform, try the Console module written by Fredrik Lundh. The Console 
>| module provides cursor-addressable text output, plus full support for 
>| mouse and keyboard input, and is available from 
>| http://effbot.org/zone/console-index.htm.
>
>So you should try that instead.

If going for curses, I'd try this instead:
http://pdcurses.sourceforge.net/

Laura

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


Re: cannot open file with non-ASCII filename

2015-12-14 Thread Laura Creighton
In a message of Mon, 14 Dec 2015 17:55:04 -0600, eryk sun writes:
>On Mon, Dec 14, 2015 at 4:17 PM, Ulli Horlacher
> wrote:
>>
>> ImportError: No module named pyreadline
>>
>> Is it a python 3.x module?
>>
>> I am limited to Python 2.7
>
>pyreadline is available for 2.7-3.5 on PyPI. Anyway, I tried it to no
>avail. When dropping a file path into the console it ignores the
>alt-numpad sequences that get queued for non-ASCII characters, just
>like mvcrt.getwch. If you decide to roll your own getwch via ctypes or
>PyWin32, I suggest starting a new topic on the ctypes list or Windows
>list.
>-- 
>https://mail.python.org/mailman/listinfo/python-list

PyPy wrote its own pyreadline.
You can get it here. https://bitbucket.org/pypy/pyrepl
And see if it works any better.

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


Re: cannot open file with non-ASCII filename

2015-12-15 Thread Laura Creighton
In a message of Tue, 15 Dec 2015 08:26:37 +, Ulli Horlacher writes:
>Laura Creighton  wrote:
>
>> PyPy wrote its own pyreadline.
>> You can get it here. https://bitbucket.org/pypy/pyrepl
>
>As far as I can see, it has no getkey function.
>My users do not hit ENTER after drag&drop or copy&paste files.
>I need an input function with a timeout.

Right, then this isn't going to work.  Sorry about that.

Laura

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


Re: subprocess.call with non-ASCII arguments?

2015-12-15 Thread Laura Creighton
In a message of Tue, 15 Dec 2015 14:25:50 +, Ulli Horlacher writes:
>(My first posting seems to got lost)
>
>I want to create a zip file within a Python 2.7 program on windows.
>
>My code:
>
>  cmd = ['7za.exe','a','-tzip',archive] + files
>  status = subprocess.call(cmd)
>
>leads to:
>
>  File "fexit.py", line 971, in sendfile_retry
>status = subprocess.call(cmd)
>  File "C:\Python27\lib\subprocess.py", line 522, in call
>return Popen(*popenargs, **kwargs).wait()
>  File "C:\Python27\lib\subprocess.py", line 710, in __init__
>errread, errwrite)
>  File "C:\Python27\lib\subprocess.py", line 958, in _execute_child
>startupinfo)
>UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 
>87:
> ordinal not in range(128)
>
>
>This is because the array "files" contains filenames with non-ASCII
>characters.
>
>So, the problem is in subprocess.py, which I cannot modify.
>
>
>Instead of calling a 7z subprocess with non-ASCII arguments I tried to
>call it with a listfile: it starts with a "@" and contains the names of
>the files to be packed into the arcive. It is a special 7z feature.
>
>New code:
>
>  fileslist = archive + '.list'
>  flo = open(fileslist,'w')
>  for file in files: print(file,file=flo)
>  flo.close()
>  cmd = ['7za.exe','a','-tzip',archive,'@'+fileslist]
>  status = subprocess.call(cmd)
>
>
>But with that I get a new error:
>
>  File "fexit.py", line 959, in sendfile_retry
>for file in files: print(file,file=flo)
>UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 8:
>  ordinal not in range(128)
>
>
>I get the same error message, when i use:
>  flo = open(fileslist,'wb')
>  
>
>How can I tell open() or print() that I want to write non-ASCII ?

see if setting the environment variable PYTHONIOENCODING
https://docs.python.org/2/using/cmdline.html

works for you.  No promises, not a windows user.

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


Re: Library function to encode data to multipart/form-data format?

2015-12-21 Thread Laura Creighton
In a message of Mon, 21 Dec 2015 17:51:00 +, Grant Edwards writes:
>Is there a standard library function that can be used to encode data
>into multipart/form-data format?  IIRC, I looked for this once before
>and didn't find anything in the library. 
>
>[I don't want to actually send an HTTP POST or an email message, I
>just need to generate sets of data for test purposes.]
>
>-- 
>Grant Edwards   grant.b.edwardsYow! -- I love KATRINKA
>  at   because she drives a
>  gmail.comPONTIAC.  We're going
>   away now.  I fed the cat.
>-- 
>https://mail.python.org/mailman/listinfo/python-list

Cannibalise this:
http://code.activestate.com/recipes/146306/
which just uses standard library things.

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


me, my arm, my availability ...

2016-01-13 Thread Laura Creighton

I fell recently.  Ought to be nothing, but a small chip of bone, either an
existing one or one I just made is nicely wedged in the joint taking away
a whole lot of the ability of my arm to rotate in the elbow joint.  Or
hold my arm in a position that is usual for typing.  Plus,  now that the
sprain/swelling is more or less over, the pain, unfortunately is not.

The real downside is that my typing speed is down from 135-140 wpm
to 5-10 wmp.  At this rate, just getting my usual work done takes
overtime.

Seems like surgery is needed to fix this. 

So I wanted you all to know, no, I haven't forgotten you and no haven't
stopped caring.  I have just stopped being as __capable__ if you know
what I mean.

Please take care of yourselves and each other.  I will often be reading
even if typing is more than I can do right now.

Laura

ps -- (recent tutor discussion) I am with Alan and not with Mark.  I
am happy as anything when people post their not-quite-working code for
homework assignments here to tutor.  They aren't lazy bastards wanting
somebody to do their assignments for them, they want to learn why what
they are trying to do isn't working.  Sounds perfect for tutor to me.

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


Re: me, my arm, my availability ...

2016-01-13 Thread Laura Creighton
In a message of Wed, 13 Jan 2016 16:41:57 -0500, "David H. Lipman" writes:
>From: "Laura Creighton" 
>
>>
>> I fell recently.  Ought to be nothing, but a small chip of bone, either an
>
>Due to the side-effects of the prescription drugs you were given, I suggest 
>you not use a computer until you are no longer taking them.  ;-)

God, this is going to make playing games on my android tablet a problem.
And there _was_ a time when under drugs, killing monsters was about all
I was good for ...

Thank you for cheering me up, some.

Nice community this. :)

Laura

>Dave
>Multi-AV Scanning Tool - http://multi-av.thespykiller.co.uk
>http://www.pctipp.ch/downloads/dl/35905.asp 

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


tabs and the Python3 console

2015-02-10 Thread Laura Creighton
I have the debian version of python3 installed here.

Python 3.4.2 (default, Nov 13 2014, 07:01:52) 
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

But I cannot seem to type a tab here:

>>> def fn(**kw):
...

(I type a tab here, and get a beep.  If I type a tab again I get:

Display all 178 possibilities? (y or n)
ArithmeticError(chr(
AssertionError( class
AttributeError( classmethod(
BaseException(  compile(
BlockingIOError(complex(
BrokenPipeError(continue

...

Do I need a python3 enabled with readline support, or something?

Thanks very much,
Laura Creighton


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


Re: tabs and the Python3 console

2015-02-10 Thread Laura Creighton
In a message of Tue, 10 Feb 2015 16:50:54 +0100, Vincent Vande Vyvre writes:
>Le 10/02/2015 15:36, Laura Creighton a écrit :
>> I have the debian version of python3 installed here.
>>
>> Python 3.4.2 (default, Nov 13 2014, 07:01:52)
>> [GCC 4.9.2] on linux
>> Type "help", "copyright", "credits" or "license" for more information.
>> But I cannot seem to type a tab here:
>>
>>>>> def fn(**kw):
>> ...
>>
>> (I type a tab here, and get a beep.  If I type a tab again I get:
>>
>> Display all 178 possibilities? (y or n)
>> ArithmeticError(chr(
>> AssertionError( class
>> AttributeError( classmethod(
>> BaseException(  compile(
>> BlockingIOError(    complex(
>> BrokenPipeError(continue
>> 
>> ...
>>
>> Do I need a python3 enabled with readline support, or something?
>>
>> Thanks very much,
>> Laura Creighton
>>
>>
>
>It's a recent change (3.4), use the argument -S if you want the old 
>behaviour
>
>https://docs.python.org/3/library/site.html#rlcompleter-config
>
>Vincent

Thank you very, very much.

Laura

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


Re: Wildly OT: pop-up virtual keyboard for Mac or Linux?

2015-02-10 Thread Laura Creighton
I'm using this:
http://michel.staelens.pagesperso-orange.fr/clavier/index_GB.htm#
to get cyrillic.  Not sure the other alternatives will get you what
you want -- my keyboard is rather well loaded with accented letters
from the get-go.

Laura

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


Re: Wildly OT: pop-up virtual keyboard for Mac or Linux?

2015-02-10 Thread Laura Creighton
In a message of Tue, 10 Feb 2015 15:29:00 -0600, Tim Chase writes:
>While it's not exactly a hold-down-get-a-menu, I opt for changing my
>(otherwise-useless) caps-lock key to an X compose key:
>
>  $ setxkbmap -option compose:caps
>
>I can then hit caps-lock followed by what are generally intuitive
>sequences.  For your first one, that would be "capital-D minus".  I'm
>not sure what the other characters are supposed to be, so I'm not
>sure how to find them.  But é is "compose, e, apostrophe", ñ is
>"compose, n, tilde", the degree sign is "compose, o, o", the € is
>"compose, E, equals", etc. There are loads of these documented in (on
>my machine, where my locale is en_US.UTF-8)
>/usr/share/X11/locale/en_US.UTF-8/Compose
>
>Some of them are a little less intuitive, though the majority of the
>time I can just guess them (I'd never typed "Đ" before, but guessed
>and was right). Otherwise I search that above file.
>
>This also has the advantage that it should work in every X
>application, including Unicode-aware terminal applications (in
>Unicode-aware terminals).  Adding some sort of press-and-hold UI
>would limit it to those applications that chose to support it (or
>even *could* support it).
>
>> While I'm a touch typist, I almost never use auto-repeat, which is
>> the "binding" of held keys in most environments
>
>I agree, as vi/vim makes it easy to insert multiples of the same
>character (or characters) akin to what you describe in Emacs.
>
>-tkc

Wow.  US keyboards do not come with a 'compose' key, then?  It just
never occurred to me that Skip might be missing one.

Oh, goodness gracious then, go with this solution.  Much better than
mine --though the one I pointed at is great should you suddenly need
to type something in cyrillic while at a non-cyrillic keyboard.

Laura

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


Re: function inclusion problem

2015-02-10 Thread Laura Creighton
In a message of Tue, 10 Feb 2015 15:38:02 -0800, vlyamt...@gmail.com writes:
>I defined function Fatalln in "mydef.py" and it works fine if i call it from 
>"mydef.py", but when i try to call it from "test.py" in the same folder:
>import mydef
>...
>Fatalln "my test"
>i have NameError: name 'Fatalln' is not defined
>I also tried include('mydef.py') with the same result...
>What is the right syntax?
>Thanks
>-- 
>https://mail.python.org/mailman/listinfo/python-list

from mydef import Fatalln

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


Re: function inclusion problem

2015-02-10 Thread Laura Creighton
In a message of Wed, 11 Feb 2015 01:06:00 +0100, Laura Creighton writes:
>In a message of Tue, 10 Feb 2015 15:38:02 -0800, vlyamt...@gmail.com writes:
>>I defined function Fatalln in "mydef.py" and it works fine if i call it from 
>>"mydef.py", but when i try to call it from "test.py" in the same folder:
>>import mydef
>>...
>>Fatalln "my test"
>>i have NameError: name 'Fatalln' is not defined
>>I also tried include('mydef.py') with the same result...
>>What is the right syntax?
>>Thanks
>>-- 
>>https://mail.python.org/mailman/listinfo/python-list
>
>from mydef import Fatalln
>

Also, please be warned.  If you use a unix system, or a linux
system.  There are lots of problems you can get into if you
expect something named 'test' to run your code.  Because they
already have one in their shell, and that one wins, and so ...
well, test.py is safe.  But if you rename it as a script and call
it the binary file test ...

Bad and unexpected things happen.

Name it 'testme' or something like that.  Never have that problem again.
:)

Been there, done that!
Laura

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


Re: Wildly OT: pop-up virtual keyboard for Mac or Linux?

2015-02-11 Thread Laura Creighton
In a message of Wed, 11 Feb 2015 11:23:10 -0600, Skip Montanaro writes:
>Thanks for all the ideas. As I'm an Emacs user (since Gosmacs in the
>early 80s), I will likely focus my attention there first. While the
>xkbmap/Xmodmap path seems like it would also work on Linux, I'm
>guessing Apple wouldn't allow that sort of thing to sully Mac OS X...
>Despite its name 
>
>Skip
>-- 
>https://mail.python.org/mailman/listinfo/python-list

Looks to me as if this would work on your Mac.  But I don't have one,
so this is untested.

http://lifehacker.com/5882684/the-best-keyboard-remapper-for-mac-os-x

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


Re: Python 2.7.9, 3.4.2 won't verify SSL cert for "verisign.com"

2015-02-17 Thread Laura Creighton
I've seen something like this:

The requests module http://docs.python-requests.org/en/latest/
ships with its own set of certificates "cacert.pem"
and ignores the system wide ones -- so, for instance, adding certificates
to /etc/ssl/certs on your debian or ubuntu system won't work.  I edited
it by hand and then changed the REQUESTS_CA_BUNDLE environment variable
to point to it.

Perhaps your problem is along the same lines?

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


Re: Python 2.7.9, 3.4.2 won't verify SSL cert for "verisign.com"

2015-02-17 Thread Laura Creighton
Possibly this bug?
https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/1014640

Laura

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


Re: Python 2.7.9, 3.4.2 won't verify SSL cert for "verisign.com"

2015-02-17 Thread Laura Creighton
I am away on a consulting gig, so I really only have my laptop to test on.

Python 2.7.8 (default, Nov 18 2014, 14:57:17)
debian version jessie/sid
SSL test, with OpenSSL version OpenSSL 1.0.1j 15 Oct 2014.
Connection to "verisign.com" failed: [SSL: CERTIFICATE_VERIFY_FAILED] 
certificate verify failed (_ssl.c:581).

Connection to "www.verisign.com" failed: [SSL: CERTIFICATE_VERIFY_FAILED] 
certificate verify failed (_ssl.c:581).

Connection to "python.org" succeeded.

-

Python 3.4.2 (default, Nov 13 2014, 07:01:52)
debian version jessie/sid
SSL test, with OpenSSL version OpenSSL 1.0.1j 15 Oct 2014.
Connection to "verisign.com" failed: [SSL: CERTIFICATE_VERIFY_FAILED] 
certificate verify failed (_ssl.c:581).

Connection to "www.verisign.com" failed: [SSL: CERTIFICATE_VERIFY_FAILED] 
certificate verify failed (_ssl.c:581).

Connection to "python.org" succeeded.
---
openssl s_client -connect www.verisign.com:443 -CAfile cacert.pem

succeeds

.

So whatever problem there is, I have it too.

Laura

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


Re: python implementation of a new integer encoding algorithm.

2015-02-18 Thread Laura Creighton
Hi Jan.

I'm an old fart.  In the late 1970s, when I started programming these
things, and memory was non-existant, we came up with all sorts of data
compression algorithms which were absolutely necessary to get any work
done whatsoever.  Should you ever need an assembler programmer for
quick and dirty hacks for the PDP-11 line (11/20 and 11/05 preferred
as it is harder) I am still the woman for the job.  Indeed, I spent
most of my 20s finding better and better ways to fit programs into
smaller and smaller memory footprints.

I perfectly understand the intellectual thrill of doing such things.
As puzzles go, it is about as cool a one as exists, and its all for
things that matter -- for real.

However, in the matter of financial compensation and world recognition,
you have just laid a very large goose-egg.   The VAX-11/780 was introduced
on October 25, 1977, according to wikipedia.  But in my world, it was 1982
before I got to see the first one.  And it was godly more expensive than
a pdp-11, but the writing was on the wall.  The thing could page, and
so all the techniques we learned for making our code concise -- let alone
the dirty tricks I specialised in -- were no longer relevant.

>From the mid 1980s onward I have been telling people 'your code is
ugly, please tighten it up by refactoring it  and ' and
when I am their instructor they grumble and do it, and otherwise they
flip me the bird.  In their eyes, it doesn't matter how the code
_looks_ as long as it does the job.  And I deeply sympathise.  But
what I am going for is not a 'death - by looking unfashionable' but
rather a demand that good code is clear to understand.  Because what
I have learned, that Brian Kernighan expressed a long time ago is
that:

Debugging is twice as hard as writing the code in the
first place. Therefore, if you write the code as cleverly
as possible, you are, by definition, not smart enough to debug it.

Your proposed encoding scheme (if it does as you say, I have not
analysed it) scores very, very high in the _cleverness_ department.
Enough that a lot of people, who aren't as clever as you do, have
no hope in hell of ever being clever enough to debug something that
uses it.  Therefore, you will never see widespread adoption of your
scheme, no matter how brilliantly it does as you say, because we all
need things that are easier to debug more than we need better compression.

So now you are sad.  I was sad, too, but the sooner I learned this the
sooner I could stop wasting my time creating algorithms that provided
cool functionality that people hated for the same reasons I found them
cool.

You need to find a different sort of algorithm that people like to use
if you want to get widespread success in the world of widely used
algorithms.  If you have found a way to improve on Lemel-Ziv, then this
will count.

But it may be that your next step is 'how to encode things that
are not phonetic language'.  Go look -- for the next few months --
at how MIDI stores sounds.  You will find plenty of places for
improvement, but the idea is not to improve the standard but to learn
it well enough that you can see things in the non-alphabetic world.

So then, now what?

If you are still fired up with the desire to compress things, then
there is a huge, _very well paying_ market I want to introduce you
to.  And this is _tech support for porn sites_.  Porn sites make a
ton of money, indeed the numbers are scary.  And here the idea of
'I saved 2% of time/bandwidth/disk space/' really matters.  You
can really save money for them, and it really matters to them.
Since I have never found sex 'dirty' and indeed consider it one
of the great joys in life, I have never found anything wrong with
working for porn sites.

And, hell, out of male porn Jimmy Wales made wikipedia.  Haven't
we all benefitted?

But, right now, you are, alas for you, about 45 years too late for the
ideas you are sprouting.  I had similar ones about 30 years too late
and, well, they only worked for me for about 3-5 years.  Sucks to be
you, friend -- you needed to be your grandfather, I fear.


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


Re: can python handle CHIME .spt files?

2015-02-18 Thread Laura Creighton
I went and asked your question to Andrew Dalke, who is an expert
in such things.  Writing programs for visualising molecules is what
he does for a living.  The news is not good.

First of all, he says the "spt" format is a command format.
See http://www.callutheran.edu/BioDev/omm/scripting_ch/molmast.htm
for examples.

  select all; wireframe;
dots off; wireframe off; backbone;
  wireframe 100; spacefill off; list molsurface transparent;
select all; spacefill; set specular on; set specpower 20;
  define piece :A and 10, :A and 11, :A and 12;
select all; spacefill off; wireframe;
  select atomno=4174; label protein;

It's like Tcl, with lots of internal syntax handled by the individual commands.

For example, "select atomno=4174" takes a full expression, like

  select atomno >= 195 and atomno <= 277

More details at http://jmol.sourceforge.net/docs/JmolUserGuide/ch04.html .

The only way to tell that it works, in Python and without using Chime, is
to re-write command interpreter that understands the script syntax.   Andrew
Dalke says that he tried something like that back in the 1990s, and
while it's possible, it is not easy.  When Andrew says things like that,
you can bet money that it is very, very hard, because he does seemingly
impossible things for fun over breakfast.  Indeed, I wrote him hoping he
would have scripts lying around that already do this ...

He says that, these days, the best solution would probably be some
in-browser Javascript code that drives Chime and checks if there's an error,
but this is also not a job for somebody who is learning how to program,
and iff it's less than several dozen/100 scripts, then really this is best
done manually, unless the person  enjoys programming.

If you want to write him and ask him more questions, his contact page
is at http://www.dalkescientific.com/contact.html  He's very friendly,
as well as being a very good friend of mine.

Laura Creighton

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


Re: can python handle CHIME .spt files?

2015-02-18 Thread Laura Creighton
In a message of Wed, 18 Feb 2015 21:23:50 -0800, Ethan Furman writes:
>On 02/18/2015 08:57 PM, Laura Creighton wrote:
>
>> I went and asked your question to Andrew Dalke, who is an expert
>> in such things. 
>
>Did you happen to ask him about PyMol?  Just curious.  ;)
>
>--
>~Ethan~

I hadn't then, but have since.  I will report what he says.

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


Re: can python handle CHIME .spt files (fwd)

2015-02-19 Thread Laura Creighton
So I asked Andrew about PyMol.  Here's what he said:

--- Forwarded Message

Return-Path: 
From: Andrew Dalke 
In-Reply-To: <201502190705.t1j75wx7024...@fido.openend.se>
Date: Thu, 19 Feb 2015 10:55:09 +0100
Message-Id: <47ec31ce-33ac-4426-a874-ff4107f0c...@dalkescientific.com>
On Feb 19, 2015, at 8:05 AM, Laura Creighton wrote:
> Now discussion has moved to 
> http://www.pymol.org/
> 
> Do you know if that will do the job?  Or anything else about it?

I do not know. My knowledge of that field is rather dated now. The
best I can find in a quick search is a RasMol -> PyMol converter in
2,600 lines of Python, at

  
http://sourceforge.net/projects/sbevsl/files/ConSCRIPT/ConSCRIPT-1.0/ConSCRIPT_17Jun10/
  
https://ritdml.rit.edu/bitstream/handle/1850/9019/SMottarellaAbstract2008.pdf?sequence=8

and quoting from http://blondie.dowling.edu/docman/view.php/24/692/ACA_JUL09.ppt

The latest version of ConSCRIPT has coded for almost all of the
commands possible in RasMol.  While support for some remains minimal,
included some that only return incompatibility errors, most commands,
including most of those that directly manipulate the image, are
supported.  Here are some of the commands that have recently been
added.

I have no experience with it. The review at
  https://www.mail-archive.com/jmol-users@lists.sourceforge.net/msg16583.html
says its works quite well.

I don't know how portable it is to the Chime commands.

Cheers,

Andrew
da...@dalkescientific.com



--- End of Forwarded Message
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to design a search engine in Python?

2015-02-22 Thread Laura Creighton
In a message of Sat, 21 Feb 2015 22:07:30 -0800, subhabangal...@gmail.com write
>Dear Sir,
>
>Thank you for your kind suggestion. Let me traverse one by one. 
>My special feature is generally Semantic Search, but I am trying to build
>a search engine first and then go for semantic I feel that would give me a 
>solid background to work around the problem. 
>
>Regards,
>Subhabrata. 

You may find the API docs surrounding rdelbru.github.io/SIREn/
of interest then.

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


Re: Design thought for callbacks

2015-02-22 Thread Laura Creighton
somebody, I got confused with the indent level wrote:

>> They force the use of the much slower cycle-detecting GC, rather than
>> the quick and efficient CPython refcounter.

Somebody has misunderstood something here.  When it comes to efficient
garbage collectors, refcounting is a turtle.  The CPython one is no
exception.  Ref counting, however, is fairly easy to write.  But when
the PyPy project first replaced its refcounting gc with its very first
and therefore not very efficient at all nursery gc ... that was the very
first time when a bunch of python programs ran faster on pypy than on
CPython.  This was before pypy had a JIT.

And today the pypy channel is full of people who want to link their
C extension into some Python code running on PyPy, and who find that
their C extension slows things down.  There are lots of reasons for
this, but one of the most common problems is 'this C extension is
faking refcounting.  All of this is wasted effort for PyPy and
usually makes the thing unJITable as well.'  Many of these people
rewrite their C extension as pure Python and find that then, with
PyPy, they get the speed improvements they were looking for.

So: two points.

One reason you might not want to rely on ref counting, because you expect
your code to run under PyPy one day.

and

If you are interested in manipulating garbage collection -- especially if
this is for your own pleasure and enjoyment, a worthy goal in my books --
you could do a lot worse than write your own gc in RPython for PyPy.
The gc code is not mixed in with all of the other VM stuff, so a gc is
small, and you don't have to worry about clobbering anything else while
you are working.  So it is great for experimenting, which was the whole
point.  Hacking gcs is fun! :)

Laura

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


Re: Design thought for callbacks

2015-02-22 Thread Laura Creighton
In a message of Sun, 22 Feb 2015 07:16:14 -0500, Cem Karan writes:

>This was PRECISELY the situation I was thinking about.  My hope was
>to make the callback mechanism slightly less surprising by allowing
>the user to track them, releasing them when they aren't needed
>without having to figure out where the callbacks were registered.
>However, it appears I'm making things more surprising rather than
>less.

You may be able to accomplish your goal by using a Queue with a
producer/consumer model.
see: 
http://stackoverflow.com/questions/9968592/turn-functions-with-a-callback-into-python-generators

especially the bottom of that.

I haven't run the code, but it looks mostly reasonable, except that
you do not want to rely on the Queue maxsize being 1 here, and
indeed, I almost always want a bigger Queue  in any case.  Use
Queue.task_done if blocking the producer features in your design.

The problem that you are up against is that callbacks are inherantly
confusing, even to programmers who are learning about them for the
first time.  They don't fit people's internal model of 'how code works'.
There isn't a whole lot one can do about that except to
try to make the magic do as little as possible, so that more of the
code works 'the way people expect'.

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


Re: Future of Pypy?

2015-02-22 Thread Laura Creighton
In a message of Sun, 22 Feb 2015 12:45:03 +, Dave Farrance writes:

>Maybe there's not enough people like me that have really felt the need for
>the speed.  Or maybe it's simply the accident of the historical
>development path that's set-in-stone an interpreter rather than a JIT.
>Anybody got a useful perspective on this?

I don't understand 'an interpreter rather than a JIT'.  PyPy has a
JIT, that sort of is the whole point.

One problem is that hacking on PyPy itself is hard.  Lots of people
find it too hard, and give up.  (Of course, lots of people give up
on hacking CPython too.  I think that hacking on PyPy is harder than
hacking on CPython, but I am quite biased.)  So this is a barrier to
getting more people to work on it.

Provided your code is in pure python, PyPy already works great for you.
as you found out.  Pure Python libraries aren't a problem, either.

The problem arises when you want to add your fancy graphic library to
what you do, because chances are that fancy library is a C extension.
And there is no magic 'sprinke this dust here' on a C extension that
makes it acceptable to PyPy.  It's a hard job.  The PyPy team has
gone after, and rewritten how to do this I think 5 times now.  Maybe
more.  Every time the goal has been to make it easier for the average
programmer to make an interface, and, of course to not slow things down
too much.  C extensions, in general, make PyPy code run a lot slower because
you cannot get the JIT in there to speed things up, so you may be
stuck with unjitted PyPy performance, even on your python code,
which isn't speedy.  You also find lots of bugs in the C extensions,
which don't get noticed until you, for instance, no longer have a ref
counting GC.

Some of the things aren't really bugs, exactly, just that the person
who wrote the thing knew far, far, too much about how CPython works
and has produced something that had no need or desire to be portable
anywhere else.  The closer the person who wrote the extension
was 'to the metal' .. knowing _exactly_ how CPython does things and how
to squeeze that for the tiniest last drop of performance improvement 
the harder things are for whoever wants to get it to work with PyPy, which
has a competely different architecture and a whole lot of other assumptions.

And the slower that it will run.  So, if it is a small thing, then the
usual suggestion is to rewrite it in pure python and let the JIT handle
it.  Very, very often the result is faster than the pure C code, but
clearly this isn't something you want to do with a huge graphics
library ...

There is hope that we can take another crack at this problem using
things learned from the Transactional Memory stuff, but nobody is promising
anything yet.  Also Armin has had a new neat thought.

https://mail.python.org/pipermail/pypy-dev/2015-February/013085.html

If we can get rid of the warmup time, then PyPy should be more popular
than it is now.  Lots of people run PyPy once, un-warmed up, see no
big improvement, and decide it's not for them.

But the problem of

'here is a huge chunk of C code, designed to work with Language X.
Now make it work with Language Y (PyPy) which isn't written in C'
can only be simplified to a certain extent.  There comes a point
where _this is just bloody hard_.

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


Re: Future of Pypy?

2015-02-22 Thread Laura Creighton
In a message of Sun, 22 Feb 2015 15:36:42 +, Dave Farrance writes:
>Laura Creighton  wrote:
>
>>I don't understand 'an interpreter rather than a JIT'.  PyPy has a
>>JIT, that sort of is the whole point.
>
>Yes.  I meant that from my end-user, non-software-engineer perspective, it
>looked as though CPython was proceeding with leaps and bounds and that
>PyPy remained mostly a proof-of-concept after several years.

Oh no, that was the state of the world about 8 years ago.  PyPy works
great, and more and more people are using it in production all the
time.

>But thanks for your description of the issues.  So once the core issues
>are sorted out, if enough people can be found to work on it, then
>hopefully the library conversions will follow apace.

Well, most libraries just run, of course. It's the ones that are written
in C that cause most of the problems.

One of the problems, from a pure Have-PyPy-Take-Over-the-World
perspective is that as things were moving along quite merrily,
the CPython core developers decided to invent Python 3.0.  This
meant that everybody on the planet, who wanted their library to
work with Python 3.0 had to convert it to work there.

There was, and still is, an enormous amount of resentment about this.
For a lot of people, the perception was, and still is that the benefits
of Python 3.x over Python 2.x was not worth breaking backwards
compatibility.  And there still are plenty of places whose plan is
to use Python 2.7 indefinitely into the far future.  I've got 15
years worth of commerical python code out there in the world, and
nobody wants it converted enough to pay me to do so.  Their position
is that it runs quite well enough as it is.  I'm sure not
going to convert the stuff for fun.  Practically every Python consultant on
the planet is in the same boat.

Things will get converted when there is a compelling business argument
to do so, but not before, and for a lot of code the answer is never.

Given the nature of this political problem, it is not surprising that
the proponents of Python 3.0 spent a lot of effort talking about the
benefits, and praising the people who converted their stuff, and
making a huge effort in the public relations lines.  The whole thing
could have blown up in their faces, as is quite common when you decide
to make the 'second version' of a language.  It happened to Perl.  So
this creates buzz and warm feelings about Python 3.0.

In contrast, on the PyPy team, there is nobody who doesn't consider
public relations and marketing and 'creating the warm fuzzy feelings in
the users' somewhere between 'unpleasant duty' and 'sheer torture'.
The set of human skills you need to have to be good as this sort of
thing is not a set that we have, either collectively or in individuals.
We're much more into 'letting the code speak for itself', which, of
course, it does not do.

A lot of us, indeed were raised on a philosophy that it is morally wrong
to try to influence people.  You can give them options, and you can
even explain the options that you are giving them, and you can argue
with others in favour of certain options, but when it comes right down to
it, everybody has to make their own decision.

This is all well and virtuous, but the fact of the matter is that a large
number of people aren't competant to make their own decisions, and even
among those that are there exist a large number who very
much don't want to do such a thing.  If you are trying to get such people
to adopt your software, you need to provide a completely different
experience.  They need to feel comfortable, and safe, and among a
large community, and, well, I don't know what else they want.  That is
part of the problem.  I am pretty sure that what they want is something
that I never pay a lot of attention to. I mean  I'm a charter member of
the 'always-sacrifice-comfort-in-order-to-have-fun-and-interesting-times'
club.  And my marketing skills, such as they are, are much above average
for the PyPy gang - though some members are learning a bit, slowly, through
necessity.  But you notice that we have only 1 blog, and things are added
to it very slowly.  There are people all over planet python who blog about
things every week, for fun.  There is no way we can compete with them.

So, until some people with such skills decide to take an interest in
PyPy, our marketing effort is going to limp. And I personally feel
pretty bad about asking some poor soul who has just made his C extension
work with 3.0 go back and do it _again_ in a more PyPy friendly way.

But if Armin gets the Transactional Memory to be usable in a robust
way, (as opposed to now where it is only a bit more than a proof of
concept) then things could rocket off again.  Because one thing we
do know is that people who are completely and utterly ignorant about
whether hav

Re: id() and is operator

2015-02-22 Thread Laura Creighton
In a message of Sun, 22 Feb 2015 09:53:33 -0800, LJ writes:
>Hi everyone. Quick question here. Lets suppose if have the following numpy 
>array:
>
>b=np.array([[0]*2]*3)
>
>and then:
>
 id(b[0])
>4582
 id(b[1])
>45857512
 id(b[2])
>4582
>
>Please correct me if I am wrong, but according to this b[2] and b[0] are the 
>same object. Now,
>
 b[0] is b[2]
>False


You are running into one of the peculiarities of the python representation
of numbers.  It can make things more efficient to represent all common
numbers as 'there is only one' of them.

So.

  Python 2.7.9 (default, Dec 11 2014, 08:58:12)
 [GCC 4.9.2] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 >>> a = 1
 >>> b = 1
 >>> a is b
 True
 >>> a = 1001
 >>> b = 1001
 >>> a is b
 False


Don't rely on this.  Other implementations are free to implement this
however they like.


[PyPy 2.4.0 with GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 a = 1001
 b = 1001
 a is b
True

Laura


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


Re: Future of Pypy?

2015-02-22 Thread Laura Creighton
In a message of Sun, 22 Feb 2015 11:02:29 -0800, Paul Rubin writes:
>Laura Creighton  writes:
>> Because one thing we do know is that people who are completely and
>> utterly ignorant about whether having multiple cores will improve
>> their code still want to use a language that lets them use the
>> multiple processors.  If the TM dream of having that just happen,
>> seemlessly (again, no promises) is proven to be true, well   we
>> think that the hordes will suddenly be interested in PyPy.
>
>TM is a useful feature but it's unlikely to be the thing that attracts
>"the hordes".  More important is to eliminate the GIL and hopefully have
>lightweight (green) threads that can still run on multiple cores, like
>in GHC and Erlang.  Having them communicate by mailboxes/queues is
>sufficient most of the time, and in Erlang it's the only method allowed
>in theory (there are some optimizations taking place behind the scenes).
>TM hasn't gotten that much uptake in GHC (one of the earliest HLL
>implementations of TM) in part because its performance cost is
>significant when there's contention.  I wonder if Clojure programmers
>use it more.

The GIL isn't going away from PyPy any time real soon, alas.  Armin has
some pretty cool ideas about what to do about contention, but if
you want to hear them, its better if you go post that to pypy-...@python.org
so you can get it from the man directly rather that hearing my
paraphrase.  Or ask away on the #pypy channel on freenode ...

But this reminds me that I have to get Lennart Augustsson and Armin
Rigo in the same room some time.  Should be fun.

Laura

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


Re: id() and is operator

2015-02-22 Thread Laura Creighton
Ooops, I missed the numpy, so I thought that it was the contents
of the array that was causing the problem.  My very bad.  Apologies.

Laura

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


Re: Future of Pypy?

2015-02-22 Thread Laura Creighton
Good news  -- it seems to be working fine with PyPy.
https://travis-ci.org/hugovk/Pillow/builds

for me, not extensively tested, it just seems to be working.

I have several pypy's floating around here, each within its own
virtualenv.  If you aren't familiar with virtualenv, read all
about it here:
http://www.dabapps.com/blog/introduction-to-pip-and-virtualenv-python/

Note the first question to the blog writer is 'how to get it to work
with pypy'.  Do what he says.  virtualenv -p /path/to/pypy env
but, if you want to use more bleeding edge pypy you will want:

# from a tarball
$ virtualenv -p /opt/pypy-c-jit-41718-3fb486695f20-linux/bin/pypy my-pypy-env

# from the mercurial checkout
$ virtualenv -p /path/to/pypy/pypy/translator/goal/pypy-c my-pypy-env

I've only got bleeding edge PyPys around here, in virtualenvs, but
in all of them

import sys
from PIL import Image

for infile in sys.argv[1:]:
   try:
   with Image.open(infile) as im:
 print(infile, im.format, "%dx%d" % im.size, im.mode)
   except IOError:
 pass

which I pasted right in from
http://pillow.readthedocs.org/en/latest/handbook/tutorial.html

seems to be working just fine for me.  Hardly an exhaustive test,
but ... well, try it and see how it goes for you.

I don't know what time it is where you are, but it is 22:44 here now, and
alas I promised a kivy demo to a client tomorrow morning, and, double
alas, I haven't written it yet.  It shouldn't take more than an hour or
three to write, but I am going to have to stop having pleasant chats
about pypy for a while and get this thing done ... :)

Laura




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


Re: Future of Pypy?

2015-02-22 Thread Laura Creighton
In a message of Sun, 22 Feb 2015 12:14:45 -0800, Paul Rubin writes:
>Laura Creighton  writes:
>> The GIL isn't going away from PyPy any time real soon, alas.
>
>I thought the GIL's main purpose was to avoid having to lock all the
>CPython refcount updates, so if PyPy has tracing GC, why is there still
>a GIL?  And how is TM going to help with parallelism if the GIL is still
>there?

This requires a long answer.   a very long answer.
More later, I must work this evening.

>> Armin has some pretty cool ideas about what to do about contention,
>> but if you want to hear them, its better if you go post that to
>> pypy-...@python.org...  Or ask away on the #pypy channel on freenode
>
>It would be nice if he blogged something about them.

You are asking for water to roll up-hill.  If you want the joy of
hearing the cool ideas as Armin has them, you need to hang out on
the irc channel.  Of course, if you are interested in such things
this makes hanging out there worthwhile.

>> But this reminds me that I have to get Lennart Augustsson and Armin
>> Rigo in the same room some time.  Should be fun.
>
>I thought the STM stuff in GHC was done by the Simon's.  Armin should
>certainly have Simon Marlow's book about concurrency and Haskell:

Of course, but if you think that Lennart Augustsson is not familiar
with every aspect of every Haskell compiler on the planet  well
then I know Lennart better than you do.  And given that Lennart is
a friend, well really a good friend of my lover and a something-better-
than-an-acquaintance with me  I should make the effort to get these
two under the same roof (mine, by preference) for the fun of the
experience.

So thank you for giving me this idea ...

Laura


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


Re: Design thought for callbacks

2015-02-22 Thread Laura Creighton
In a message of Sun, 22 Feb 2015 17:09:01 -0500, Cem Karan writes:

>Documentation is a given; it MUST be there.  That said, documenting
>something, but still making it surprising, is a bad idea.  For
>example, several people have been strongly against using a WeakSet to
>hold callbacks because they expect a library to hold onto callbacks.
>If I chose not to do that, and used a WeakSet, then even if I
>documented it, it would still end up surprising people (and from the
>sound of it, more people would be surprised than not).

>Thanks, Cem Karan

No matter what you do, alas, will surprise the hell out of people
because callbacks do not behave as people expect.  Among people who
have used callbacks, what you are polling is 'what are people
familiar with', and it seems for the people around here, now,
WeakSets are not what they are familiar with.

But that is not so surprising.  How many people use WeakSets for
_anything_?  I've never used them, aside from 'ooh! cool shiny
new language feature!  Let's kick it around the park!'  That people
aren't familiar with WeakSets doesn't mean all that much.

The question I have is does this architecture make things harder,
easier or about the same to debug?  To write tests for? to do Test
Driven Design with?

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


Re: Future of Pypy?

2015-02-23 Thread Laura Creighton
Arrgh!  I forgot to warn you that you need a very recent version of
virtualenv to work with PyPy.  I am very sorry about that.  Glad to
see that things are working now.

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


Re: Python shell: Arrow keys not working in PuTTY

2015-02-24 Thread Laura Creighton
In a message of Tue, 24 Feb 2015 11:18:38 +, David Aldrich writes:
>> >> BUT do *not* run `make install` as that will overwrite your system
>> >> Python and Bad Things will happen. Instead, run `make altinstall`.
>
>Thanks for all the warnings. We did use `make altinstall`, so all is ok.
>
>Recompiling, with readline installed, fixed the arrow keys.

Great!  Thank you for letting us know.

Laura (who was worried)

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


  1   2   3   4   5   6   7   >