Re: Free chapter about Python and databases (MySQL and SQLite)

2010-05-28 Thread Robinow



 wrote:


Sebastian Bassi  writes:

On Fri, May 28, 2010 at 12:37 AM, John Bokma   
wrote:


Even if it's just a few bucks, it's still money saved [0]. On top of
that I think it's way better to point your audience to good books on  
the

topic and skip the intro instead of doing a (half hearted IMO) attempt
at it yourself.





OK, John. What book do you recommend?

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


Re: Issues compiling hunspell from source on windows

2013-06-30 Thread David Robinow
It appears you are using a 32 bit compiler with a 64-bit python.
Install a 32 bit python.

On Sun, Jun 30, 2013 at 11:54 AM, Akshay Kayastha  wrote:
> Hi I am trying to compile a python module called hunspell from the following 
> [source](https://pypi.python.org/pypi/hunspell).
>
> But I get the following error message.
>
> C:\Users\KURO\Desktop\hunspell-0.1>setup.py install
> running install
> running build
> running build_ext
> building 'hunspell' extension
> C:\mingw\bin\gcc.exe -mno-cygwin -mdll -O -Wall -D_LINUX 
> -I/usr/include/hunspell
>  -IC:\Python27\include -IC:\Python27\PC -c hunspell.c -o 
> build\temp.win-amd64-2.
> 7\Release\hunspell.o -Wall
> writing build\temp.win-amd64-2.7\Release\hunspell.def
> C:\mingw\bin\gcc.exe -mno-cygwin -shared -s 
> build\temp.win-amd64-2.7\Release\hun
> spell.o build\temp.win-amd64-2.7\Release\hunspell.def 
> -LC:\Python27\libs -LC:\Py
> thon27\PCbuild\amd64 -lhunspell-1.2 -lpython27 -lmsvcr90 -o 
> build\lib.win-amd64-
> 2.7\hunspell.pyd
> c:/mingw/bin/../lib/gcc/mingw32/4.3.3/../../../../mingw32/bin/ld.exe: 
> cannot fin
> d -lhunspell-1.2
> collect2: ld returned 1 exit status
> error: command 'gcc' failed with exit status 1
>
> I tried downloading libhunspell-1.2-0.dll and put it into my system. But I 
> still get the same error message. How do I deal with this? I have Windows 7 
> and [mingw](http://www.develer.com/oss/GccWinBinaries)
> --
> http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: embedded python and threading

2013-07-26 Thread David Robinow
Works for me.
Except that if I then do:
  touch time.py

I get the same error as you do.

Can you figure out the problem now?

On Fri, Jul 26, 2013 at 11:57 AM, David M. Cotter  wrote:
> okay, i have simplified it:  here is the code
>
> ==
> import time
>
> def main():
> while True:
> print "i'm alive"
> time.sleep(0.25)
>
> #-
> if __name__ == "__main__":
> main()
> ==
>
> the new error is:
>
> ==
> 9: Traceback (most recent call last):
> 9:   File "", line 10, in ?
> 9:   File "", line 6, in main
> 9: AttributeError: 'builtin_function_or_method' object has no attribute 
> 'sleep'
> ==
> --
> http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Interview Questions

2012-07-10 Thread David Robinow
On Tue, Jul 10, 2012 at 1:02 PM, Ethan Furman  wrote:
...
>
> Reminds me of a job posting a few years ago where the prospective employer
> wanted three plus years experience in some language, and that language had
> only been created a year and a half before.
 I saw several of those when Java was new.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Converting a list of strings into a list of integers?

2012-07-22 Thread David Robinow
On Sun, Jul 22, 2012 at 12:20 PM, Jan Riechers  wrote:
> On 22.07.2012 18:39, Alister wrote:
>> looks like a classic list comprehension to me and can be achieved in a
>> single line
>> MODUS_LIST=[int(x) for x in options.modus_list]
> Hi,
>
> I am not sure why everyone is using the for-iterator option over a "map",
> but I would do it like that:
> MODUS_LIST= map(int, options.modus_list)
>
> "map" works on a list and does commandX (here "int" conversion, use "str"
> for string.. et cetera) on sequenceY, returning a sequence. More in the help
> file.
>
> And if I'm not completely mistaken, it's also the quicker way to do
> performance wise. But I can't completely recall the exact reason.
 Because if you don't have a functional background 'map' is
unfamiliar. Although I've been aware of it for years I still can't
remember if it's map(int, list) or map(list,int) and although with a
small effort I could force it into my brain, I know that many of the
people reading my code are as ignorant as I am. The list comprehension
seems clearer to me.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Filter versus comprehension (was Re: something about split()???)

2012-08-25 Thread David Robinow
On Fri, Aug 24, 2012 at 3:03 PM, Walter Hurry  wrote:
> On Fri, 24 Aug 2012 14:29:00 -0400, Dennis Lee Bieber wrote:
>
>> It appears to be a change Google made in the last month or two... My
>> hypothesis is that they are replacing hard EOL found in inbound NNTP
>> with an HTML , and then on outgoing replacing the  with a pair of
>> NNTP line endings. In contrast, text composed on Google is coming in as
>> long single lines (since quoting said text in a response produces on a
>> ">" at the start of the paragraph.
>
> Google Groups sucks. These are computer literate people here. Why don't
> they just use a proper newsreader?
I haven't used a newsreader in over a decade. I'm quite happy with a
mailing list. Am I missing something?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Stop feeding the trolls (Was: which a is used?)

2012-09-25 Thread David Robinow
On Tue, Sep 25, 2012 at 9:53 AM, D'Arcy Cain  wrote:
> ...
> Now if only people would stop feeding the troll, those of us who have
> already *plonked* him can stop seeing his ramblings in the responses.
 I'm hating myself for jumping in to this nonsense, but ...
+1
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Coexistence of Python 2.x and 3.x on same OS

2012-10-01 Thread David Robinow
On Sun, Sep 30, 2012 at 11:55 PM, Dave Angel  wrote:
>> The problem with that is that one has to already being using 3.3 to
>> use this facility. I was hoping for a solution which was backwards
>> compatible with Python 2.x.
>>...
>> That does not solve the problem for Python 2.x distributions.
> If you read the Pep, it says the launcher will work for both 2.x and 3.x
> http://www.python.org/dev/peps/pep-0397/
> 
>
> I've read that elsewhere, but I can't see just where you would get the
> necessary modules to run it with 2.x   Possibly you'd have to build it
> from sources, as there are Windows binaries that get installed to the
> C:\Windows directory.
I'm not sure what you're getting at here. The solution is to install
Python 3.3, which provides the launcher. It works with Python 2.x. Is
there some reason not to install 3.3?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Script for finding words of any size that do NOT contain vowels with acute diacritic marks?

2012-10-17 Thread David Robinow
On Wed, Oct 17, 2012 at 1:07 PM, Ian Kelly  wrote:
> "return len(w) != len(w_decomposed)" is all you need.
 Thanks for helping, but I already knew that.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A desperate lunge for on-topic-ness

2012-10-20 Thread David Robinow
On Sat, Oct 20, 2012 at 3:10 PM, Dennis Lee Bieber
 wrote:
> On Sat, 20 Oct 2012 14:18:47 + (UTC), Grant Edwards
>  declaimed the following in
> gmane.comp.python.general:
>
>>
>> True, but nobody prints source code out on paper do they?
>>
>> Seriously -- I can't remember the last time I printed souce code...
>
> Well, having been unemployed for a year, I can't speak much of
> recent practice...
>
> But I did tend to run up listings when I had to take over
> maintenance of some programs and needed to become familiar with the
> overall code base...
Same here. I've been unemployed (retired!) 6 years, but I'd
occasionally print code written by someone else, never anything of my
own.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: I need help installing pypng in Python 3.3

2012-10-29 Thread David Robinow
On Mon, Oct 29, 2012 at 8:23 AM,   wrote:
> Hello all,
>
> I am very new to python. I am currently porting a little project of mine from 
> java to python and I need to be able to construct and write png images. I 
> naturally turned myself toward pypng to accomplish this.
>
> I learned from the net that pypng 0.0.13 is supposed to work in Python 3.x 
> when run through '2to3'. However, in my case, it apparently does not.
>
You haven't shown that.
> I ran into various problems when trying to install it, some of them I could 
> fix myself. First I attempted to install pip but I couldn't get Windows to 
> recognize pip as an internal command as the prompt informs me.
 No, it's not an internal command, but you don't need that. I'm
assuming your python is installed under C:\Python33. If not, adjust as
needed.  Try:
 C:\Python33\Scripts\pip install pypng

[You didn't say what you did to install pip so I don't know if pip.exe
actually exists in C:\Python33\Scripts]

> Then I tried to directly run "setup.py install" from the pypng folder. It 
> didn't work as I got a syntax error. I noticed that in the beginning of the 
> installation process, the following warning was displayed: "conf[use_2to3 = 
> true] unrecognized configuration option"

 The following works for me:
C:\Python33\python setup.py install

>
> At that point I was already pretty pissed but I managed to make the warning 
> disappear by updating (installing?) distribute. After that there are no more 
> errors during the installation process and everything seems to work fine. 
> (This seems still strange to me as 2to3 was present in Tools/Script out of 
> the box)

It's not clear what you did here. setup.py should run 2to3 for you.
What command did you use to successfully? install it?

> I use pydev in Eclipse and pydev reports several error in png.py anytime I 
> want to import or use it. When trying to import from IDLE I get:
>
> except ValueError, e:
>  ^
> Syntax error, line 1863
 It's clear that the install process didn't run 2to3.

> that paricular error I was able to fix by changing it to "except ValueError 
> as e:" but I don't understand why 2to3 didn't do it automatically.
 2to3 does do it automatically.
> There are several more errors reported by pydev, here are a few:
>
> line 1368 : "raise ValueError('Chunk %s too short for checksum.', tag)"
> Undefined variable: tag

Looking at the code, this appears to be a bug.
>
> line 2736 : "rows = [map(numpy.uint16, range(0,0x1,0x))]"
> Undefined variable from import: uint16
>
> The second one made me suspect I needed to install numpy too. As there are no 
> installers for numpy aimed toward Python3.3.
 A few lines above there's a try/except for importing numpy. It should
skip this test if numpy is not available. I'm not sure how you were
able to execute that line [unless you've got a stray numpy.py  file
somewhere somewhere]

> I decided to install Python2.7 and retry the whole process. Unfortunately I 
> didn't get much more success. I get the exact same errors in pydev when using 
> the 2.7 version of the interpreter and I cannot install numpy either because 
> when I run the .exe file aimed toward Python 2.7 i get the error message:
>
> "Python version 2.7 required, which was not found in the registry"
>
> I then have the option to manually enter the path to Python 2.7 but the 
> textform is greyed out and I can't type in anything.
>

Do you have the file c:\Python33\Lib\site-packages\pypng-0.0.13-py3.3.egg  ?
If not, you have not successfully installed pypng. Please try one of
the methods I gave above.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: SSH Connection with Python

2012-10-29 Thread David Robinow
On Sun, Oct 28, 2012 at 4:09 PM, Gelonida N  wrote:
> The only thing I'm concerned about paramiko is, that I don't see any
> activity on the paramiko site and that one library it depends on is not
> available is windows binary package for newer versions of python.
>
 I don't understand why this is a problem.
\python27\python setup.py install #for pycrypto & paramiko
\python27\python test.py   # for paramiko

Works for me.  Of course, you need  Visual C++ 2008, but the free
express edition is sufficient, and you should have that anyway if
you're doing Windows development. If that's too hard for you, try
http://www.serenethinking.com/bitlift/download.html
[not my site, no guarantees]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Plz Suggest... How can i install the pure python package py-bidi in WIndows.

2012-12-22 Thread David Robinow
On Sat, Dec 22, 2012 at 9:10 AM, Arsalan Khan  wrote:
> I tried installing but it gives error..
> Can anyone guide the procedure of configuring/Installing a python package in 
> windows ???
 What did you do to try to install?
 What error(s) did you get?
 Where can I find this package if I want to help you?
 What version of Windows are you using. Sometimes it matters.
 Does the package support Windows at all? Some packages don't.
 What version of Python are you running? A number of packages don't
yet support Python3
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: errors building python 2.7.3

2012-03-28 Thread David Robinow
On Wed, Mar 28, 2012 at 7:50 AM, Alexey Luchko  wrote:
> I've tried to build Python 2.7.3rc2 on cygwin and got the following errors:
>
> $ CFLAGS=-I/usr/include/ncursesw/ CPPFLAGS=-I/usr/include/ncursesw/
> ./configure
 I haven't tried 2.7.3 yet, so I'll describe my experience with 2.7.2
 I use /usr/include/ncurses   rather than /usr/include/ncursesw
 I don't remember what the difference is but ncurses seems to work.

> $ make
> ...
> gcc -shared -Wl,--enable-auto-image-base
> build/temp.cygwin-1.7.11-i686-2.7/Python-2.7.3rc2/Modules/_io/bufferedio.o
> build/temp.cygwin-1.7.11-i686-2.7/Python-2.7.3rc2/Modules/_io/bytesio.o
> build/temp.cygwin-1.7.11-i686-2.7/Python-2.7.3rc2/Modules/_io/fileio.o
> build/temp.cygwin-1.7.11-i686-2.7/Python-2.7.3rc2/Modules/_io/iobase.o
> build/temp.cygwin-1.7.11-i686-2.7/Python-2.7.3rc2/Modules/_io/_iomodule.o
> build/temp.cygwin-1.7.11-i686-2.7/Python-2.7.3rc2/Modules/_io/stringio.o
> build/temp.cygwin-1.7.11-i686-2.7/Python-2.7.3rc2/Modules/_io/textio.o
> -L/usr/local/lib -L. -lpython2.7 -o build/lib.cygwin-1.7.11-i686-2.7/_io.dll
> build/temp.cygwin-1.7.11-i686-2.7/Python-2.7.3rc2/Modules/_io/bufferedio.o:
> In function `_set_BlockingIOError':
> /Python-2.7.3rc2/Modules/_io/bufferedio.c:579: undefined reference to
> `__imp__PyExc_BlockingIOError'

In Modules/_io/_iomodule.h, use:
PyObject *PyExc_BlockingIOError;
instead of:
PyAPI_DATA(PyObject *) PyExc_BlockingIOError;

> Failed to build these modules:
> _curses            _io
>

But please note that Cygwin does not support Python-2.7. There may be
other reasons.
I don't really use cygwin Python for anything important. It's just
nice to have around since I spend a lot of time in the bash shell.
It would probably be helpful to ask on the Cygwin mailing list
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: errors building python 2.7.3

2012-03-29 Thread David Robinow
On Thu, Mar 29, 2012 at 6:55 AM, Alexey Luchko  wrote:
> On 28.03.2012 18:42, David Robinow wrote:
>> On Wed, Mar 28, 2012 at 7:50 AM, Alexey Luchko  wrote:
>>> I've tried to build Python 2.7.3rc2 on cygwin and got the following
>>> errors:
>>>
>>> $ CFLAGS=-I/usr/include/ncursesw/ CPPFLAGS=-I/usr/include/ncursesw/
>>> ./configure
>>   I haven't tried 2.7.3 yet, so I'll describe my experience with 2.7.2
>>   I use /usr/include/ncurses   rather than /usr/include/ncursesw
>>   I don't remember what the difference is but ncurses seems to work.
>
> I've tried ncurses too.  It does not matter.
 Have you included the patch to Include/py_curses.h  ?
If you don't know what that is, download the cygwin src package for
Python-2.6 and look at the patches. Not all of them are still
necessary for 2.7 but some are.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-31 Thread David Robinow
On Sat, Mar 31, 2012 at 4:13 PM, Tim Rowe  wrote:

> I know 10 languages. But I'm not telling you what base that number is :)
 The fact that you know there are bases other than 10 puts you in the
top half of the candidates already!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: f python?

2012-04-08 Thread David Robinow
On Sun, Apr 8, 2012 at 6:55 PM, Dennis Lee Bieber  wrote:
>        The main reason, as I recall, for the command line using \ for file
> paths is that it inherited / as command OPTION prefix from CP/M; MS-DOS
> being a 32-bit work-alike for CP/M in the first generation.
 I also thought it was because Bill Gates used a PDP-11 in high school
and DEC used the / as command OPTION
I found out later that Gates purchased DOS rather than wrote it, so
this story may be erroneous. Nevertheless, at the time, DEC was way
bigger than AT&T (in computers) and the choice really wasn't
surprising.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Gotcha's?

2012-04-15 Thread David Robinow
On Sun, Apr 15, 2012 at 4:01 PM, Bryan
 wrote:
> On Windows the file extension determines what executable opens the
> file. Running both Python 2 and Python 3 on Windows is painful where
> it doesn't need to be. I'd like to encourage my users to check out
> Python 3, but installing it on Windows will take over the '.py'
> extension and break stuff that currently works.

Hire a qualified Windows specialist.
Tell him to type:
   FTYPE Python.File="C:\Python27\python.exe" :%1: %*
Pay him $200.00
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: usenet reading

2012-05-26 Thread David Robinow
On Sat, May 26, 2012 at 11:43 AM, Roy Smith  wrote:
> I use panix.com.  For $100/year, I get mail, news, and unix shell
> access.  By some measures, it's an expensive way to get mail access, but
> I'd much rather give Panix $100 than take advantage of any of the free
> mail services who does who-knows-what with my mail.  Not to mention that
> I get access to such private newsgroups as panix.nytel.abuse.
 I'm happy enough with several of the free services and haven't used
news in over a decade, but if it works for you, great. I'm curious,
though, what makes you think that panix.com protects your privacy more
than yahoo, google, or AOL?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Compiling Python 3.2 on Cygwin fails

2011-07-05 Thread David Robinow
On Mon, Jul 4, 2011 at 3:49 PM, Aly Tawfik  wrote:
> On Jun 20, 12:44 pm, sewpafly  wrote:
>> I was able to a little further by changing 2 lines in Makefile.pre.in.
>>
>> On line 170, changed:
>>     DLLLIBRARY= @DLLLIBRARY@
>> to:
>>     DLLLIBRARY= libpython$(VERSION).dll
>>
>> On line 509 it had:
>>     $(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
>>
>> which I changed to:
>>     $(DLLLIBRARY) libpython$(LDVERSION).dll.a: $(LIBRARY_OBJS)
>>
>> Compile finishes with:
>> Python build finished, but the necessary bits to build these modules
>> were not found:
>> _gdbm              _sqlite3           _tkinter
>> nis                ossaudiodev        spwd
>> To find the necessary bits, look in setup.py in detect_modules() for
>> the module's name.
>>
>> Failed to build these modules:
>> _curses            _curses_panel
>>
>> But 'make test' returns many errors.
>>
>> I'm thinking I'll try Python 3.1 instead.
>
> I, too, am facing the same problem. Which version of Python 3.1 did
> you install, and did it work? Thanks!
> --
> http://mail.python.org/mailman/listinfo/python-list
>

 Cygwin is not really a supported platform. Reverting to Python 3.1
won't help at all. Download the 2.6.5 source version (i.e., click the
Src box) using cygwin setup. Apply the included patches [some don't
apply cleanly any more]. That will get you most of the way there.
There are a few other issues the details of which I don't remember.
 I'm not sure why there hasn't been a cygwin distribution lately. You
might ask on the cygwin mailing list. [Ultimately somebody with an
interest in cygwin will need to get active in python development. I've
been meaning to do this but life gets in the way.]
  DR
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to separate a list into two lists?

2011-08-06 Thread David Robinow
On Sat, Aug 6, 2011 at 1:23 PM, Kabie  wrote:
> No.
> L1, L2 = zip(*L)

Not quite. That makes L1 & L2 tuples.

L1, L2 = zip(*L)
L1 = list(L1)
L2 = list(L2)
???
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: TypeError: 'module' object is not callable

2011-08-11 Thread David Robinow
On Thu, Aug 11, 2011 at 6:43 PM, Forafo San  wrote:
> I wrote a class, Univariate, that resides in a directory that is in my 
> PYTHONPATH. I'm able to >import that class into a *.py file. However when I 
> try to instantiate an object with that class like:

  What makes you think you're able to import that class?

> x = Univariate(a)             # a is a list that is expected by the 
> Univariate class
>
> python raises the TypeError: 'module' object is not callable.  If I embed the 
> code of the Univariate >class in my *.py file, there is no problem.  Also, 
> when the class is imported and I do a
>
> print dir(Univariate)
>
> it does not print all the methods that are in the class, while if the class 
> code appears in my *.py >file, all the methods are available and a list with 
> the correct methods are printed.

It appears that you are importing the "module" Univariate from the
file Univariate.py
If you want to instantiate the "class" Univariate contained in the
"module" Univariate, try

 x = Univariate.Univariate(a)

In the future, please try to include more of your code.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to convert a list of strings into a list of variables

2011-08-18 Thread David Robinow
On Thu, Aug 18, 2011 at 10:57 AM, noydb  wrote:
> How would you convert a list of strings into a list of variables using
> the same name of the strings?
>
> So, ["red", "one", "maple"] into [red, one, maple]
  Why would you want to?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Stop quoting spam [was Re: Hot Girls ...]

2011-08-20 Thread David Robinow
On Sat, Aug 20, 2011 at 4:16 AM, Alec Taylor  wrote:
>> ...
> I found said joke rather funny :P
 Perhaps, as a retired amateur comedian, my standards are too high,
but I don't think adding a smilie to a stupid post suddenly turns it
into a joke. Nevertheless, the quality of the attempt is not really
the issue here. The would-be humorist did not need to quote the spam.
Please, don't do it.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: setuptools for 64-bit 2.7.1 on 64-bit Windows 7?

2011-05-06 Thread David Robinow
On Fri, May 6, 2011 at 1:43 PM, Dick Bridges  wrote:
> Simple question: Is it true that no setuptools (or any other module
> installer) exists for 64-bit python 2.7.1? If there is an installer that
> works, what terms might I use to Google for information on how to acquire
> and install it?
Doesn't the installer at
http://www.lfd.uci.edu/~gohlke/pythonlibs/
work?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: checking if a list is empty

2011-05-14 Thread David Robinow
On Fri, May 13, 2011 at 10:34 PM, Gregory Ewing
 wrote:
> rusi wrote:
>
>> Dijkstra's problem (paraphrased) is that python, by choosing the
>> FORTRAN alternative of having a non-first-class boolean type, hinders
>> scientific/mathematical thinking/progress.
>
> Python doesn't have the flaw that Dijkstra was talking about.
> Fortran's flaw wasn't so much the lack of a boolean type, but
> that you couldn't assign the result of a logical expression to
> a variable. Python has always been able to do that, even before
> it had a distinct boolean type.
And Fortran could do it at least 25 years before Python was invented.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Trying to understand html.parser.HTMLParser

2011-05-15 Thread David Robinow
On Sun, May 15, 2011 at 4:45 PM, Andrew Berg  wrote:
> I'm trying to understand why HMTLParser.feed() isn't returning the whole
> page. My test script is this:
>
> import urllib.request
> import html.parser
> class MyHTMLParser(html.parser.HTMLParser):
>    def handle_starttag(self, tag, attrs):
>        if tag == 'a' and attrs:
>            print(tag,'-',attrs)
>
> url = 'http://x264.nl/x264/?dir=./64bit/8bit_depth'
> page = urllib.request.urlopen(url).read()
> parser = MyHTMLParser()
> parser.feed(str(page))
>
> I can do print(page) and get the entire HTML source, but
> parser.feed(str(page)) only spits out the information for the top links
> and none of the "revision" links. Ultimately, I just want to find
> the name of the first "revision" link (right now it's
> "revision1995", when a new build is uploaded it will be "revision2000"
> or whatever). I figure this is a relatively simple page; once I
> understand all of this, I can move on to more complicated pages.
You've got bad HTML. Look closely and you'll see the there's no space
between the "revision" strings and the style tag following.
The parser doesn't like this. I don't know a solution other than
fixing the html.
(I created a local copy, edited it and it worked.)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there a better way to solve this?

2011-05-23 Thread David Robinow
On Mon, May 23, 2011 at 2:55 PM, kracekumar ramaraju
 wrote:
> You can use sizeof function,
 a=12234
 b=23456.8
 a.__sizeof__()
> 12
 b.__sizeof__()
> 16
> So sizeof int is 12 bytes and float is 16 bytes

I'm not sure what you're trying to show here, but try the following in
Python 3.2

>>> a = 
>>> for i in range(5):
...  a*= 10
...  a.__sizeof__()
...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Automation

2013-11-18 Thread David Robinow
On Mon, Nov 18, 2013 at 11:49 AM, Grant Edwards  wrote:
> ...
> I don't make those mistakes typing on a phone (where I have to
> actually think about the act of typing), but I do make them with a
> regular keyboard, where I don't have to think about mechanics of
> typing the words.
>
> OTOH, maybe that's just me...
It's me too. I certainly know the difference between 'there' and
'their', etc. but that fact is not always reflected in my typing.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Problem when applying Patch from issue1424152 to get https over authenticating proxies working with urllib2 in Python 2.5

2013-12-10 Thread David Robinow
On Tue, Dec 10, 2013 at 11:59 AM,   wrote:
> On 12/10/2013 09:22 AM, Mark Lawrence wrote:
...
> Mark is one of the resident trolls here.  Among his other traits
> is his delusion that he is Lord High Commander of this list.
> Like with other trolls, the best advice is to ignore him (which
> I'm not doing this once as a public service).
Please don't do this. I can decide for myself whether I prefer to read
Mark's posts.
[By the way, I don't consider Mark Lawrence a troll. He's just a guy
who can't help himself. I've chosen not to listen any more but others
are entitled to their own choices.]+
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Wrapping around a list in Python.

2013-12-16 Thread David Robinow
On Mon, Dec 16, 2013 at 12:26 AM,   wrote:
> The idea is to grab the last 4 elements of the array. However i have an array 
> that contains a few hundred elements in it. And the values continues to 
> .append over time. How would i be able to display the last 4 elements of the 
> array under such a condition?

I assume you mean 'list' rather than 'array'.
If all you want to do is 'display' the last 4 elements:

big_list = [0,1,2,3,4,5,6,7,8,9]
last4 =  big_list[-4:]
print(last4)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Installing Python from sources with all the modules

2013-12-16 Thread David Robinow
On Mon, Dec 16, 2013 at 8:55 PM, shankha  wrote:
> Hi,
> I am trying to install Python 3.3 from the latest sources on linux.
>
> After the installation when I try to run the following I get a error:
>
> ./python
> Python 3.3.3 (default, Dec 16 2013, 18:28:25)
> [GCC 4.8.2 20131017 (Red Hat 4.8.2-1)] on linux
> Type "help", "copyright", "credits" or "license" for more information.
 import ssl
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/home/shankha/Python-git/Python3-3/Python-3.3.3/Lib/ssl.py", line
> 60, in 
> import _ssl # if we can't import it, let the error propagate
> ImportError: No module named '_ssl'
>
>
> Is there a way while installing from sources I enable all modules to be
> installed.


You need to install the openssl development package. I don't know how
you do that on Red Hat.  Don't use it myself.
 There will probably be other missing modules for which you will have
to install prerequisites for. Once you do that they should build
automatically when you rebuild.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bytes indexing returns an int

2014-01-07 Thread David Robinow
"treating bytes as chars" considered harmful?
 I don't know the answer to your question but the behavior seems right to me.
Python 3 grudgingly allows the "abomination" of byte strings (is that
what they're called? I haven't fully embraced Python3 yet). If you
want a substring you use a slice.
   b = b'xyz'
   b[1:2] => b'y'

also, chr(121) => 'y'   which is really what the Python 3 gods prefer.

On Tue, Jan 7, 2014 at 6:13 AM, Steven D'Aprano
 wrote:
> Does anyone know what the rationale behind making byte-string indexing
> return an int rather than a byte-string of length one?
>
> That is, given b = b'xyz', b[1] returns 121 rather than b'y'.
>
> This is especially surprising when one considers that it's easy to extract
> the ordinal value of a byte:
>
> ord(b'y') => 121
>
>
>
> --
> Steven
>
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bytes indexing returns an int

2014-01-07 Thread David Robinow
Sorry for top-posting. I thought I'd mastered gmail.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Editor for Python

2014-01-08 Thread David Robinow

On Jan 8, 2014, at 10:53 AM, Jean-Michel Pichavant  
wrote:

>>> -- IMPORTANT NOTICE:
>>> 
>> 
>> too late you have sent this to a public forum
> 
> No pb with that, the python list is the intended recipient :)
> 
> I tried to negotiate this with my IT guys, but it looks like it's now 
> mandatory, something related to being in the USA stock market.
Yeah, when in doubt blame the Americans.
> I have no way to remove it, it's added by the email server. I apologise for 
> the noise.
Maybe you should try Google Groups.

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


Re: Editor for Python

2014-01-09 Thread David Robinow
On Thu, Jan 9, 2014 at 10:50 AM, Jean-Michel Pichavant
 wrote:
> - Original Message -
>>
>> On Jan 8, 2014, at 10:53 AM, Jean-Michel Pichavant
>>  wrote:
>> > I tried to negotiate this with my IT guys, but it looks like it's
>> > now mandatory, something related to being in the USA stock market.
>> Yeah, when in doubt blame the Americans.
>
> Sorry if I hurt your feelings, have a look at 
> http://www.sarbanes-oxley-101.com/
You didn't. I was just having fun.  However, I couldn't find anything
at that site which referred to email disclaimers.
It seems to me that this sort of thing has gone out of style. It was
more common ten years ago.  However, I won't waste any more time
arguing the point.
>
> I don't blame anyone, would I be blaming the law, that wouldn't imply the 
> americans anyway.
>
> cheers,
> JM
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [RELEASED] Python 3.4.0 release candidate 1

2014-02-11 Thread David Robinow
On Tue, Feb 11, 2014 at 5:45 AM, Terry Reedy  wrote:
> On 2/11/2014 5:13 AM, Terry Reedy wrote:
>> ...
>> I installed 64 bit 3.3.4 yesterday with no problem. I reran it today in
>> repair mode and again, no problem.
>>
>> With 64 bit 3.4.0, I get
>> "There is a problem with this Windows Installer package. A program
>> required for the install to complete could not be run."
>>
>> No, the generic message does not bother to say *which* program :-(.
>>
>> 34 bit 3.4.0 installed fine.
>
>
> I wrote too soon.
>
> Python 3.4.0rc1 (v3.4.0rc1:5e088cea8660, Feb 11 2014, 05:54:25) [MSC
 import tkinter
> Traceback ...
> import _tkinter
> ImportError: DLL load failed: %1 is not a valid Win32 application.
>
> So tkinter, Idle, turtle fail and the corresponding tests get skipped.
32 bit and 64 bit both work for me.  Windows 7.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Newcomer Help

2014-02-14 Thread David Robinow
On Thu, Feb 13, 2014 at 11:32 AM, Larry Martell  wrote:

> 18) If you're on AOL, don't worry about anything I've said here.
> You're already a fucking laughing stock, and there's no hope for you.
 Ah, the email bigots. That's why I keep an AOL address around for
occasional use against these jerks.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: IDLE won't run after installing Python 3.3 in Windows

2014-02-19 Thread David Robinow
On Tue, Feb 18, 2014 at 9:56 AM,   wrote:
> The next adventure in Python was to install Python 3 into a Windows XP 
> machine. I had a previous 2.7 installation that I uninstalled and carefully 
> removed all traces of from the directory and the registry.

It is not necessary to uninstall previous  versions of Python. They
can live happily together. Not only does it work, it's a supported
configuration. That's what the launcher is for.
Mucking with the registry is generally inadvisable. It's too easy to
make a mistake.
If you do decide to uninstall a Python version, do it through the
Control Panel. If that results in problems, submit a bug report.

> I got the 'python-3.3.3.msi' from Python.org and installed it. From a command 
> window I can run 'python' and I get the Python prompt. I have several Python 
> programs on the machine. If I right click o one, I have the option of 'Edit 
> in IDLE'. If I do that, the disk light blinks briefly, and then nothing. So I 
> went into the \python33\lib\idlelib directory and from a CMD window, ran 
> 'python idle.py'. That loads IDLE. but when I ask IDLE to load a file, it 
> navigates to a FileOpen dialog and then closes everything when I actually 
> open the file. I then tried the same thing but used 'pythonw' instead. Same 
> deal.
>
> I also saw some other threads here about how Python can get befuddled by 
> firewalls, so I disabled that with no effect.
>
> Any suggestions?  Thanks in advance!
 I would reinstall Python2.7 and then reinstall Python3.3. That may
straighten out your registry. (It may not)
Let us know if that works.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: LibreOffice

2013-08-03 Thread David Robinow
On Fri, Aug 2, 2013 at 9:26 PM, Terry Reedy  wrote:
> ...
> Of relevance to this list, Libre Office upgraded the included Python
> interpreter to 3.3. I have no idea whether OO is still using 2.3 or also
> updated.
 They're up to 2.7 now.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Error Testing

2013-10-19 Thread David Robinow
On Sat, Oct 19, 2013 at 9:01 AM, Chris Angelico  wrote:

> You can try all these out in the interactive interpreter (you probably
> have IDLE installed, which on Windows is rather nicer to work with
> than the default interactive mode).
 IDLE is cross-platform.  Could you explain why you say "on Windows"?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What's wrong with Windows Command Prompt (was Re: Error Testing)

2013-10-21 Thread David Robinow
On Sat, Oct 19, 2013 at 4:35 PM, Terry Reedy  wrote:
> On 10/19/2013 2:31 PM, Tim Chase wrote:
>>
>> On 2013-10-19 14:08, David Robinow wrote:
>>>
>>> On Sat, Oct 19, 2013 at 9:01 AM, Chris Angelico wrote:
>>>>
>>>> You can try all these out in the interactive interpreter (you
>>>> probably have IDLE installed, which on Windows is rather nicer to
>>>> work with than the default interactive mode).
>>>
>>>
>>>   IDLE is cross-platform.  Could you explain why you say "on
>>> Windows"?
>> ...
>  [Description of idle  vs. Command Prompt]
 Not quite what I was trying to ask.
I'm well aware that Idle has features that the Python interpreter on
Windows doesn't.
Idle also has features that the unix variants doesn't.
I don't use my Ubuntu much so I'm somewhat ignorant, but I wasn't
aware that the interactive interpreter on Linux had features that the
Windows version didn't. I'm curious what those features might be.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: install packages with pip to older Python versions

2011-09-27 Thread David Robinow
On Mon, Sep 26, 2011 at 4:39 PM, Jabba Laci  wrote:
> Hi,
>
> I have Python 2.7 on my system. Today I wanted to try Google App
> Engine but it runs on Python 2.5 at Google so I installed this version
> on my machine next to v2.7 to avoid compatibility problems. However,
> when I start the Python shell v2.5 and try to import something from
> the GAE SDK (for instance "from google.appengine.ext import webapp"),
> I get an error: "ImportError: No module named webob". (Note that with
> v2.7 I don't have this problem.)
>
> So, how can I install packages for a specific version of Python (here,
> v2.5)? With 2.7 I use "sudo pip install ".
sudo pip-2.5 install 

(You may need to install pip in your 2.5)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to run in xp?

2011-09-28 Thread David Robinow
On Wed, Sep 28, 2011 at 9:29 AM, Peter Otten <__pete...@web.de> wrote:
> =?gbk?B?ytjW6rT9zcM=?= wrote:
>
>> it can run ,but there is still a problem ,nothing in my file.
>> please run the code in xp+python32
>> import urllib.request, urllib.parse, urllib.error
>> exchange=['NASDAQ','NYSE','AMEX']
>> for down in exchange:
>>     url='http://www.nasdaq.com/screening/companies-by-
> industry.aspx?exchange='+down+'&render=download'
>>     file=urllib.request.urlopen(url).read()
>>     print (file)
>> what you get is:
>>
>
>> b''
>> b''
>> b''
>
>>
>> how to fix it?
>
> I get the expected output, but I'm on Linux. Are you using the latest bugfix
> release (Python 3.2.2)? Can you download the data with your browser?
I get the expected output, but I'm on Windows (Vista, Python 3.2.2.)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [NUMPY] "ValueError: total size of new array must be unchanged" just on Windows

2011-10-11 Thread David Robinow
2011/10/11 Paolo Zaffino :
> Nobody can help me?
 Nope, not unless you post some code. Your problem description is too vague.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: leftover pyc files

2011-11-03 Thread David Robinow
On Thu, Nov 3, 2011 at 1:54 PM, Andrea Crotti  wrote:
> All these ideas (shell and git hooks) are nice, but unfortunately
> - it's svn not git
> - it's windows not *nix
> - we have to remove only the ones without the corresponding *py...
> --
> http://mail.python.org/mailman/listinfo/python-list
>
Barely tested. Change the print functions to removes. Pass the top
directory as the argument.

import os, sys
for dirpath, dirnames, filenames in os.walk(sys.argv[1]):
if dirpath.endswith("__pycache__"):
thispath = dirpath[:-11]
for f in filenames:
if f.endswith(".pyc"):
if not os.path.exists(os.path.join(thispath,f[:-1])):
print("delete " + os.path.join(thispath,f))

else:
for f in filenames:
if f.endswith(".pyc"):
if not os.path.exists(os.path.join(dirpath,f[:-1])):
print("delete " + os.path.join(dirpath,f))
#os.remove(os.path.join(dirpath,f))
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: guppy

2011-11-09 Thread David Robinow
On Wed, Nov 9, 2011 at 2:38 PM, Juan Declet-Barreto
 wrote:
> I am using Cygwin build of Python2.6.  This Cygwin install has both a Cygwin 
> gcc (versions 3.4.4 and 4.5.3) and mingw32 (3.4.4), as listed in lib/gcc/.
>
> I also tried the mingw32 shell separately, but I get the same results even 
> when I pass the "-c mingw32" option.
>
> The error is reproduced below:
> ...
 It works for me.  guppy 0.1.9
gcc  4.5.3
Python 2.6.5
cygwin 1.7.9
[I have no idea if it works as intended. I don't use guppy.]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python shell that saves history of typed in commands that will persist between reboots

2011-11-16 Thread David Robinow
On Wed, Nov 16, 2011 at 4:09 PM, Ben Finney  wrote:
> goldtech  writes:
>
>> Using Windows. Is there a python shell that has a history of typed in
>> commands?
>
> I don't know about MS Windows, but the Python interactive shell can be
> linked with the GNU Readline library for managing its command line
> http://docs.python.org/library/readline.html> including editing
> features, tab completion, history management, and a persistent history
> file.
>
> You can then use that functionality in your Python interactive startup
> file. Here's mine:
>
> =
> # $HOME/.pythonrc
> # User configuration for interactive Python shell.
>
> import sys
> import os
> import os.path
> import atexit
>
> # Tab completion with readline.
> # Cribbed from http://docs.python.org/lib/module-rlcompleter.html>.
> try:
>    import readline
> except ImportError:
>    sys.stderr.write("Module readline not available.\n")
> else:
>    import rlcompleter
>
>    # Enable tab completion.
>    readline.parse_and_bind("tab: complete")
>
>    # Persistent command history.
>    histfile = os.path.join(os.environ["HOME"], ".python_history")
>    try:
>        readline.read_history_file(histfile)
>    except IOError:
>        # Existing history file can't be read.
>        pass
>    atexit.register(readline.write_history_file, histfile)
>
>    del histfile
>
> del sys, os, atexit
>
> =
>
> Reading the documentation, I see that the ‘readline’ library is only
> linked with Python on Unix-alike operating systems. Yet another reason
> why MS Windows is not a good choice for developing software I guess.

 I'm not sure what documentation you're reading, but your code works fine on
 Windows.   Thanks.  [It is necessary to properly set PYTHONSTARTUP]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python shell that saves history of typed in commands that will persist between reboots

2011-11-16 Thread David Robinow
On Wed, Nov 16, 2011 at 6:59 PM, Ben Finney  wrote:
> David Robinow  writes:
>
>> On Wed, Nov 16, 2011 at 4:09 PM, Ben Finney  
>> wrote:
>> > I don't know about MS Windows, but the Python interactive shell can be
>> > linked with the GNU Readline library for managing its command line
>> > http://docs.python.org/library/readline.html>
> […]
>
>> > Reading the documentation, I see that the ‘readline’ library is only
>> > linked with Python on Unix-alike operating systems.
>
>>  I'm not sure what documentation you're reading
>
> The same documentation I linked to above. Immediately below the title,
> it specifies a limited set of platforms: “Platforms: Unix” limiting the
> availability of the described module.
>
>> but your code works fine on Windows. Thanks.
>
> I'm glad to know that. Perhaps you could investigate why, and suggest an
> update to the above documentation if it's wrong? The bug tracker at
> http://bugs.python.org/> would be the appropriate place for such a
> suggestion.

Upon further investigation, it turns out that I'm using pyreadline
from http://pypi.python.org/pypi/pyreadline. I'd forgotten I'd
installed it. No documentation fixes appear to be necessary.

"The pyreadline package is a python implementation of GNU readline
functionality it is based on the ctypes based UNC readline package by
Gary Bishop. It is not complete. It has been tested for use with
windows 2000 and windows xp."
  It appears to work in Vista also, at least for the purposes
discussed in this thread.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]

2011-12-16 Thread David Robinow
On Fri, Dec 16, 2011 at 7:54 PM, Steven D'Aprano
 wrote:
> On Fri, 16 Dec 2011 11:40:11 -0800, Eelco wrote:
>
>> On 16 dec, 18:38, rusi  wrote:
>>> On Dec 16, 3:25 pm, Eelco  wrote:
>>>
>>> > Pseudo-backwards compatibility with other languages, I couldnt not
>>> > care less for.
>>>
>>> Double negations n Goedelian situations have interesting implications
>>> (tho here its triple)
>>
>> Heh. Well at least my extra (unintended) negation is semantically
>> consistent with the actual english usage of the phrase, which omits the
>> negation completely :). (I could care less)
>
> Oh please. "I could care less" is not English. That's American.
>
> Here in Australia, we follow the English practice of saying that we
> couldn't care less.
Well the phrase is still somewhat controversial in the US. I never
heard it until age 19 (in 1966) and have always been somewhat
disdainful of those using it. But it appears to be hopeless.
 http://articles.boston.com/2010-10-24/lifestyle/29303907_1_care-peeves-decades
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MOST COMMON QUESTIONS ASKED BY NON-MUSLIMS ?????????

2012-01-03 Thread David Robinow
On Tue, Jan 3, 2012 at 2:24 PM, Benjamin Kaplan
 wrote:
> On Tue, Jan 3, 2012 at 1:49 PM, D'Arcy Cain  wrote:
>> On 12-01-03 01:24 PM, gene heskett wrote:
>>>
>>> The solution is to chop the link between google.groups and this list.  But
>>> that subject has been declared verboten. Too much inconvenience to ask the
>>> googlers to subscribe to the real list I guess.  Because my spamassassin
>>
>> Perhaps they just need to be reminded from time to time that many of us have
>> already "chopped the link" and for us there is no Google Groups on this
>> list.  I never even saw the original message because everything from GG goes
>> straight to /dev/null on my system.
>>
>> Now if only I could automatically kill the replies to GG messages.  :-)
>>
>> P.S. if you use Spamassassin:
>>
>> :0 Hir
>> * ^List-Id:.*python-list.python.org
>> * ^From:.*@gmail.com
>> * ^Newsgroups:.*
>> /dev/null
>>
> Wouldn't that just kill everything sent from a gmail account? That's
> not the same thing as Google Groups. The mailing list posts, at least,
> have an "Organization: http://groups.google.com"; header. You'd
> probably be better off filtering on that.
 Interesting. I read the list using gmail, and I never saw the
original post. IIn fact I rarely see any spam at all. Apparently,
somebody at google knows how to identify spam. I wonder why they can't
do it for google groups.
 [I also wonder if anybody will see this post, coming from an evil source.]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Nested Function Question

2012-01-07 Thread David Robinow
On Fri, Jan 6, 2012 at 5:04 PM, Ian Kelly  wrote:
> On Fri, Jan 6, 2012 at 2:46 PM, GZ  wrote:
>> Hi,
>>
>> I am reading the documentation of functools.partial (http://
>> docs.python.org/library/functools.html#functools.partial) and found
>> the following 'reference implementation' of functools.partial.
>>
>> def partial(func, *args, **keywords):
>>    def newfunc(*fargs, **fkeywords):
>>        newkeywords = keywords.copy()
>>        newkeywords.update(fkeywords)
>>        return func(*(args + fargs), **newkeywords)
>>    newfunc.func = func
>>    newfunc.args = args
>>    newfunc.keywords = keywords
>>    return newfunc
>>
>> I don't understand why the below 3 lines are needed:
>>
>>    newfunc.func = func
>>    newfunc.args = args
>>    newfunc.keywords = keywords
>>
>>
>> It is as if they are trying to prevent garbage collection, but I don't
>> get why it is needed. As long as something holds reference to newfunc,
>> because it in turn references keywords and args, nothing will be
>> freed. If nothing is referencing newfunc, then everything should be
>> freed.
>
> They exist for introspection.  The partial object has to store the
> function and arguments it was passed so that it can call it later, so
> as long as they're being stored anyway, why not make them visible?
I tend toward the minimalist end of the spectrum when it comes to code
commenting, but it seems to me this would be a good place for a few
words of explanation.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Statistics...help with numpy/scipy install

2013-02-10 Thread David Robinow
On Sun, Feb 10, 2013 at 1:14 PM, Michael Torrie  wrote:
> On 02/10/2013 10:35 AM, Rex Macey wrote:
> A casual google search seems to indicate that for now, SciPy and NumPy
> are for Python 2.x (2.7 is the latest).  I could be wrong though and
> often am.  I know a number of popular and useful packages are not yet
> available on Python 3.
My casual google search finds www.numpy.org as the first entry.
Clicking on the download link, one can find numpy 1.7.0 for Python 3.3
In all fairness, this was just released a few hours and is the first
official version supporting 3.3
However, numpy 1.6.2 did support 3.2
There's not yet a Scipy release supporting 3.3 so the OP may wish to
downgrade to Python3.2
>
> If you need to do a lot math stuff, there's a complete python system
> that bundles a lot of these tools together into a nice package.  It's
> called Sage.  http://www.sagemath.org/
Sage doesn't run natively on Windows. Not necessarily a problem but
should be mentioned.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Statistics...help with numpy/scipy install

2013-02-10 Thread David Robinow
On Sun, Feb 10, 2013 at 5:14 PM, Rex Macey  wrote:
> I should have added that the setup gives an error window "Cannot install" 
> "Python version 3.3 required, which was not found in the registry."

I'm guessing that you installed a 64-bit python and are using a 32-bit numpy.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Howto parse a string using a char in python

2013-02-15 Thread David Robinow
On Fri, Feb 15, 2013 at 6:04 PM, Steve Goodwin  wrote:
> Hi,
>
> I am looking for the python2.7 function(s) to parse a string from a colon
> character ":"
>
> Sounds simple enough.
>
> For example, a string like "123456:789".  I just need the "123456"
> substring.(left of the :)
"123456:789".split(":")[0]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python on windows

2013-02-16 Thread David Robinow
On Sat, Feb 16, 2013 at 4:40 PM, babatunde akerele  wrote:
> hello, i'm having problem coding and running python on my pc...i just
> started learning python last month in codeacademy.com but i've not
> been able to code offline 'cos i don't knw how to go abt installing
> the compiler and all that. Any help please?
Download the Python 3.3 installer from http://www.python.org/download/
and run it.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Shebang line on Windows?

2013-02-25 Thread David Robinow
On Mon, Feb 25, 2013 at 12:29 PM, D'Arcy J.M. Cain  wrote:
> ...
> I don't run Windows myself so I can't test it but doesn't Python on
> Windows work fine with Unix style EOL?  So why not strip out the CR and
> run the same file everywhere?
 That's the ideal solution, but so many Windows tools default to text
mode that it's easy to create the wrong type file, especially for
beginners who are moving there code to Linux for the first time.  I've
done it myself, even though I should no better by now.
 In addition, the error message is rather obscure (if I remember right
- I'm not near my Ubuntu at the moment and Cygwin handles this fine,
as it should)
 I'm afraid this problem won't go away. People are just going to have
to learn from experience.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] string.format() default variable assignment

2013-03-02 Thread David Robinow
On Sat, Mar 2, 2013 at 7:27 PM, Steven D'Aprano
 wrote:
> On Sat, 02 Mar 2013 09:53:47 -0500, Devin Jeanpierre wrote:
>
>> On Sat, Mar 2, 2013 at 1:54 AM, Chris Angelico  wrote:
>>> Yes, but reply-all sends a copy to the poster as well as the list. What
>>> I want is reply-list, acknowledging the list headers... and Gmail
>>> simply doesn't have that.
>> I've been replying to the poster and the list for ages. Is it bad
>> netiquette?
>
> I find it annoying, and yes I consider it rude. When we receive messages
 ...
 Do you consider it rude that you choose to use a newsreader, thus
inconveniencing those of us who use the mailing list, as God intended.
(I honestly can't remember if there's any advantage to News, not
having used it this century)
 [Going out of my way to respond only to the list]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] string.format() default variable assignment

