Re: Why do Perl programmers make more money than Python programmers

2013-05-07 Thread Benjamin Kaplan
On May 7, 2013 5:42 PM, "Neil Hodgson" wrote: > > jmfauth: > >> 2) More critical, Py 3.3, just becomes non unicode compliant, >> (eg European languages or "ascii" typographers !) >> ... > > >This is not demonstrating non-compliance. It is comparing performance, not compliance. > >Please sh

Re: in need of some help regarding my rock paper scissors game

2013-05-12 Thread Benjamin Kaplan
On Sun, May 12, 2013 at 12:33 PM, Alex Norton wrote: > im new to python and im in the middle of making a RPS game for a college > unit. > > i have used PyQt to create the GUI and i have received help regarding adding > the code to the buttons. > > but its missing something as the error > > 'Traceb

RE: Python #ifdef

2013-05-28 Thread Benjamin Kaplan
On May 28, 2013 1:10 PM, "Carlos Nepomuceno" wrote: > > Thank you! I made it run like the following. What do you think about that? IS there a better way? > > > > #The following runs on Python 2.7 > sc3=''' > # Python 3 > def original(n): > m = 0 > for b in n.to_bytes(6, 'big'): > m

Re: Re-using copyrighted code

2013-06-08 Thread Benjamin Kaplan
On Sat, Jun 8, 2013 at 2:31 PM, Malte Forkel wrote: > Hello, > > I have written a small utility to locate errors in regular expressions > that I want to upload to PyPI. Before I do that, I would like to learn > a litte more about the legal aspects of open-source software. What would > be a good i

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Benjamin Kaplan
On Sun, Jun 9, 2013 at 2:38 AM, Νικόλαος Κούρας wrote: > Τη Κυριακή, 9 Ιουνίου 2013 12:20:58 μ.μ. UTC+3, ο χρήστης Lele Gaifax έγραψε: > >> > How about a string i wonder? >> > s = "νίκος" >> > what_are these_bytes = s.encode('iso-8869-7').encode(utf-8') > >> Ignoring the usual syntax error, this i

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-09 Thread Benjamin Kaplan
On Sun, Jun 9, 2013 at 2:20 AM, Νικόλαος Κούρας wrote: > Τη Κυριακή, 9 Ιουνίου 2013 12:12:36 μ.μ. UTC+3, ο χρήστης Cameron Simpson > έγραψε: >> On 09Jun2013 02:00, =?utf-8?B?zp3Or866zr/PgiDOk866z4EzM866?= >> wrote: >> >> | Steven wrote: >> >> | >> Since 1 byte can hold up to 256 chars, why not

Re: Re-using copyrighted code

2013-06-09 Thread Benjamin Kaplan
On Sun, Jun 9, 2013 at 1:32 PM, Mark Janssen wrote: > On Sun, Jun 9, 2013 at 12:50 PM, Michael Torrie wrote: >> On 06/09/2013 11:18 AM, Mark Janssen wrote: >>> You actually do not. Attaching a legal document is purely a secondary >>> protection from those who would take away right already grante

Re: Re-using copyrighted code

2013-06-09 Thread Benjamin Kaplan
On Sun, Jun 9, 2013 at 6:40 PM, Mark Janssen wrote: >> Mark, ever watched TV? Or gone to the movies? Or walked into a bookshop? >> Listened to the radio? All these things publish copyrighted work. It is >> utter nonsense that merely publishing something in public gives up the >> monopoly privilege

Re: Version Control Software

2013-06-13 Thread Benjamin Kaplan
On Jun 13, 2013 10:17 AM, "Grant Edwards" wrote: > > On 2013-06-13, Ben Finney wrote: > > cutems93 writes: > > > >> I am looking for an appropriate version control software for python > >> development, and need professionals' help to make a good decision. > > > >> Currently I am considering four

Re: Eval of expr with 'or' and 'and' within

2013-06-14 Thread Benjamin Kaplan
On Jun 14, 2013 9:34 AM, "Michael Torrie" wrote: > > On 06/14/2013 03:50 AM, Nick the Gr33k wrote: > > >>> print(name or month or year) > > abcd > > >>> print(name and month and year) > > ijkl > > Interesting. I'd have thought a boolean expression would return True or > False, not a string. Le

Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.]

2013-06-17 Thread Benjamin Kaplan
On Mon, Jun 17, 2013 at 8:55 AM, Simpleton wrote: > On 17/6/2013 5:22 μμ, Terry Reedy wrote: >> >> On 6/17/2013 7:34 AM, Simpleton wrote: >>> >>> On 17/6/2013 9:51 πμ, Steven D'Aprano wrote: Now, in languages like Python, Ruby, Java, and many others, there is no table of memory addr

Re: Is this PEP-able? fwhile

