Re:RELEASED Python 2.4.4, release candidate 1

2006-10-16 Thread Jonathan Smith
Anthony Baxter wrote:
> On behalf of the Python development team and the Python community, 
> I'm happy to announce the release of Python 2.4.4 (release candidate 1).

When trying to build 2.4.4c1 with cross-compiling, I get the following 
error.

checking for /dev/ptmx... configure: error: cannot check for file 
existence when cross compiling

./config.log:configure:20566: checking for /dev/ptmx
./config.log:configure:20572: error: cannot check for file existence 
when cross compiling

This does not occur with 2.4.3.

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


Re: Pygtk but no gtk?

2006-10-20 Thread Jonathan Smith
[EMAIL PROTECTED] wrote:
> I am trying to build an app that requires pygtk so I installed the
> latter. The app does the following:
> import pygtk
> ...
> import gtk
> 
> This crashes with
> ImportError: No module named gtk.
> 
> I dont know where to get this gtk module from. I assumed pygtk would be
> it coz the app doesnt mention any dependency on gtk, also googling
> didnt find anything but pygtk. Did I screw up the installation or
> something? I dont find any gtk.py file in the python library
> directories.
> 
> Thank you.
> Khan
> 

my pygtk provides 
/usr/lib/python2.4/site-packages/gtk-2.0/gtk/__init__.py, which contains 
the gtk module. You should ensure that you have that file, and if not, 
find out where to get it.

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


subprocesses, stdin/out, ttys, and beating insubordinate processes into the ground

2006-06-06 Thread Jonathan Smith
First a bit about what I'm trying to do. I need a function which takes a 
patchfile and patches a source directory. Thats it. However, I need to 
be able to do so no matter what the patchlevel (-px) of the diff is. So, 
my solution is to just try to patch until it works or you try a level 
more than 3. However, if you have a reversed patch, or patch can't find 
the right file, GNU patch tries to ask for input and I don't want that. 
I know that patch will run non-interactively when backgrounded in a 
shell (no controlling tty). This is what I've tried so far:

 def patchme(self, provides, f, destDir, patchlevels):
 for patchlevel in patchlevels:
 patchArgs = ['patch', '-d', destDir, '-p%s'%patchlevel, ]
 if self.backup:
 patchArgs.append(['-b', '-z', self.backup])
 if self.extraArgs:
 patchArgs.append(self.extraArgs)

 log.info('attempting to patch the source with file %s and 
patchlevel %s' % (f,patchlevel))
 p1 = subprocess.Popen([provides, f], 
stdout=subprocess.PIPE, shell=False)
 p2 = subprocess.Popen(patchArgs, stdin=p1.stdout, shell=False)
 message = p2.communicate()[0] # patch seems to use stdout 
for everything, even errors

 if message != None and self.patcherror.search(message):
 os.kill(p2.pid, signal.SIGTERM)
 elif p2.wait():
 log.info('patch did not apply with path level %s' % 
patchlevel)
 print message
 else:
 return
 log.error('could not apply the patch to your build dir')


However, I still get an interactive prompt, no matter what I try! Using 
shell=False did not help, nor did trying to kill the pid if python sees 
a line from patch which isn't saying what its patching or giving info on 
a specific hunk. Any suggestions?

-smithj

PS: if you're a maintainer for GNU patch, a --non-interactive would be 
really nice ;-) (and no, -f and -t aren't good enough as they force 
other things that I don't want)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: why would anyone use python when java is there?

2006-11-28 Thread Jonathan Smith
gavino wrote:
> wtf

Java is a coffee, and coffee comes from exploited Ethiopians (they do
have some damn fine coffee, though). Most of us prefer to exploit
Englishmen instead. (damn them and their humor!)

-smithj


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


Re: Ensure a variable is divisible by 4

2006-12-04 Thread Jonathan Smith
> <[EMAIL PROTECTED]> wrote in message 
> news:[EMAIL PROTECTED]
>> I am sure this is a basic math issue, but is there a better way to
>> ensure an int variable is divisible by 4 than by doing the following;
>>
>> x = 111
>> x = (x /4) * 4
>>
>> Just seems a bit clunky to me.


if ( x % 4 ) == 0:
whatever # x is divisible by 4

modulus is your friend :)

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