2013-03-02 Thread David Robinow
On Sat, Mar 2, 2013 at 9:15 PM, Roy Smith  wrote:
> In article ,
>  David Robinow  wrote:
>
>> On Sat, Mar 2, 2013 at 7:27 PM, Steven D'Aprano
>>  wrote:
>> > On Sat, 02 Mar 2013 09:53:47 -0500, Devin Jeanpierre wrote:
>> >
>> >> On Sat, Mar 2, 2013 at 1:54 AM, Chris Angelico  wrote:
>> >>> Yes, but reply-all sends a copy to the poster as well as the list. What
>> >>> I want is reply-list, acknowledging the list headers... and Gmail
>> >>> simply doesn't have that.
>> >> I've been replying to the poster and the list for ages. Is it bad
>> >> netiquette?
>> >
>> > I find it annoying, and yes I consider it rude. When we receive messages
>>  ...
>>  Do you consider it rude that you choose to use a newsreader, thus
>> inconveniencing those of us who use the mailing list, as God intended.
>> (I honestly can't remember if there's any advantage to News, not
>> having used it this century)
>>  [Going out of my way to respond only to the list]
>
> There's a number of advantages to news vs. mail.  The biggest is that
> news spools generally keep a long history around, so it's easy to go
> back and review a long thread.
 That can't be the biggest since mail stays around forever unless