2013-06-24 Thread Benjamin Kaplan
On Mon, Jun 24, 2013 at 8:54 PM, Chris Angelico wrote: > On Tue, Jun 25, 2013 at 12:01 PM, rusi wrote: >> On Tuesday, June 25, 2013 3:08:57 AM UTC+5:30, Chris Angelico wrote: >>> On Tue, Jun 25, 2013 at 5:52 AM, <> wrote: >>> >>> > (NOTE: Many people are being taught to avoid 'break' and 'conti

Re: How to tell Script to use pythonw.exe ?

2013-07-03 Thread Benjamin Kaplan
On Jul 3, 2013 8:27 AM, "Νίκος" wrote: > > Στις 3/7/2013 6:43 πμ, ο/η Tim Roberts έγραψε: > >> goldtech wrote: >>> >>> >>> I just changed the file extension of the script file from .py to .pyw >>> and it uses pythonw.exe. I didn't read it anywhere, just intuited it >>> and tried it. Python has so

Re: Importing modules into IronPython

2013-07-03 Thread Benjamin Kaplan
On Wed, Jul 3, 2013 at 3:05 PM, HighBeliever wrote: > Hi, I have to shift a Python 2.7 program to run in Windows. Doing that has > forced me to use IronPython because my program is dependent on a .dll file > that uses .NET framework. > > I moved all my code to Iron Python and modified it to work

Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte

2013-07-05 Thread Benjamin Kaplan
On Jul 5, 2013 12:12 AM, "Lele Gaifax" wrote: > > Νίκος Gr33k writes: > > > try: > > host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0] > > except Exception as e: > > host = "Reverse DNS Failed" > > > > How can the above code not be able to reeverse dns any more and it > > fa

Re: Explain your acronyms (RSI?)

2013-07-06 Thread Benjamin Kaplan
On Sat, Jul 6, 2013 at 12:38 PM, Terry Reedy wrote: > "rms has crippling RSI" (anonymous, as quoted by Skip). > > I suspect that 'rms' = Richard M Stallman (but why lower case? to insult > him?). I 'know' that RSI = Roberts Space Industries, a game company whose > Kickstarter project I supported.

Re: GeoIP2 for retrieving city and region ?

2013-07-15 Thread Benjamin Kaplan
On Sat, Jul 13, 2013 at 10:43 AM, Νικόλας wrote: > Στις 13/7/2013 7:54 μμ, ο/η Dennis Lee Bieber έγραψε: >> >> Are you paying for a fixed IP number? I suspect you are if you >> were >> running a world-accessible server. >> >> Obviously a fixed IP will be tied to a fixed connection

Re: Read STDIN as bytes rather than a string