Re: Ensure a variable is divisible by 4

2006-12-05 Thread Jonathan Smith
MRAB wrote:
>> if ( x % 4 ) == 0:
>>  whatever # x is divisible by 4
>>
>> modulus is your friend :)
>>
>> -smithj
> 
> 
> It's "modulo"; "modulus" is a different operation.
> 
> 

Wikipedia says "modulus may refer to... %, the modulo operator of 
various programming languages"

http://en.wikipedia.org/wiki/Modulus

That being said, you may be right and it may just be a common mistake.

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


Re: Python 2.4.4 vs. 2.3.6

2006-12-27 Thread Jonathan Smith
I would say 2.4.4, since it has the latest bugfixes of the series most distros 
use.
---
Sent with ChatterEmail+
True push email for the Treo Smartphone
http://get.chatteremail.com

-Original Message-
From: [EMAIL PROTECTED]
Date: Wednesday, Dec 27, 2006 9:05 pm
Subject: Python 2.4.4 vs. 2.3.6
To: python-list@python.org

My top priority is stability of the interpreter. With that in mind
which version should I get: 2.4.4, 2.3.6
or something else.

I will be using gcc 2.3.2(x86), 3.3(arm) and 3.4.3(arm) to cross
compile it depending on the (embedded) platform.

Thank you.

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


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


Re: Dividing integers...Convert to float first?

2007-01-05 Thread Jonathan Smith
Thomas Ploch wrote:
> [EMAIL PROTECTED] schrieb:
>> I'm still pretty new to Python. I'm writing a function that accepts
>> thre integers as arguments. I need to divide the first integer by te
>> second integer, and get a float as a result. I don't want the caller of
>> the function to have to pass floats instead of integers. How do I
>> convert the arguments passed to the function into floats before I do
>> the division? Is this necessary, or is their a better way?
>>
>> Thanks,
>>
>> Scott Huey
>>
> 
> Yes, it is necessary. If you divide two integers, the result will be an
> integer.
> 
>  >>> 1/2
>  0
> 
> You need the function float() -> float because a division between
> integers and floats will have floats as their results
> 
>  >>> float(1)/2
>  0.5


 >>> from __future__ import division
 >>> 1/2
0.5

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


Re: bittorent

2007-04-11 Thread Jonathan Smith
Linus Nordström wrote:
> Hello
> Im planing playing a bit whit bittorrent, but I'm having some trouble
> about where to start. So if anyone could point me in the right
> direction it would be much appreciated.
> The best would be if there are some already written modules that
> handle downloading and seeding torrents, but if that cant be found a
> good source on how one dose to build some sort of bitorrent client
> would be nice.
> 
> thanks in advance

you might start with bittorrent itself [1] - it is written in python.

[1]: http://www.bittorrent.com/download

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


Re: How to pass variables between scripts

2006-05-13 Thread Jonathan Smith
Gross, Dorit (SDRN) wrote:
 > [snip]
 > for f in fileList:
 > try:
 > globvars = {'infile' : f}
 > locvars = {}
 > execfile('/scripts/second.py', globvars(), locvars)
 > except IOError:
 > exit(0)
 > print locvars
 >
 >
 > And this is what happens when calling test_exec.py
 >
 >  ./test_exec.py
 > Traceback (most recent call last):
 >   File "./test_exec.py", line 19, in ?
 > execfile('/scripts/second.py', vars(), results)
 > TypeError: 'dict' object is not callable
 >

Why do you try to call globevars as if it was a function? As the 
traceback states, dictionaries can't be called like that. Just take the 
() out and try again.

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