deliberately deleted.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] string.format() default variable assignment

2013-03-02 Thread David Robinow
On Sat, Mar 2, 2013 at 10:06 PM, Chris Angelico  wrote:
> On Sun, Mar 3, 2013 at 2:01 PM, David Robinow  wrote:
>> On Sat, Mar 2, 2013 at 9:15 PM, Roy Smith  wrote:
>>> There's a number of advantages to news vs. mail.  The biggest is that
>>> news spools generally keep a long history around, so it's easy to go
>>> back and review a long thread.
>>  That can't be the biggest since mail stays around forever unless
>> deliberately deleted.
>
> But your mail has only what you receive. You have to hunt down a
> separate archive of what was posted before you joined the thread.
> Advantage goes to news, but a slight one, and if that's the biggest,
> it's not a great advertisement.
 I have no idea what you're trying to say here. As far as I know, when
I subscribe to a list I get all the mail. I don't "join" threads. I
don't even know what that means.
[This has drifted way off topic so I won't be responding again, but
I'll enjoy reading what anyone cares to write.]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] string.format() default variable assignment

2013-03-04 Thread David Robinow
Ignoring my own posting ban, since I've clearly been misunderstood ..
On Sat, Mar 2, 2013 at 10:21 PM, Steven D'Aprano
 wrote:
> On Sat, 02 Mar 2013 21:11:04 -0500, David Robinow wrote:
>
>>  Do you consider it rude that you choose to use a newsreader, thus
>> inconveniencing those of us who use the mailing list, as God intended.
>
> How the flying fuck does my choice of where and how *I* read this forum
> inconvenience YOU?
>
> Talk about an overactive sense of entitlement. The world does not revolve
> around you and I do not arrange my day to suit your preferences.

 This surprises me. Not the language but the content, since the
inconvenience was explicitly discussed.
  Many list members use gmail. It works for me. I never see double
posts. gmail knows not to do that. The lack of a "reply to list"
option would not concern me if everybody else used gmail. I could just
use "reply all", nobody would see double posts, and we're all happy.
 However, some people prefer to read comp.lang.python. Thus if I use
what is most convenient me, the news users see double posts. To avoid
being thought rude (please note that many people are, or 'were' in the
case of python-list, unaware of this issue and should be classified as
ignorant rather than rude) I need to, after clicking "Reply All"

 Move mouse to CC: area.
 Highlight  python-list address
 C-x   (i.e.,  CUT)
 Move mouse to TO: area.
 Highlight the address (of the poster to whom I am replying)
 C-v   (i.e., PASTE)

 Is that horribly difficult? No, and I intend to do it in the future.
I'm mostly a lurker anyway (I knew python better 10 years ago when I
was still working - inactivity and advanced age have made me dumber. I
mostly read python-list for recreation) so it's not a big deal. I
might be annoyed if I posted more.
  But here's what I don't understand. Why does somebody who posts as