2012-06-18 Thread Benjamin Kaplan
On Mon, Jun 18, 2012 at 4:13 PM, Jason Friedman wrote: > I tried this: > > Python 3.2.2 (default, Feb 24 2012, 20:07:04) > [GCC 4.6.1] on linux2 > Type "help", "copyright", "credits" or "license" for more information. import sys import io fh = io.open(sys.stdin) > Traceback (most re

Re: "constant sharing" works differently in REPL than in script ?

2012-06-18 Thread Benjamin Kaplan
On Mon, Jun 18, 2012 at 7:52 PM, wrote: > Listening to 'Radio Free Python' episode 8 > (http://radiofreepython.com/episodes/8/ - around about the 30 minute mark) I > heard that Python pre creates some integer constants to avoid a proliferation > of objects with the same value. > > I was intere

Re: None shown in output

2012-06-21 Thread Benjamin Kaplan
On Thu, Jun 21, 2012 at 8:42 PM, Xander Solis wrote: > Hello Python list, > > Noob here with a newbie question. I'm reading and working on the exercise of > the book, Learn Python the Hard way 2.0. When I use this code, I get "None" > on the output. My question is why does this happen? > > def get

Re: None shown in output

2012-06-21 Thread Benjamin Kaplan
damn On Thu, Jun 21, 2012 at 9:24 PM, Benjamin Kaplan wrote: > On Thu, Jun 21, 2012 at 8:42 PM, Xander Solis wrote: >> Hello Python list, >> >> Noob here with a newbie question. I'm reading and working on the exercise of >> the book, Learn Python the Hard way

Re: Executing Python Scripts on Mac using Python Launcher

2012-06-25 Thread Benjamin Kaplan
On Mon, Jun 25, 2012 at 11:19 AM, David Thomas wrote: > Hello, > This is my first post so go easy on me.  I am just beginning to program using > Python on Mac.  When I try to execute a file using Python Launcher my code > seems to cause an error in terminal, when I execute the exact same piece o

Re: Perl __DATA__ construct.

2012-06-25 Thread Benjamin Kaplan
On Mon, Jun 25, 2012 at 2:20 PM, Mladen Gogala wrote: > I have a script in Perl that I need to rewrite to Python. The script > contains __DATA__ at the end of the script, which enables Perl to access > all the data after that through a file descriptor, like this: > > usage() if ( !$stat or !define

Re: Executing Python Scripts on Mac using Python Launcher

2012-06-26 Thread Benjamin Kaplan
On Tue, Jun 26, 2012 at 10:19 AM, David Thomas wrote: > I have installed Python 2.7.3 from Python.org also in Terminal it states that > I have 2.7.3. > How can I execute the script from Terminal?  I've tried typing python into > the window and then dragging the file to terminal but I get a synta

Re: Is there any way to decode String using unknown codec?

2012-06-27 Thread Benjamin Kaplan
On Wed, Jun 27, 2012 at 6:14 PM, wrote: > Hi > I'm a Korean and when I use modules like sys, os, &c, > sometimes the interpreter show me broken strings like > '\x13\xb3\x12\xc8'. > It mustbe the Korean "alphabet" but I can't decode it to the rightway. > I tried to decode it using codecs like cp94

Re: moving methods from class to instance of other class

2012-06-28 Thread Benjamin Kaplan
On Wed, Jun 27, 2012 at 11:59 PM, lars van gemerden wrote: > Hi all, > > I have some trouble with the following question: Let say i have the > following classes: > > class A(object): >    def __init__(self): >        self.name = 'a' >    def do(self): >        print 'A.do: self.name =', self.name

Re: how to compile pygtk in python2.7?

2012-07-07 Thread Benjamin Kaplan
On Sat, Jul 7, 2012 at 9:47 PM, contro opinion wrote: > 1.download pygtk > > 2.cd /home/tiger/pygtk-2.24.0 > > 3.PYTHON=/usr/bin/python2.7 ./configure --prefix=/usr > 4. make > 5. make install > > tiger@ocean:~$ python2.7 > Python 2.7.3 (default, Jul 1 2012, 14:13:18) > [GCC 4.4.5] on linux2 >

Re: help

2012-07-19 Thread Benjamin Kaplan
On Jul 19, 2012 4:04 PM, "Miriam Gomez Rios" wrote: > > Hello, sorry for bothering you, but I have a doubt, > > Is there a way to turn this string into a tuplelist??, I need it for gurobi > > ('per1','persona1.1','pro1'),('per1','persona1.1','pro2'),('per1','persona1.1','pro3'),('per1','person

Re: I thought I understood how import worked...

2012-08-07 Thread Benjamin Kaplan
On Aug 7, 2012 8:41 AM, "Roy Smith" wrote: > > On Tuesday, August 7, 2012 9:55:16 AM UTC-4, Ben Finney wrote: > > > The tutorial is misleading on this. It it says plainly: > > > > A module can contain executable statements as well as function > > definitions. […] They are executed only th

Re: Idle no longer works

2012-08-11 Thread Benjamin Kaplan
On Sat, Aug 11, 2012 at 4:09 PM, Opap-OJ wrote: > I can no longer open the Idle IDE for Python on Windows 7. > > For 3-5 years I used Idle for all my python work. But in January this > happens: > > When I right click on a python file and choose "open with Idle" nothing > happens. > > If I doubl

Re: how to fix error "Requires python(abi)=2.4"

2012-08-14 Thread Benjamin Kaplan
On Aug 14, 2012 4:51 AM, "sagarnikam123" wrote: > > i am installing numpy on fedora with python 2.6,2.7 & 3.1 > > > > -- Python bytecode and C interface are not compatible across versions. If you're trying to install a numpy binary that was compiled against 2.4, it won't work with newer versions.

Re: How to convert base 10 to base 2?

2012-08-20 Thread Benjamin Kaplan
On Mon, Aug 20, 2012 at 12:50 AM, wrote: > Hi, > as you can argue from the subject, i'm really,really new to python. > What is the best way to achieve that with python? Because the syntax > int('30',2) doesn't seem to work! That syntax goes the other way- from a string representing a number in

Re: popen4 - get exit status

2012-08-27 Thread Benjamin Kaplan
On Aug 27, 2012 3:47 PM, "Tim Johnson" wrote: > > In bash I do the following: > linus:journal tim$ /home/AKMLS/cgi-bin/perl/processJournal-Photo.pl hiccup > -bash: /home/AKMLS/cgi-bin/perl/processJournal-Photo.pl: No such file or directory > linus:journal tim$ echo $? > 127 > > In python, use os.p

Re: is implemented with id ?

2012-09-04 Thread Benjamin Kaplan
On Tue, Sep 4, 2012 at 11:30 PM, Franck Ditter wrote: > Hi ! > a is b <==> id(a) == id(b) in builtin classes. > Is that true ? > Thanks, > > franck No. It is true that if a is b then id(a) == id(b) but the reverse is not necessarily true. id is only guaranteed to be unique among objects alive

Re: why did the WindowsError occur?

2012-09-04 Thread Benjamin Kaplan
On Tue, Sep 4, 2012 at 11:30 PM, Levi Nie wrote: > my code: > import os > os.startfile(r'C:\Program Files\Internet Explorer.exe') > > the error: > os.startfile(r'C:\Program Files\Internet Explorer.exe') > WindowsError: [Error 2] : 'C:\\Program Files\\Internet Explorer.exe' > There's no such thing

Re: Accessing dll

2012-09-06 Thread Benjamin Kaplan
On Sep 6, 2012 8:15 AM, "Helpful person" wrote: > > I am a complete novice to Python. I wish to access a dll that has > been written to be compatible with C and VB6. I have been told that > after running Python I should enter "from ctypes import *" which > allows Python to recognize the dll str

Re: Is there any difference between print 3 and print '3' in Python ?

2012-09-10 Thread Benjamin Kaplan
On Sun, Sep 9, 2012 at 11:33 PM, Dwight Hutto wrote: > > > On Sun, Sep 9, 2012 at 10:41 AM, Ian Foote wrote: >> >> On 09/09/12 14:23, iMath wrote: >>> >>> 在 2012年3月26日星期一UTC+8下午7时45分26秒,iMath写道: I know the print statement produces the same result when both of these two instructions

Re: Newbie: where's the new python gone?

2012-09-10 Thread Benjamin Kaplan
On Sun, Sep 9, 2012 at 11:10 PM, Dwight Hutto wrote: > > I have several installations on my windows, so I use > c:\python27_64\python.exe module_file.py > > or > > c:\python26\python.exe module_file.py > > in the command line. > > > Not to show that this shouldn't be a discussion, but usually it's

Re: a python license problem?

2012-09-10 Thread Benjamin Kaplan
On Mon, Sep 10, 2012 at 7:58 PM, Jayden wrote: > Python is under GPL compatible. If I develop a python code, convert it to > executable and distribute the executable as a commercial software. May I need > to make my source code open? > > If python is under GPL, is the answer different? Thanks a

Re: subprocess call is not waiting.

2012-09-19 Thread Benjamin Kaplan
On Sep 19, 2012 9:37 AM, "andrea crotti" wrote: > Well there is a process which has to do two things, monitor > periodically some external conditions (filesystem / db), and launch a > process that can take very long time. > > So I can't put a wait anywhere, or I'll stop everything else. But at >

Re: Installing Pip onto a mac os x system

2012-09-19 Thread Benjamin Kaplan
On Sep 19, 2012 6:37 PM, "John Mordecai Dildy" wrote: > > Does anyone know how to install Pip onto a mac os x ver 10.7.4? > > Ive tried easy_instal pip but it brings up this message (but it doesn't help with my problem): > > error: can't create or remove files in install directory > > The followin

Re: Can't import modules

2012-09-30 Thread Benjamin Kaplan
On Sun, Sep 30, 2012 at 12:42 PM, Peter Farrell wrote: > Hello! > > I'm still new to Python, so here's another easy one. After I save something > I've done as a .py file, how do I import it into something else I work on? > Every time I try to import something other than turtle or math, I get thi

Re: Can't run any script without it failing due to calling tkinter for no reason

2012-10-14 Thread Benjamin Kaplan
On Sun, Oct 14, 2012 at 6:47 PM, wrote: > Hello All, > > > I'm running python 3.2 on Freebsd 9.0 Release and I must've screwed up my > environment somehow, because now I can't run any script without it failing > and throwing: > ** IDLE can't import Tkinter. Your Python may not be configured fo

Re: Nice solution wanted: Hide internal interfaces

2012-10-29 Thread Benjamin Kaplan
On Mon, Oct 29, 2012 at 9:33 AM, Johannes Bauer wrote: > Hi there, > > I'm currently looking for a good solution to the following problem: I > have two classes A and B, which interact with each other and which > interact with the user. Instances of B are always created by A. > > Now I want A to ca

Re: Numpy module

2012-10-29 Thread Benjamin Kaplan
On Sun, Oct 28, 2012 at 10:40 PM, wrote: > Hello to the group! > > I've learned a lot about Ubuntu just trying to install numpy for Python > 3.2.3. I've finally managed to put it in the Python3.2 directory but when I > try to import it, I still get there's "no module named numpy." There are >

Re: Robust regex

2012-11-19 Thread Benjamin Kaplan
On Nov 19, 2012 12:37 PM, "Joseph L. Casale" wrote: > > Trying to robustly parse a string that will have key/value pairs separated > by three pipes, where each additional key/value (if more than one exists) > will be delineated by four more pipes. > > string = 'key_1|||value_1key_2|||value

Re: How to import module whose filename starts number

2012-12-12 Thread Benjamin Kaplan
On Dec 12, 2012 9:47 AM, "Yong Hu" wrote: > > I have a few scripts whose file names start with numbers. For example, 01_step1.py, 02_step2.py > > I tried to import them in another script by "import 01_step1" or "from 01_step1 import *". Both failed, saying "SyntaxError: invalid syntax" > > Is ther

Re:

2012-12-15 Thread Benjamin Kaplan
On Sat, Dec 15, 2012 at 5:49 PM, Dustin Guerri wrote: > > Hi there, > > I'm new to Python and to programming. is this the right place for me to > post a beginner question on Python use ? > > Many thanks. > You could post questions here, but it would be better to use the Python-tutor list for tha

Re: Unicode

2012-12-17 Thread Benjamin Kaplan
On Mon, Dec 17, 2012 at 12:59 AM, Anatoli Hristov wrote: >> What happens when you do use UTF-8? > This is the result when I encode the string: > " étroits, en utilisant un portable extrêmement puissant—le plus > petit et le plus léger des HP EliteBook pleine puissance—avec un > écran de di

Re: compile python 3.3 with bz2 support

2012-12-22 Thread Benjamin Kaplan
On Dec 21, 2012 1:31 AM, "Isml" <76069...@qq.com> wrote: > > hi, everyone: > I want to compile python 3.3 with bz2 support on RedHat 5.5 but fail to do that. Here is how I do it: > 1. download bzip2 and compile it(make、make -f Makefile_libbz2_so、make install) > 2.chang to python 3.3 sou

Re: 3.2 can't extract tarfile produced by 2.7

2012-12-26 Thread Benjamin Kaplan
On Dec 26, 2012 11:00 AM, "Antoon Pardon" wrote: > > I am converting some programs to python 3. These programs manipulate tarfiles. In order for the python3 programs to be really useful > they need to be able to process the tarfiles produced by python2 that however seems to be a problem. > > This

Re: How do you call a function several times in this context??

2013-01-06 Thread Benjamin Kaplan
On Jan 6, 2013 12:33 PM, "kofi" wrote: > > Using python 3.1, I have written a function called "isEvenDigit" > > Below is the code for the "isEvenDigit" function: > > def isEvenDigit(): > ste=input("Please input a single character string: ") > li=["0","2","4", "6", "8"] > if ste in li:

Re: wiki.python.org

2013-01-09 Thread Benjamin Kaplan
On Wed, Jan 9, 2013 at 8:30 AM, Ken wrote: > On Wed, Jan 09, 2013 at 04:05:31PM +, Reed, Kevin wrote: >> Hello, >> >> I have been unable to access wiki.python.org for two days. Is there a >> problem with the server, or is it me? >> >> Thank you much, >> >> Kevin C. Reed >> New Python User >

Re: cymbalic reference?

2013-01-15 Thread Benjamin Kaplan
On Tue, Jan 15, 2013 at 8:56 PM, rh wrote: > I have this working and I am curious to know how others do same. > > class Abc(object): > def __init__(self): > pass > def good(self): > print "Abc good" > def better(self): > print "Abc better" > > urls = {'Abc':'htt

Re: Using an object inside a class

2012-01-23 Thread Benjamin Kaplan
On Mon, Jan 23, 2012 at 4:22 PM, Jonno wrote: > > > On Mon, Jan 23, 2012 at 2:25 PM, Terry Reedy wrote: >> >> On 1/23/2012 2:44 PM, Jonno wrote: >>> >>> I have a pretty complicated bit of code that I'm trying to convert to >>> more clean OOP. >>> >>> Without getting too heavy into the details I h

Re: [semi OT]: Smartphones and Python?

2012-02-16 Thread Benjamin Kaplan
On Feb 16, 2012 10:25 AM, "Michael Torrie" wrote: > > On 02/16/2012 07:53 AM, 8 Dihedral wrote: > > The law suites of JAVA Vitrtual Machine from Oracle > > are famous now. But in 201X the JVM patents will be > > expired, thus it is not very urgent to chunk out a new jython now. Anyway just wri

Re: Python math is off by .000000000000045

2012-02-22 Thread Benjamin Kaplan
On Feb 22, 2012 1:16 PM, "Alec Taylor" wrote: > > Simple mathematical problem, + and - only: > > >>> 1800.00-1041.00-555.74+530.74-794.95 > -60.9500045 > > That's wrong. > > Proof > http://www.wolframalpha.com/input/?i=1800.00-1041.00-555.74%2B530.74-794.95 > -60.95 aka (-(1219/20)) > > Is

Re: How can I make an instance of a class act like a dictionary?

2012-02-27 Thread Benjamin Kaplan
On Mon, Feb 27, 2012 at 3:09 PM, John Salerno wrote: > On Feb 27, 1:39 am, Chris Rebert wrote: >> On Sun, Feb 26, 2012 at 11:24 PM, John Salerno wrote: >> > Hi everyone. I created a custom class and had it inherit from the >> > "dict" class, and then I have an __init__ method like this: >> >> >

Re: What's the best way to write this regular expression?

2012-03-07 Thread Benjamin Kaplan
On Wed, Mar 7, 2012 at 4:11 PM, John Salerno wrote: > > On Wed, Mar 7, 2012 at 3:01 PM, Ian Kelly wrote: > > > There is a fork of setuptools called "distribute" that supports Python > > 3. > > Thanks, I guess I'll give this a try tonight! > > > setup.py is a file that should be included at the to

Re: Installing Python Apps on Mac Lion

2012-03-13 Thread Benjamin Kaplan
On Tue, Mar 13, 2012 at 12:42 PM, wrote: > > Sábado, 25 de Junho de 2011 02h20min49s UTC+1, JKPeck escreveu: > > The Lion version of the OS on the Mac comes with Python 2.7 installed, > > but it is in /System/Library/Frameworks/..., and this area is not writable > > by third party apps. > > > > So

Re: Run once while loop

2012-04-04 Thread Benjamin Kaplan
On Wed, Apr 4, 2012 at 9:21 AM, Anatoli Hristov wrote: > I thing the best will be if I use hundreds of the seconds to print the > message. > > for example at 12:00:00:10, but unfortunately I cant see that I can use > hundreds of the seconds. > > Does anyone knows if I can use it ? > > Thanks > > A

Re: Question on Python 3 shell restarting

2012-04-10 Thread Benjamin Kaplan
On Tue, Apr 10, 2012 at 2:36 PM, Franck Ditter wrote: > In article > <19745339.1683.1333981625966.JavaMail.geo-discussion-forums@yncc41>, >  Miki Tebeka wrote: > >> > How may I get a fresh Python shell with Idle 3.2 ? >> Open the configuration panel (Options -> Configure IDLE). >> Look in the "Ke

Re: trac.util

2012-04-11 Thread Benjamin Kaplan
On Wed, Apr 11, 2012 at 4:52 PM, cerr wrote: > > Hi, > > I want to install some python driver on my system that requires trac.util > (from Image.py) but I can't find that anywhere, any suggestions, anyone? > > Thank you very much, any help is appreciated! > > Error: > File "/root/weewx/bin/Image.p

Re: system call that is killed after n seconds if not finished

2012-04-16 Thread Benjamin Kaplan
On Mon, Apr 16, 2012 at 10:51 AM, Jaroslav Dobrek wrote: > > Hello, > > I would like to execute shell commands, but only if their execution > time is not longer than n seconds. Like so: > > monitor(os.system("do_something"), 5) > > I.e. the command do_somthing should be executed by the operating >

Re: why () is () and [] is [] work in other way?

2012-04-23 Thread Benjamin Kaplan
On Mon, Apr 23, 2012 at 1:01 PM, Paul Rubin wrote: > > Kiuhnm writes: > > I can't think of a single case where 'is' is ill-defined. > > If I can't predict the output of > >    print (20+30 is 30+20)  # check whether addition is commutative >    print (20*30 is 30*20)  # check whether multiplicati

Re: Some posts do not show up in Google Groups

2012-04-29 Thread Benjamin Kaplan
On Mon, Apr 30, 2012 at 2:20 AM, Frank Millman wrote: > > Hi all > > For a while now I have been using Google Groups to read this group, but on > the odd occasion when I want to post a message, I use Outlook Express, as I > know that some people reject all messages from Google Groups due to the hi

Re: %d not working in re at Python 2.7?

2012-05-14 Thread Benjamin Kaplan
On May 14, 2012 7:06 PM, "vacu" wrote: > > I am frustrated to see %d not working in my Python 2.7 re.search, like > this example: > > >>> (re.search('%d', "asdfdsf78asdfdf")).group(0) > Traceback (most recent call last): > File "", line 1, in > AttributeError: 'NoneType' object has no attribute

Re: install python 2.6 on Ubuntu 12.04

2012-05-22 Thread Benjamin Kaplan
On Tue, May 22, 2012 at 8:09 PM, Dan Stromberg wrote: > > If the pythons you require are in synaptic (sudo to root and run synaptic), > you probably can just use them. > > If not, then you, for each release, need to: > 1) download a tarball using a browser or whatever > 2) extract the tarball: tar

Re: How to import Webkit and object in Official Python (not MacPorts python) without X11.

2012-05-26 Thread Benjamin Kaplan
On Sat, May 26, 2012 at 9:31 AM, Mr.T Beppu wrote: > I think that I will make a browser in Official Python (not MacPorts > Python). > What should I do in order to install Webkit for Official Python (not > MacPorts Python) ? > from tokyo Japan. > You don't just "install WebKit". You need a GUI fra

Re: ./configure

2012-06-03 Thread Benjamin Kaplan
> > Thanks Alain.  I should have a compiler on my Mac OS X Lion.  I am thinking > that it isn't set in my $PATH variable.  I don't know where the $PATH is set > at.  I will check to see if their is a binary. > -- > http://mail.python.org/mailman/listinfo/python-list You need to install the comma

Re: Installing Mailman

2012-06-03 Thread Benjamin Kaplan
On Mon, Jun 4, 2012 at 12:49 AM, Chris Rebert wrote: > On Sun, Jun 3, 2012 at 9:04 PM, Janet Heath > wrote: >> checking for --with-python... no >> checking for python... /usr/bin/python >> checking Python interpreter... /usr/bin/python >> checking Python version... 2.7.1 >> checking Python's emai

Re: Where is the latest step by step guide to use Jython to compilePython into Java?

2012-06-04 Thread Benjamin Kaplan
On Mon, Jun 4, 2012 at 11:47 AM, David Shi wrote: > Hello, Mohan, > > Did you test it?  I am using Windows.  Where are the exact steps for > compiling in DOS? > > Once .class or jar files created, how to use these files? > > Could you enlighten me with tested/proven step by step instructions? > >

Re: Passing ints to a function

2012-06-08 Thread Benjamin Kaplan
On Fri, Jun 8, 2012 at 7:41 PM, stayvoid wrote: > Hello, > > I want to pass several values to a function which is located on a > server (so I can't change its behavior). > That function only accepts five values which must be ints. > > There are several lists: > a = [1, 2, 3, 4, 5] > b = [5, 4, 3,

Re: Py3.3 unicode literal and input()

2012-06-18 Thread Benjamin Kaplan
On Mon, Jun 18, 2012 at 1:19 AM, jmfauth wrote: > What is input() supposed to return? > u'a' == 'a' > True r1 = input(':') > :a r2 = input(':') > :u'a' r1 == r2 > False type(r1), len(r1) > (, 1) type(r2), len(r2) > (, 4) > > --- > > sys.argv? > > jmf Python

Re: How to import data from MySQL db into excel sheet

2011-06-06 Thread Benjamin Kaplan
On Mon, Jun 6, 2011 at 9:35 AM, Prasad, Ramit wrote: >> Currently i am importing the Database into CSV file using csv module, >>in csv file i need to change the column width according the size of >>the data. i need to set different column width for different columns >>pleas let me know how to achi

Re: In Python 2.x, is it possible to make unicode as default like in Python 3.x?

2011-06-08 Thread Benjamin Kaplan
On Wed, Jun 8, 2011 at 11:22 AM, G00gle and Python Lover wrote: > Hello. > I almost like everything in Python. Code shrinking, logic of processes, > libraries, code design etc. > But, we... - everybody knows that Python 2.x has lack of unicode support. > In Python 3.x, this has been fixed :) And I

Re: Of Functions, Objects, and Methods-I NEED HELP PLEASE

2011-06-08 Thread Benjamin Kaplan
On Wed, Jun 8, 2011 at 1:09 PM, Cathy James wrote: > I am almost there, but I need a little help: > > I would like to > > a) print my dogs in the format  index. name: breed as follows: > > 0. Mimi:Poodle > 1.Sunny: Beagle > 2. Bunny: German Shepard > I am getting > > (0, ('Mimi', 'Poodle')) . Mimi

Re: the stupid encoding problem to stdout

2011-06-08 Thread Benjamin Kaplan
2011/6/8 Sérgio Monteiro Basto : > hi, > cat test.py > #!/usr/bin/env python > #-*- coding: utf-8 -*- > u = u'moçambique' > print u.encode("utf-8") > print u > > chmod +x test.py > ./test.py > moçambique > moçambique > > ./test.py > output.txt > Traceback (most recent call last): >  File "./test.py

Re: Python 2.6 OR 3.2

2011-06-10 Thread Benjamin Kaplan
On Thu, Jun 9, 2011 at 11:00 PM, harrismh777 wrote: > Andrew Berg wrote: >> >> AFAICT, there are three reasons to learn Python 2: > >   ... there is a fourth reason. > > The linux distro you are using currently was customized with python 2.x > > I ran into this problem this week in fact... on my H

Re: Question About Command line arguments

2011-06-10 Thread Benjamin Kaplan
On Jun 10, 2011 10:26 AM, "Mark Phillips" wrote: > > I have a script that processes command line arguments > > def main(argv=None): > syslog.syslog("Sparkler stared processing") > if argv is None: > argv = sys.argv > if len(argv) != 2: > syslog.syslog(usage()) > els

Re: Question About Command line arguments

2011-06-10 Thread Benjamin Kaplan
On Fri, Jun 10, 2011 at 11:31 AM, Tim Chase wrote: > On 06/10/2011 12:58 PM, Mark Phillips wrote: >> >> How do I write my script so it picks up argument from the >> output of commands that pipe input into my script? > > You can check > >  if os.isatty(sys.stdin):  # <-- this check Any reason for

Re: PyQt

2011-06-10 Thread Benjamin Kaplan
On Fri, Jun 10, 2011 at 12:15 PM, KK wrote: > Thanks for the reply!! > i ve installed the binary > but when i import anything of PyQt in my prog it says error?? > i think there is some problem with folders What is the exact text of the error message? We can't help you unless we know

Re: debian defaults not up-to-date

2011-06-12 Thread Benjamin Kaplan
On Jun 12, 2011 10:32 AM, "blues2use" wrote: > > Just finished installing Mint 10 and all has gone well. However, when I > removed some applications, I received this error during the removal: > > INFO: using unknown version '/usr/bin/python2.7' (debian_defaults not up- > to-date?) > > The removal

Re: Subsetting a dataset

2011-06-12 Thread Benjamin Kaplan
On Sun, Jun 12, 2011 at 9:53 PM, Kumar Mainali wrote: > I have a huge dataset containing millions of rows and several dozen columns > in a tab delimited text file.  I need to extract a small subset of rows and > only three columns. One of the three columns has two word string with header > “Scient

Re: Python 2.7.2 for Windows reports version as 2.7.0?

2011-06-17 Thread Benjamin Kaplan
On Fri, Jun 17, 2011 at 5:55 PM, wrote: > Just installed the 32-bit version Python 2.7.2 for Windows via the > python-2.7.2.msi download. > > When I start Python via python.exe or Idle, the version info is reported as > 2.7.0 vs. 2.7.2. > > Python 2.7 (r27:82525, Jul  4 2010, 09:01:59) [MSC v.150

Re: installing NLTK

2011-06-17 Thread Benjamin Kaplan
On Fri, Jun 17, 2011 at 1:57 PM, Nige Danton wrote: > Hans Mulder wrote: >> On 17/06/11 21:58:53, Nige Danton wrote: >>> Mac OSX python 2.6.1: I'm trying to install the natural language toolkit >>> and following the instructions here www.NLTK.org/download I've downloaded >>> the PyYAML package an

Re: What is this syntax ?

2011-06-19 Thread Benjamin Kaplan
On Sun, Jun 19, 2011 at 2:06 PM, Vito 'ZeD' De Tullio wrote: > Roy Smith wrote: > >> There's something nice about building up strings in-line, as >> opposed to having to look somewhere to see what's being interpolated. >> To give a more complex example, consider: >> >> print "$scheme://$host:$port

Re: What's the best way to write this base class?

2011-06-20 Thread Benjamin Kaplan
On Sun, Jun 19, 2011 at 9:04 PM, John Salerno wrote: > On Jun 19, 8:52 pm, Chris Kaynor wrote: > >> Having a character class (along with possibly player character, non-player >> character, etc), make sense; however you probably want to make stuff like >> health, resources, damage, and any other

Re: Do we still need to inherit from "object" to create new-style classes?

2011-06-20 Thread Benjamin Kaplan
On Mon, Jun 20, 2011 at 6:26 PM, John Salerno wrote: > I can't quite seem to find the answer to this anywhere. The book I'm > reading right now was written for Python 3.1 and doesn't use (object), > so I'm thinking that was just a way to force new-style classes in 2.x > and is no longer necessary

Re: Better way to iterate over indices?

2011-06-21 Thread Benjamin Kaplan
On Tue, Jun 21, 2011 at 11:05 AM, Billy Mays wrote: > I have always found that iterating over the indices of a list/tuple is not > very clean: > > for i in range(len(myList)): >    doStuff(i, myList[i]) > > > > > I know I could use enumerate: > > for i, v in enumerate(myList): >    doStuff(i, myLi

Re: running an existing script

2011-06-21 Thread Benjamin Kaplan
On Tue, Jun 21, 2011 at 10:45 AM, Adam Chapman wrote: > Hi, > > I'm trying to put together a lot of pieces of source code in matlab, > java, perl and python. > > Im an expert when it comes to matlab, but novice in all the others > listed above. However, I have integrated the java and perl code so

Re: How can I speed up a script that iterates over a large range (600 billion)?

2011-06-21 Thread Benjamin Kaplan
On Tue, Jun 21, 2011 at 4:30 PM, Terry Reedy wrote: > On 6/21/2011 3:48 PM, John Salerno wrote: > >> Absolutely not! Each problem has been designed according to a "one- >> minute rule", which means that although it may take several hours to >> design a successful algorithm with more difficult prob

Re: Security test of embedded Python

2011-06-21 Thread Benjamin Kaplan
On Tue, Jun 21, 2011 at 7:40 PM, Paul Rubin wrote: > Chris Angelico writes: >> I'll also be looking into Pike. Unfortunately its community is far >> smaller than Python's, so security holes may be less obvious. > > Actually the most obvious and widespread sandboxed language these days > is Javasc

Re: writable iterators?

2011-06-22 Thread Benjamin Kaplan
On Jun 22, 2011 12:31 PM, "Neal Becker" wrote: > > AFAICT, the python iterator concept only supports readable iterators, not write. > Is this true? > > for example: > > for e in sequence: > do something that reads e > e = blah # will do nothing > > I believe this is not a limitation on the for l

Re: connect windows share

2011-06-22 Thread Benjamin Kaplan
On Jun 22, 2011 11:44 AM, "Travis Altman" wrote: > > I want to be able to connect to a windows share via python. My end goal is to be able to recursively search through windows shares. I want to do this in Linux as well. So given a share such as \\computer\test I would like to search through th

Re: python 3 constant

2011-06-22 Thread Benjamin Kaplan
On Jun 22, 2011 12:03 PM, "sidRo" wrote: > > How to declare a constant in python 3? > -- You don't. Python doesn't have declarations (other than global and nonlocal). Convention is that anything in all caps should be considered a constant but there's no language-level enforcement of it. -- http

Re: Mac OS X 10.6.6 and MacPyhton 2.6 idle doesn't work

2011-06-23 Thread Benjamin Kaplan
On Jun 23, 2011 10:42 AM, "mando" wrote: > > I've installed MacPython 2.6 under mac os x 2.6 and the IDLE doesn't > work. > I post error log. Suggestions? > > Thanks a lot. > > Luca > You'll have to install Tcl yourself. The 2.6 binaries were compiled against a newer version than Apple ships. >

Re: Default value for optional parameters unexpected behaviour?

2011-06-26 Thread Benjamin Kaplan
On Sun, Jun 26, 2011 at 11:28 AM, Marc Aymerich wrote: > Hi, > I'm trying to define a function that has an optional parameter which > should be an empty list whenever it isn't given. However, it takes as > value the same value as the last time the function was executed. What > is the reason of thi

Re: write file

2011-07-05 Thread Benjamin Kaplan
On Jul 5, 2011 2:28 PM, "miguel olivares varela" wrote: > > > Hi, > > i got a csv file that i need to modify and create a new one, i have no problem to read mi 'test.cvs' which is the source file but when i try to create a new one with the modifications i only got the first row in my 'out.csv' fi

Re: String concatenation vs. string formatting

2011-07-08 Thread Benjamin Kaplan
On Fri, Jul 8, 2011 at 1:18 PM, Andrew Berg wrote: > Is it bad practice to use this > > logger.error(self.preset_file + ' could not be stored - ' + > > sys.exc_info()[1]) > Instead of this? > > logger.error('{file} could not be stored - > > {error}'.format(file=self.preset_file, error=sys.exc_info

  1   2   3   4   5   6   7   8   >