much as Steven (and thanks for that. Getting cussed at occasionally is
a cheap price for all the free advice) not set up a simple mail filter
which trashes all mail from python-list. Wouldn't that solve the
problem?  Or am I misunderstanding something?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] string.format() default variable assignment

2013-03-04 Thread David Robinow
Crap. I just forgot to do what I just said I would do and didn't go
through my "inconvenient" sequence.
Sorry, Steven. It was unintentional.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Windows Deployment Of Python Modules

2013-03-21 Thread David Robinow
On Thu, Mar 21, 2013 at 6:23 PM, Adam Tauno Williams
 wrote:
> David Robinow  wrote:
>>On Thu, Mar 21, 2013 at 4:14 PM, Adam Tauno Williams
>> wrote:
>>>
>>> Python itself is easy to deploy on Windows;  just toss the MSI in
>>your
>>> local update server and away it goes.
>>>
>>> That's slick;  LSUS is awesome.
>>>   <http://www.localupdatepublisher.com/>
>>>
>>> But that gives you Python with no pip, easy_install, etc...  And
>>*that*
>>> is not packaged appropriately.  Is there some trick to getting
>>modules
>>> installed on Windows workstations en masse [in an automated fashion]?
>>> It seems like I must be missing something.
>>> For example, I want Python installed, and the iniparse module.
>>python setup.py install
>>Am I missing something?
>
>
> Yes!
>
>  That does not get the package to the workstation.  It also is not conducive 
> to automation (or success auditing).
 OK, I have no idea what you're talking about. Clearly you want
something more than installing packages.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Global NameError Fix?

2013-03-21 Thread David Robinow
On Thu, Mar 21, 2013 at 7:43 PM, maiden129  wrote:
> Hello,
>
> I'm using the version 3.2.3 of Python and I am having an issue in my program 
> and I don't know how to fix it:
>
> counterLabel["text"] = str(counter)
> NameError: global name 'counterLabel' is not defined
>
> Here is my program:
>
> from tkinter import *
> class CounterButton(Button):
> def __init__(self, window):
>super(CounterButton,self).__init__(window, text = "0", 
> command=self.startCounter)
>
> def startCounter(self):
> counter = int(self["text"])
> counter +=1
> counterLabel["text"] = str(counter)
This should be:
   self["text"] = str(counter)
>
> window = Tk()
> window.title("counter")
...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Differentiation in Python

2013-03-28 Thread David Robinow
On Thu, Mar 28, 2013 at 8:17 AM,   wrote:
> How do I differentiate(first order and 2nd order) the following equations in 
> python. I want to differentiate C wrt Q.
>
> C = (Q**3)-15*(Q**2)+ 93*Q + 100

"""
 Years ago, when I actually worked for a living, I would have
done something like this:
"""
coeffs = [1, -15, 93, 100]
num_coeffs = len(coeffs)-1
deriv = [coeffs[i]*(num_coeffs-i) for i in range(num_coeffs)]
print(deriv)

"""
The above is somewhat obscure and requires one to add
some documentation.  Who wants to do that?

Below is a version using numpy. You get the numpy docs
for free.
"""
import numpy as np
p = np.poly1d(coeffs)
deriv_np = np.polyder(p)
print(deriv_np)
# or
print(list(deriv_np))
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ISO deprecates ASCII Horizontal Tab control character

2013-04-01 Thread David Robinow
If only


On Mon, Apr 1, 2013 at 3:10 PM,  wrote:

> The subcommittee of ISO Joint Technical Committee 1 that is responsible
> for coded character sets has deprecated the Horizontal Tab control
> character in an approved revision of ISO/IEC 646 to be published in the
> next few months.
>
> "The days of HT's usefulness in printer control are long gone," said Dr.
> Yishoki Makimi, chair of the subcommittee. "Today tabs are only used in
> software source code. Our research revealed they serve no function in
> software engineering other than to provoke arguments and therefore waste
> time. We measured that HTs accumulated economic cost surpassed that of big
> vs. little-endian byte order in 2007 and started the committee work to
> deprecate it shortly after that."
>
> The width of a horizontal tab was originally adjustable in printer
> mechanism and was never standardized. Its subsequent use for indentation of
> instructions in the source code of block-oriented languages was economical
> when computer storage was expensive. Eventually many programmers adopted
> spaces leading to the contraversy that motivated the subcommittee.
>
> Microsoft has responded to ISO's move by announcing that HT will contunue
> be supported in Windows through Version 8, after which the code point will
> be repurposed for the Windows Key. Hillary Jeremy, Microsoft's code quality
> and standards boss, welcomed the move saying, "We've probably spent more
> time, over the years, fighting over tabs than we have spent fixing bugs in
> Office."
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help installing latest PyQT

2013-04-02 Thread David Robinow
On Tue, Apr 2, 2013 at 11:39 AM, D. Xenakis  wrote:

> Hi there im trying to install PyQT (version
> PyQt4-4.10-gpl-Py3.3-Qt5.0.1-x64-2.exe) but i dont know how to make sure i
> have installed everything correctly. I tried to find documentation about
> this but most links were very dead..
>
> So far so good.. i have:
> 1)Downloaded and installed "Python 3.3.0 Windows X86-64 MSI Installer"
> from http://www.python.org/download/ , here: "C:\Python33" (i have 64 bit
> Win7 pro Greek edition)
>
> 2)Downloaded and unzipped "sip-4.14.5.zip" from
> http://www.riverbankcomputing.com/software/sip/download , here:
> "D:\Downloads\sip-4.14.5" (other than that, haven't played with this folder
> any further, cause i dont know what exactly i should do with that so
> everything is get properly done..) I suppose after having it unzipped, i
> should then move that somewhere (maybe here "C:\Python33") and then maybe
> run some commands but.. help needed here so i dont do something wrong, as
> this link http://goo.gl/UuLjz doesnt make that clear to me what exact
> steps i should follow :( .
>
sip is not required unless you're building PyQt from sources. You don't
need to do anything with this.

>
> 3)Downloaded and installed "PyQt4-4.10-gpl-Py3.3-Qt5.0.1-x64-2.exe" from
> http://www.riverbankcomputing.com/software/pyqt/download , here:
> "C:\Python33" (It was the setup's default choice so i assumed it was also
> the right one).
>
Yes.

>
> And thats it..
>
> What should i do exactly now foks :)
>
You should be done.Start an interactive python and enter:
>>>import PyQt4

If there's no traceback you're good to go.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python install Win 7 Problem

2013-04-02 Thread David Robinow
On Mon, Apr 1, 2013 at 9:02 PM, Joe Hill  wrote:

> ...
>
> In a Windows 7 environment (even a 64-bit Windows 7 environment), you
> must install the 32-bit version of Python 3. The 64-bit version will not
> work with NumPy 1.6.
>
1.7 is the current version. I use 32-bit Python myself.

> Furthermore, the 32-bit version of Python 3 must be installed 'just
> for me', and not 'for everyone on this computer'.
>
Nonsense.

> Finally, make sure you select the proper NumPy version (for Python
> 3.2), not the default version from SourceForge (which is for Python 2.6).
>
Use
http://sourceforge.net/projects/numpy/files/NumPy/1.7.0/numpy-1.7.0-win32-superpack-python3.2.exe/download

>
> In this post I'm assuming you have already installed Python 3 and that
> you're running Windows 7. Specifically, I'm running Windows 7
> Professional, 64-bit, Service Pack 1. What follows is the whole story of
> the troubleshooting, in case it helps out anyone else having the same
> issues.
> etc.
>
I'm running Windows 7 Home Premium

>
>
> http://docs.python.org/3.2/install/
> More alternatives than an encyclopedia!
> See no reference to Win 7.
> This is NO help
>
I'm not aware of any peculiarities due to use of Win 7 (except it's not
Linux)

>
> http://www.python.org/getit/releases/3.2.3/
> got
> Gzipped source tar ball (3.2.3) (sig), ~ 13 MB
> which was a file:
> Python-3.2.3.tgz
>
Download the Windows executables.

> ...
>
> I'm a total novice - my last program writing was 35+ years ago.  My reason
> for wanting Python is purely for fun an recreation.  I used to just love
> code writing.
>
> Questions:
> 1.  is 3.2.3 the correct version for me?  On April 6 I see that additional
> releases will become available.  I see value in having the latest stable
> programs.  Is any of this for me - I can wait 5 days?
>
3.3.0 is the current version

>
> 2.  Would it make sense to install Python on the D: drive or will that
> just further confuse matters?
>
It shouldn't hurt anything but why would you want to?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python install Win 7 Problem

2013-04-02 Thread David Robinow
On Tue, Apr 2, 2013 at 12:45 PM, Joe Hill  wrote:

> On Tue, 2 Apr 2013 11:44:55 -0400, David Robinow 
> >Download the Windows executables.
> >
> >3.3.0 is the current version
>
> Is "numpy" an option that is needed (guess for math?)?
>
No, it's not needed to run Python. It can be useful. I only mentioned it
because you did.

>
> Assuming 3.3 the current version - what are the "Download the Windows
> executables." files?  and in which order must they be installed?
>
The 32 bit version is at
http://www.python.org/ftp/python/3.3.0/python-3.3.0.msi
The 64 bit version is at
 http://www.python.org/ftp/python/3.3.0/python-3.3.0.amd64.msi

Install one or the other. That's it. If you want to install numpy, do it
after you install python.
 [The suggestion to install the Activestate version is reasonable. I've
never used it. Please use a search engine if you decide to look for it.]


> I never claimed to be a mind reader .
>
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Interactrive Python under Cygwin in Win7

2013-04-08 Thread David Robinow
On Mon, Apr 8, 2013 at 11:20 AM, Grant Edwards wrote:

> I just installed ActiveState 2.7 64-bit on a Windows 7 machine running
> a current version of Cygwin.  While python programs (both GUI and
> text-mode) run fine, I'm unable to use Python interactively from
> either the Cygwin terminal or in an ssh session.  I tried adding the
> "-u" option, but that makes no difference.  Interactive C-Python just
> hangs on startup.
>
> Is this bug specific to ActiveState Python, or is it also present in
> the vanilla C-Python build for Windows?
>
>
It's present in the "vanilla" build. I assume you're running mintty as I
do.
I just use the cygwin build for fooling around with python, and [WARNING:
hold your nose] the cmd shell when I need Windows Python.
You can also use the (old-fashioned?) cygwin.bat do start cygwin which
doesn't give you as nice a terminal but does allow you to run bash and
"/c/Python27/Python" interactively.

Another option, which I just discovered, is bash under msys. It's been a
while since I've used it so I can't remember the pro and con but you can
run an interactive Windows python.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: equivalent to C pointer

2013-04-18 Thread David Robinow
On Thu, Apr 18, 2013 at 1:06 PM, abdelkader belahcene
wrote:

> Hi everybody,
>
> I am new to python  and I am discovering it.
> I know C well,
> and want to know if python knows how to manage Pointers
> like pointer to function  here is a C example how to write it in python
> Intergration with trapeze method
>
> When we write Trapeze   ( at the compilation level) we don't know which
> functions
> Fonc  to handle.  Here for example we use  sin and a user defined  F1
> The program is attached too
>
> #include 
> #include 
>
> double F1 (double x){
> return x*x;
> }
> double Trapeze(double Fonc(double ),
> double left, double right, double step){
>   double X1, X0, Y0, Y1, Z = 0;
>   for(X0=left; X0 < right ; X0 = X0 + step) {
> X1 = X0 + step;
> Y1 = Fonc(X1);Y0 = Fonc(X0);
> Z  += (Y1 + Y0) * step * 0.5;
>   }
>return Z;
> }
> int  main(){
>   double y;
>   y=Trapeze(sin, -2.5, 3.2, 0.1);
>   printf("\n\tValue for sin  is : \t %8.3lf ", y);
>   y=Trapeze(F1, 0, 3, 0.1);
>   printf("\n\tValue for F1 is : \t %8.3lf ", y);
>   return 0;
> }
> /**
> Value for sin  is : 0.197
> Value for F1 is :  9.005
> */
>
> Python doesn't have pointers, but don't let that bother you.
A python version is actually a lot simpler.
See below (I didn't bother with getting the print formats just right)
--
import math
def F1(x):
return x*x

def Trapeze(f, left, right, step):
X0 = left
Z = 0.0
while (X0 < right):
X1 = X0 + step
Y1 = f(X1)
Y0 = f(X0)
Z += (Y1 + Y0) * step * 0.5
X0 = X1
return Z

def main():
y = Trapeze(math.sin, -2.5, 3.2, 0.1)
print("Value for sin is:{0} ".format(y))
y = Trapeze(F1, 0, 3, 0.1)
print("Value for F1 is {0} ".format(y))

if __name__ == "__main__":
main()
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: equivalent to C pointer

2013-04-18 Thread David Robinow
On Thu, Apr 18, 2013 at 1:50 PM, abdelkader belahcene
wrote:

> Thanks for answer,
> but with C  we can compile the trapeze function and put it in librairy,
> If we try to save the trapeze alone in  package to import it later,  I
> think, I am not sure
> it will be refused because F1 and sin are not define !!! this is the
> power of the C pointers !!!
> the link is dynamic
>
You don't need C pointers.  The design below is demonstrative, not ideal.

# file  MyFuncs.py
def F1(x):
return x*x

def Trapeze(f, left, right, step):
X0 = left
Z = 0.0
while (X0 < right):
X1 = X0 + step
Y1 = f(X1)
Y0 = f(X0)
Z += (Y1 + Y0) * step * 0.5
X0 = X1
return Z



# file UseMyFuncs.py
import math
import MyFuncs

def main():
y = MyFuncs.Trapeze(math.sin, -2.5, 3.2, 0.1)
print("Value for sin is:{0} ".format(y))
y = MyFuncs.Trapeze(MyFuncs.F1, 0, 3, 0.1)
print("Value for F1 is {0} ".format(y))

if __name__ == "__main__":
main()

###
#python3 UseMyFuncs.py
###
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Include and lib files for Visual Studio?

2013-04-20 Thread David Robinow
On Sat, Apr 20, 2013 at 4:59 PM,  wrote:

> I am looking for the Python include and lib files for windows. I have a
> c++ project that I am importing into Visual Studio 2010 (express) and it
> links python. I need the include and lib files for windows. Where can I get
> them?
> I'd like to use python 3.3.1 if possible.
>
> I found the msi on python.org but is says they don't include source. I am
> assuming there is a dev sdk or something similar but can't seem to find it.
>
> You are misinterpreting what you are reading. Install the msi.  Look in
C:\Python33\include  and C:\Python33\libs
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Modifying the value of a float-like object

2009-04-14 Thread David Robinow
On Tue, Apr 14, 2009 at 9:03 AM,   wrote:
> Hello,
>
> Is there a way to easily build an object that behaves exactly like a
> float, but whose value can be changed?  The goal is to maintain a list
> [x, y,…] of these float-like objects, and to modify their value on the
> fly (with something like x.value = 3.14) so that any expression like "x
> +y" uses the new value.
>
It's not clear what your requirement is.
Why can't you just use floats?
For your list, why can't you use a list of floats?
Something is missing from your explanation.
--
http://mail.python.org/mailman/listinfo/python-list


Re: wxPython 2.8 for Python 2.6 on Linux

2009-04-19 Thread David Robinow
On Sun, Apr 19, 2009 at 1:58 AM, Kenny x  wrote:
> Hello, I use Ubuntu 8.10 and the latest version of Python.
>
> I started programming wxPython on my Windows computer,
>
> but now I have access to my ubuntu box, and want wxPython for 2.6
>
> All the debs in the package manager are for 2.5, not 2.6
>
> How can I Install wxPython for Python 2.6 without building from the source?
>
> Any help appreciated, I need this solved! :)
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
I don't know. Why don't you ask Ubuntu?
How come you don't want to build from source?
--
http://mail.python.org/mailman/listinfo/python-list


Re: python in Emacs (windows)

2009-04-22 Thread David Robinow
On Wed, Apr 22, 2009 at 3:52 AM, Mark Zweers  wrote:
> Hi!
>
> I'm trying to run python from within Emacs. This is in my .emacs file :
>
> (setq auto-mode-alist ; trigger python mode automatically
>    (cons '("\\.py$" . python-mode) auto-mode-alist))
> (setq interpreter-mode-alist
>    (cons '("python" . python-mode)
>         interpreter-mode-alist))
> (autoload 'python-mode "python-mode" "Python editing mode." t)
>
> , but I got this message :
>
> "Searching for program: no such file or directory, python"
>
> So I've added the following line :
>
> (setq py-python-command '("C:/Program Files/Python"))
>
> This is the path where my 'python.exe' is located. But then this message
> occurs:
>
> Using the CPython shell
> let: Wrong type argument: integerp, "C:/Program Files/Python"
>
> Could anyone tell me how to solve this? Thanks a lot in advance!
>
> Mark
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
1: Try:
   (setq py-python-command "C:/Program Files/Python")

2: Putting your python in "Program Files" is demented.

3. If you put python in your PATH you don't have to set the variable
at all. (Not necessarily recommended, but it's an option.)

4. python-mode supports customize. That might be less error-prone than
trying to set py-python-command in your .emacs

5. Are you aware that emacs comes with a python mode? (python.el in
lisp/progmodes).
Not that it's necessarily better, but I'm curious why you rejected it
for a mode that you don't know how to use.
--
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: PyGUI 2.0.4

2009-04-22 Thread David Robinow
On Wed, Apr 22, 2009 at 8:50 PM, rzed  wrote:
> Greg Ewing  wrote in
> news:49edb69f.7070...@canterbury.ac.nz:
>
>> PyGUI 2.0.4 is available:
>>
>>    http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/
>>
>> Fixes a few more bugs and hopefully improves things
>> on Windows, although I can't be sure it will fix all
>> the Windows problems people are having, because I
>> haven't been able to reproduce some of them.
>
> I want PyGUI to work so badly that it just kills me to find that
> that's how it works for me. So badly.
>
> I've always only gotten this response when I try to run the blobedit
> demo:
>  File "C:\extracted\PyGUI-2.0.4\Demos\BlobEdit\blobedit.py", line
> 16, in 
>    from GUI import Application, ScrollableView, Document, Window,
> FileType, Cursor, rgb
>  File "C:\Python25\Lib\site-packages\GUI\__init__.py", line 78, in
> __getattr__
>    traceback.print_stack()
> Failed to import 'Application' from Applications
> Traceback (most recent call last):
>  File "C:\Python25\Lib\site-packages\GUI\__init__.py", line 69, in
> __getattr__
>    module = __import__(modname, self.__dict__, locals(), [name])
> ImportError: No module named Applications
>
> I really don't know what this means. Is it a path issue? There
> appears to be an Applications.py in GUI\Win32, with an Application
> class. If there is some change I can make in the code, can anyone
> tell me what to do? How can I fix it?
>
> The thing is, in my opinion, something like this is what Python
> *should* have in its standard package. That is, a PYTHON GUI, not a
> thin wrapper around an application-specific API. Sure, the GUI is in
> fact a wrapper, but it should not matter what the back end is that
> supports it (eventually... I know, baby steps).
>
> Obviously, I don't know from GUIs, or maybe it would be obvious to me
> what to do to get it working. And it is for people like me that I
> want to see it work. I really don't want to have to spend more than a
> few minutes investigating the nuances of a windowing system. I just
> want to be able to put up a convenient front end for a program.
>
> --
> rzed
> --
> http://mail.python.org/mailman/listinfo/python-list
>
You probably have PyGTK for windows installed.  PyGUI tries "Cocoa",
"Gtk", and "Win32" in that order.  You can override that by:

SET PYGUI_IMPLEMENTATION=Win32

(This is rather awkward.  Perhaps "Win32" should be tried before "Gtk"? )
--
http://mail.python.org/mailman/listinfo/python-list


Re: PyModerator, serverFiles.py:13: DeprecationWarning: the sha module is deprecated; use the hashlib module instead import sha

2009-04-22 Thread David Robinow
On Wed, Apr 22, 2009 at 9:16 PM, Jim Carlock
 wrote:
> I downloaded Python 2.6.2 today. Anyone here know what that error in
> the subject really means and possibly what I should look at? I took
> a look at line 13 in the specified file and it states the line that
> it has a problem with.
>
> import sha
>
> I'm running Python in Windows XP.
>
> --
> Jim Carlock
> More Than Five Senses
> http://www.associatedcontent.com/article/381163/more_than_five_senses.html
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
It means you should change your code before "sha" goes away in some
future version.
Read about the hashlib module in "What's New in Python 2.5"  (that's
not a typo, this is a section in the 2.6 docs)
[You could have figured this out yourself by searching the docs]
--
http://mail.python.org/mailman/listinfo/python-list


Re: best way to compare contents of 2 lists?

2009-04-23 Thread David Robinow
On Thu, Apr 23, 2009 at 9:31 PM, Esmail  wrote:
> What is the best way to compare the *contents* of two different
> lists regardless of their respective order? The lists will have
> the same number of items, and be of the same type.
>
> E.g. a trivial example (my lists will be larger),
>
> a=[1, 2, 3]
>
> b=[2, 3, 1]
>
> should yield true if a==b
>
> I suppose I could sort them and then compare them. I.e.,
>
> sorted(a)==sorted(b)
>
>
> I am wondering if there is a more efficient/preferred way to do so.
>
> Thanks,
> Esmail
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>

set(a) == set(b)# test if a and b have the same elements

# check that each list has the same number of each element
# i.e.[1,2,1,2] == [1,1,2,2], but [1,2,2,2] != [1,1,1,2]
for elem in set(a):
  a.count(elem) == b.count(elem)
--
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: PyGUI 2.0.5

2009-04-26 Thread David Robinow
On Sun, Apr 26, 2009 at 5:21 AM, Greg Ewing  wrote:
> PyGUI 2.0.5 is available:
> Still no idea what's causing the "object has been destroyed"
> error on Windows XP, though. Does this happen for everyone?
> Is there anyone who *has* got 12-scroll.py working for them
> on XP?

Works fine for me. XP Pro Service Pack 3.  Python 2.5.4 and Python
2.6.2 both work.
--
http://mail.python.org/mailman/listinfo/python-list


Re: stuck with PyOBEX

2009-04-28 Thread David Robinow
On Tue, Apr 28, 2009 at 12:36 PM, alejandro  wrote:
> Can you tell me what is it? Maybe I can search it and pass it in another
> way... if it is an address or protocol name
>
>> AF_BLUETOOTH seems to be specific to *nix-systems. At least under debian
>> and
>> ubuntu, I've got it defined.
>>
>> So it seems it is not supported under windows - you should consider the
>> author if that's a mistake, or by design.
>>
>> Diez
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>

That won't help. The socket module is not compiled with bluetooth
support on Windows.
Microsoft supplies bluetooth support in the PSDK but it's not
compatible with the Linux support and that's all the socket module
supports.
 To get bluetooth support in the socket module somebody will have to
use a Bluetooth Development Kit that is linux-compatible (I don't know
if that exists).
 Alternatively, you might look at PuBluez
(http://code.google.com/p/pybluez/) which appears to wrap the
Microsoft bluetooth stuff. I don't know if that will help you do what
you want.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Third Party Modules

2009-04-28 Thread David Robinow
On Tue, Apr 28, 2009 at 1:15 PM, John Nagle  wrote:
> Brock wrote:
>>
>> Hi Everyone,
>>
>> I know this is most likely a basic question and you will roll your
>> eyes, but I am just starting out with Python (hobbyist) and I see many
>> tutorials on the web referring to the use of external modules.
>>
>> However, when I locate them, they often come as a zipped folder with a
>> number of files.  How do I install them?  In addition, is there an
>> easy way to manage external modules? Some I see require additional
>> modules not included.
>
>   There are several different mechanism for handling this, and they all
> suck.
> The whole Python module distribution scheme is so uncoordinated that there's
> no uniform way to do this.  It's not your fault.
>
>   There's "python ./setup.py".  There are "eggs", which are supposed to
> install very simply, but in practice usually fail to install properly,
> producing obscure error messages.  There are Windows installers.
> There's no consistency.
>
>   I'm currently struggling with guiding users through installation
> of a Python program I put on SourceForge. I have to explain to them how
> to install three different external modules which don't have compatible
> installation mechanisms.
>
>   I'm not going to put Python software out for public use again.  I don't
> have the time to deal with this crap.
>
>                                        John Nagle
>                                        Animats
> --
> http://mail.python.org/mailman/listinfo/python-list
>

Well, John, I do have the time to deal with this crap, since I'm
retired, or unemployed, or somewhere in between. I have no idea if you
have any useful software to share. But feel free to give your users my
email address (drobi...@gmail.com) and I'll do my best to help.
--
http://mail.python.org/mailman/listinfo/python-list


Re: What do you think of ShowMeDo

2009-04-29 Thread David Robinow
On Wed, Apr 29, 2009 at 9:29 AM,   wrote:
...
> To reiterate, I responded to this thread because I think Ben's posting
> gave an unfair impression of the site and i felt the need to address
> some misconceptions. I am sorry you failed to find the videos, but
> many tens of thousands are found every week and I really haven't heard
> of anyone failing to find their way to the content. In this sense I
> think you are exceptional.
Count me as one who couldn't find his way. I'm not usually very
sympathetic to whining about Gui's that aren't perfect, but this one
is beyond my ability to traverse.
I'd really like to view some of the content. I have no concern about
the licensing; I have no intent to redistribute. Why do you make it so
difficult?
How about an ftp site with a directory of videos? That I could understand.
,,,
> Kyran
--
http://mail.python.org/mailman/listinfo/python-list


Re: object query assigned variable name?

2009-05-01 Thread David Robinow
On Fri, May 1, 2009 at 12:24 PM, warpcat  wrote:
> I've passed this around some other groups, and I'm being told
> "probably not possible".  But I thought I'd try here as well :)   I
> *did* search first, and found several similar threads, but they
> quickly tangented into other specifics of the language that were a bit
> over my head :)  At any rate, here's a simple example, I'd love to
> know if as shown, is somehow possible:
>
> Given an object:
>
> class Spam(object):
>    def __init__(self):
>        # stuff
>
> I'd like it to print, when instanced, something like this:
>
 s = Spam()
> I’m assigned to s!
>
> But it seems prohibitively hard (based on my web and forum searches)
> for an object to know what variable name is has been assigned to when
> created.  Querying 'self' in __init__ returns a memory location, not
> the variable name passed in.
>
> If you're wondering why I'm trying to figure this out, this is just
> part of my continued learning of the language and pushing the bounds,
> to see what is possible ;)
>
> Any thoughts?
> --
> http://mail.python.org/mailman/listinfo/python-list
>
Others have explained to you that this is not possible.
I'll just point out that your method for learning the language is not optimal.
If you had gotten a recipe to do what you asked, how would it help you
write better programs?
I suggest that you start programming. If you get stumped, feel free to ask here.
--
http://mail.python.org/mailman/listinfo/python-list


Re: yet another list comprehension question

2009-05-04 Thread David Robinow
On Mon, May 4, 2009 at 2:33 AM, namekuseijin
 wrote:
 ls = [(1,2), (3,4), (5, None), (6,7), (8, None)]
 [(x,y) for (x,y) in ls if y]
> [(1, 2), (3, 4), (6, 7)]

Nope. That filters out 0 as well as None. Not what the OP asked for.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Wrapping comments

2009-05-10 Thread David Robinow
On Sun, May 10, 2009 at 3:32 AM, Tobias Weber  wrote:
> In article ,
>  Arnaud Delobelle  wrote:
>
>> A simple Alt-Q will reformat everything nicely.
>
> Now that's something. Thanks!
>
> (still not gonna use software that doesn't let me type # because it's
> alt+3 on a UK layout; having to re-learn or configure that is just sick)
>
 Put the following in your .emacs file:

(define-key key-translation-map [?\M-3] "#")


or, if you prefer, just be sick.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Fwd: Re: Unable to install Pywin32 for Python 2.6.2

2009-05-12 Thread David Robinow
> Thanks for the help.  I just got it to install for Python 2.6.  All I did
> was change PYTHONPATH (as suggested by Mark) from
> C:\Python25\Lib\site-packages to C:\Python26\Lib\site-packages

Why do you have PYTHONPATH set at all?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Convert UNIX formated text files to DOS formated?

2009-05-13 Thread David Robinow
On Tue, May 12, 2009 at 11:47 PM, walterbyrd  wrote:
> On May 12, 6:15 pm, norseman  wrote:
>
>> Subject line says UNIX to DOS
>>
>> I hope that means you are using a UNIX machine.
>>
>
> I should have mentioned, I am working in an environment that is very
> restrictive about what I can put on my XP desktop. I can not put
> python, or even notepad++, on my desktop. But, I do have cygwin.
>
> As you probably know, cygwin formats to UNIX.
> --
> http://mail.python.org/mailman/listinfo/python-list
>

cygwin has u2d and d2u
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Question about locals()

2009-05-22 Thread David Robinow
On Fri, May 22, 2009 at 10:27 AM, Gökhan SEVER  wrote:
...
> serialc = np.loadtxt(sys.argv[1], skiprows=skiprows).T
> for i in range(20):
>     locals()['serialc_bin' + str(i+1)] = serialc[i+4]
>
> I don't know easier way than using locals() to construct variable-like
> identities in my program.

I don't either.  I also don't know why you feel you need to construct
variable-like identities.
Why is:
  serialc_bin1
better than
  serialc_bin[0]
or, for that matter,
 serialc[4]

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


Re: Question about locals()

2009-05-22 Thread David Robinow
On Fri, May 22, 2009 at 11:00 AM, Gökhan SEVER  wrote:
> Because in this case serialc is an numpy array. Since loadtxt returns a
> numpy-array. Furthermore
>
> locals()['serialc_bin' + str(i+1)]  creates a dictionary key (that's what I
> use the term "variable-like") serialc_bin1, serialc_bin2, ... not
> serialc_bin[0] with indexes.

A name (or variable as you call it) is not a dictionary key. The
contents of the name may be.
A list can not be a dictionary key. However, a list element can be (or
not, if the element itself is mutable)
You gain nothing by creating all these names.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: 4 hundred quadrillonth?

2009-05-24 Thread David Robinow
On Sun, May 24, 2009 at 7:51 PM, Dave Angel  wrote:
>>        By decreeing that the value of PI is 3?
>>
>
> Only in Ohio.
Please, we're smarter than that in Ohio. In fact, while the Indiana
legislature was learning about PI, we had guys inventing the airplane.

http://en.wikipedia.org/wiki/Indiana_Pi_Bill
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What text editor is everyone using for Python

2009-05-28 Thread David Robinow
On Thu, May 28, 2009 at 7:09 AM, Andreas Roehler
 wrote:
> Rhodri James wrote:
>> and I'll get over that.  The feature that caused me to uninstall
>> python-mode.el was its bloody-minded determination to regard '_' as a word
>> character, something which caused me more typing that it ever saved.
>
> Its just one line to comment in python-mode.el, like this:
>
>  ;; (modify-syntax-entry ?\_ "w"  py-mode-syntax-table)
>
 Not really a good idea to make minor changes to distributed elisp.
You'll have to keep redoing the change every time a new version comes
out.
 Better to put something like this in your .emacs file.

  (eval-after-load "python-mode"
'(modify-syntax-entry ?\_ " " py-mode-syntax-table))
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Feature request: String-inferred names

2009-11-29 Thread David Robinow
On Sun, Nov 29, 2009 at 6:58 AM, inhahe  wrote:
> Did you say you were using gmail to post?  I think mailing lists tend to
> have issues with gmail because it puts html in the message or something like
> that.  Btw I recently set up this mailing list to send me a message back
> when I successfully posted something.  oddly enough, i only remember getting
> one such message, so maybe none of my other messages got through. :P
> i think there's a way to disable html when sending a gmail message, but
> don't quote me on that.
 I wasn't aware it was possible to Enable html but apparently it is.
Let me know if you see any html in this post.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python PIL and Vista/Windows 7 .. show() not working ...

2009-12-01 Thread David Robinow
On Mon, Nov 30, 2009 at 12:57 PM, Esmail  wrote:
> Hello all.
>
> I am using the PIL 1.1.6 and Python 2.6.x under XP without any
> problems. However, I can't display any images under Vista
> or Windows 7. I could understand Windows 7 as it's relatively
> new, but Vista has been around for a bit.
>
> Sample code:
>
>  import Image
>
>  im = Image.open('c://mypic.jpg')
>  im.show()
>
>
> this will work fine under XP, but under Windows 7 and Vista
> the default image viewer will come up with some error message
> that the image can't be found.
>
> I tried with an external image view program and tried to supply
> it via the command parameter to show - but that too didn't work.
>
> Definition:     im.show(self, title=None, command=None)
>
> Any suggestions/help/workarounds? If you can get this to work
> with Vista or Windows 7 I'd  love to hear from you.
>
> Thanks!
> Esmail
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>

show() executes a command like:

os.system("start /wait  TempFile.BMP && del /f TempFile.BMP")

On Vista, HELP START displays the following:
...
If Command Extensions are enabled, external command invocation
through the command line or the START command changes as follows:
...
When executing an application that is a 32-bit GUI application, CMD.EXE
does not wait for the application to terminate before returning to
the command prompt.  This new behavior does NOT occur if executing
within a command script.
   ...


The "/wait" apparently does nothing and the image file is deleted
before the image viewer gets a chance to open it. (I think)
[I don't understand why it works in XP since "HELP START" says
basically the same thing]

I haven't tried to fix it yet but a likely solution is to split up the command.

os.system("start TempFile.BMP")
wait a second
os.system(del /f TempFile.BMP")
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Delaunay triangulation

2009-12-02 Thread David Robinow
On Tue, Dec 1, 2009 at 8:31 PM, Vincent Davis  wrote:
> Anyone know of a python implementation of Delaunay triangulation?

Matplotlib has one.
There's also Delny  @pypi

It's been several years since I needed this. I can't remember the pros/cons.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: UnicodeDecodeError? Argh! Nothing works! I'm tired and hurting and...

2009-12-03 Thread David Robinow
On Thu, Dec 3, 2009 at 7:33 PM, Steven D'Aprano
 wrote:
> On Fri, 04 Dec 2009 00:52:35 +0100, Michael Ströder wrote:
>
>> Aahz wrote:
>>> Just to be contrary, I *like* mbox.
>>
>> Me too. :-)
>
>
> Why? What features or benefits of mbox do you see that make up for it's
> disadvantages?

I've never heard of mbox. Is it written in Python?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to tell if you're running on windows?

2009-12-04 Thread David Robinow
On Fri, Dec 4, 2009 at 1:46 PM, Roy Smith  wrote:
> I'm using 2.5.1.  How can I tell if I'm running on windows?  The
> obvious answer, platform.system(), gets complicated.  On the python
> that comes with cygwin, it returns 'CYGWIN_NT-5.2-WOW64', but I've got
> a native windows build of python where it returns 'Microsoft'.
>
> The real problem I'm trying to solve is whether to build a LIBPATH
> environment variable with ';' or ':' delimiting the entries.  On the
> cygwin build, os.pathsep returns ':', which isn't really correct.  If
> you use that, you end up building paths that look like c:foo:c:bar.
> It should be c:foo;c:bar

It's not clear to me what you're using LIBPATH for.
Are you running a cygwin executable from Python? Or a Windows
executable from cygwin?
LIBPATH should be in the format desired by the consumer.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: (OT) Where Are Cookies Stored?

2009-12-16 Thread David Robinow
On Wed, Dec 16, 2009 at 10:33 AM, Dave Angel  wrote:
> You can also find the appdata directory by looking at the environment
> variable USERPROFILE, switching to that directory, and descending directly
> into "application data" by using the tab key.
> ...
Lots of good advice. I'd just point out that there's an APPDATA
environment variable, which is usually but not necessarily the
"Application Data" directory under USERPROFILE.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [ANN] pylint 0.19 / astng 0.19.2

2009-12-18 Thread David Robinow
On Fri, Dec 18, 2009 at 12:49 PM, Jean-Michel Pichavant
 wrote:
> Jerry Hill wrote:
>>
>> On Fri, Dec 18, 2009 at 12:24 PM, Jean-Michel Pichavant >  File
>>> "/opt/tools/python/python2.3/site-packages/logilab_astng-0.19.2-py2.5.egg/logilab/astng/infutils.py",
>>> line 28, in 
>>>  from logilab.astng._nodes import Proxy_, List, Tuple, Function, If,
>>> TryExcept
>>> ImportError: No module named _nodes
>>>

It works for me (but I'm running cygwin)
You should have a file
/opt/tools/python/python2.3/site-packages/logilab_astng-0.19.2-py2.5.egg/logilab/astng/_nodes.py

Does it exist? If not, reinstall logilab_astng-0.19.2
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Setting Parameters inside of code

2009-12-18 Thread David Robinow
On Fri, Dec 18, 2009 at 10:46 AM, Jim Valenza  wrote:
> Hello All - I have a very novice question for any of you out there.  I need
> to assign several parameters to a code in python. I have an example of a
> code that was in DOS that I would need to set as parameters in my Python
> script.
>
> SetLocal EnableDelayedExpansion
> SET OUTPUT=..\log
> SET LOG=..\log
> SET COMPLETED=..\Loaded

You have an unusual use of the word "parameter". What you are doing is
setting environment variables. You can read these values in Python

import os
outvar = os.getenv("OUTPUT")
logvar = os.getenv("LOG")
completevar = os.getenv("COMPLETED")

# etc
print outvar
print logvar
print completevar

--
You may also want to pass arguments (I think 'argument' is what you
called 'parameter') to your script:
   myScript.py firstArg secondArg thirdArg

hunt for sys.argv in the documentation.


For more sophisticated argument passing you may want to look at the
'optparse' module
-- 
http://mail.python.org/mailman/listinfo/python-list


  1   2   >