Themed TK (tk Tile) at last?!

2009-03-07 Thread Python Nutter
Looks like we finally get tkinter GUI based programs according to
Issue# 2983 in Python 3.1a so our programs don't look like something
out of early 1980's and can be themed to more closely match the
underlying Operating Systems widget set!

This is a big deal in that while tkinter came with (just about) every
Python the desire to use wxWidgets or Qt etc was high because tkinter
widgets just look so horrid. Now for simple GUIs you can use a themed
widget set.

ttk or themed tk won out as the name, others may remember tk tile.

The Python 3.1a web page still had what's new in Python 2.7 on the web
page so does this also enter the Python 2.x branch?  I don't know yet.
But it so I might have a push to move off of 2.5.4 finally for the so
simple GUi based apps I have.

Good job python-dev team.

Cheers,
PN
--
http://mail.python.org/mailman/listinfo/python-list


Re: should i move on to python3

2009-03-07 Thread Python Nutter
Maybe if everyone shares their own thinking for their own situations
it may help.

I know the 2.x branch rather well, and cut my teeth on it.

My work involves x509 cryptographic materials and I cut my own
binaries and then wrap them in python to extend and enhance or build a
lot of automation around the binaries. I am the primary consumer of
the final programs so I don't wrap them in any sort of GUI. As such my
python touchpoints are rather slim on libraries. It took me all my
life up to a month ago to move off of os.popen and onto subprocess.
With this I could move between Python branches without much issue. I
do have an Ubuntu system at work as well as Windows so I'm a lazy sod
who didn't feel like building a custom Python build so I jus use what
comes with Ubuntu. Because of this I am stuck with a tenuous small
reliance on the 2.x branch, very small but add in lazy or not wanting
to use up xyz hours preparing new environments and learning a new
idioms and you might get the typical python user who encorporates it
at a job function where programming is not their job function but they
use python to help make the job eaier in a few areas.

I use more 3rd party modules at home and use the OS X platform
exclusively there. I wish I had time with the family but a lot of my
projects have been left by the wayside (web page scraping, games and
opengl programming, etc). Unlike Windows, tkinter GUI programs on OS X
could look native-ish. I always have aversions to making GUI programs
for distribution that require users install large dependencies so I
have shied away from doing them. With 3.1 it looks like themed tk
support is now added so that could be an incentive. That and I
silently troll python submitters and got the feeling 3.1 was what 3.0
was supposed to be ;-) so I been silently waking for 3.1 to go final
before spending time with the 3 branch to learn the changes.

In short if it's just you using your programs you have a lot of
flexibility in your choice of branch to use. If you distribute then
you are restricted by your end user branch sets even more. If you
heavily use 3rd party modules you are tied down further. So work
backwards and decide what is it you at writting, what features
internal and external are you using or desire to use and who will
consume your program. Then you'll have your answer or pretty close to
it.

Cheers,
PN
On 08/03/2009, Martin P. Hellwig x...@xs4all.nl wrote:
 R. David Murray wrote:
 cut
 Comparing Python releases to Windows releases is...disturbing :)
 That was why I was very carefully in this example for choosing 2000 :-)

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

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


Re: Upgrade Python on a Mac

2009-03-02 Thread Python Nutter
from my .profile file in ~

# This file does not get executed because .bash_profile exists in the
home directory
# and that gets executed instead. If .bash_profile did not exist then
this file gets executed

# PN hand edit export PATH to process the most recently installed
Python Framework
# otherwise the default Apple Python 2.5.1 that comes with Leopard
10.5.x would be called
export PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:$PATH
# Finished exporting PATH to run most recently installed Python Framework

now I also have a .bash_profile in ~ but I've decommissioned it and
just renamed it with my initials at the end, this had:

# Setting PATH for MacPython 2.5
# The orginal version is saved in .bash_profile.pysave
PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}
export PATH



as you know, the framework pythons go into:
/Library/Frameworks/Python.framework/Versions/

and thats how all the different versions get installed on OS X at the same time

I
f you have ever looked at your Mac’s root directory and wondered what
some of those other directories are for, you’re probably not alone.
Mac OS got a whole lot more complex with the advent of OS X, adapting
a unix file structure from Free BSD Unix that is largely unfamiliar to
Mac OS 9 and Windows users. So just what is /System, /Library, /usr,
and all the others for anyway? Here’s a brief explanation of each
directory as found in Mac OS X.


By default, if you look in the root of your Mac’s hard disk you’ll see
some unfamiliar sounding directories. From the command line, you will
see even more if you type ls /. Explained in no particular order:

/Applications   = Self explanatory, this is where your Mac’s applications are 
kept

/Developer =The Developer directory appears only if you have
installed Apple’s Developer Tools, and no surprise, contains developer
related tools, documentation, and files.

/Library = Shared libraries, files necessary for the operating system
to function properly, including settings, preferences, and other
necessities (note: you also have a Libraries folder in your home
directory, which holds files specific to that user).

/Network = largely self explanatory, network related devices, servers,
libraries, etc

/System = System related files, libraries, preferences, critical for
the proper function of Mac OS X

/Users = All user accounts on the machine and their accompanying
unique files, settings, etc. Much like /home in Linux

/Volumes = Mounted devices and volumes, either virtual or real, such
as hard disks, CD’s, DVD’s, DMG mounts, etc

/ = Root directory, present on virtually all UNIX based file systems.
Parent directory of all other files

/bin = Essential common binaries, holds files and programs needed to
boot the operating system and run properly

/etc = Machine local system configuration, holds administrative,
configuration, and other system files

/dev = Device files, all files that represent peripheral devices
including keyboards, mice, trackpads, etc

/usr = Second major hierarchy, includes subdirectories that contain
information, configuration files, and other essentials used by the
operating system

/sbin = Essential system binaries, contains utilities for system administration

/tmp = Temporary files, caches, etc

/var = Variable data, contains files whose contents change as the
operating system runs
--
http://mail.python.org/mailman/listinfo/python-list


Re: PYTHONPATH on Mac 10.5

2009-02-25 Thread Python Nutter
+1 for site packages and standard shebang, still lets you launch with
python first followed by .py file or big long path to a specific
python followed by .py file

also for some clues, just open up a terminal in your Mac OS X computer
and check out your exports your PATH will be different depending on
all the software and development environments you may or may not be
using on your Mac, in particular:

declare -x 
PATH=/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

declare -x PYTHONSTARTUP=/Users/pythonnutter/.pythonstartup

for the ultra curious, my custom python startup:

$cat .pythonstartup
# python startup file
import readline
import rlcompleter
import atexit
import os
# tab completion
readline.parse_and_bind('tab: complete')
# history file
histfile = os.path.join(os.environ['HOME'], '.pythonhistory')
try:
readline.read_history_file(histfile)
except IOError:
pass
atexit.register(readline.write_history_file, histfile)
del os, histfile, readline, rlcompleter



On Windows you don't have much control in standard batch files but the
way I keep my Windows box (at work mind you, none at home)
multi-python'd

is I configure the environment for Framework 2.5.4, and all the path
environment variables are configured for the standard directory and
the scripts subdirectory.

in 25's scripts is go26.bat which just pre-pends the 2.6.1 path on the
head of PATH, and of course a go3.bat that pre-pends in 3.0.1

if you want to get fancy, since there is no pop in batch files that I
know of, you could drop a .py script in to read in PATH, pop off two
entries and modify the environment PATH so you fall back down the tree
(might need some list reversing in there to finish the massaging for
pops)

most times I get by with just exiting the terminal session in windows
and a new cmd session will once again take on the defaults for 2.5.4
--
http://mail.python.org/mailman/listinfo/python-list


Re: Found a very nice, small, cross-platform GUI toolkit for Python.

2009-02-16 Thread Python Nutter
 Note: spelling is OcempGUI. Also, since google broke some of the
 links,
 here's that main link again:

Thats my bad or more to the point my iPhone bad, typing fast with
spellcheck changes words to real dictionary words.


 Well, to be fair, SDL is pretty commonly-used software and they offer
 binary downloads for Mac OS X and MS Windows. Pygame seems to provide
 the same. So, installation should be a breeze.

Not on Mac. To get SDL, PyObjC, PyGame and other dependencies
installed on the platform you are talking on downloading and
installing close to 50MB+ of packages before you get to the point
where you install the OcempGUI package.

Thats a lot to ask of a user just to run my one program on their
system. If it was just myself and I wanted to go through the process
for educational/self-benefit I wouldn't mind.

But TkInter is already installed (0 dependencies) and on every Mac out
there so when I said 87Kbytes for a widget set that looks rather Mac
like I was saying compare 87Kbytes to 50+Megabytes to get a GUI for my
python application.

Along the same lines on my Linux boxes, GDK+/KDE are normally already
installed, nothing for the entire user base to install additional or
very little (additional) dependencies to install to get a wxWidget or
Qt interface going on those systems. Python wrappers are small but the
additional dependency installs above and beyond the base system is
what I am pointing at as killing off any interest in OcempGUI.

I also have this sneaking suspicion that the BDFL is secretly on the
sidelines waiting for the Tk tile theming engine to mature as if it
does and becomes standard in Python distributions I would say the
justification for learning wx and qt would be diminished by an unknown
quantity.

 What? Qt and wX are *huge* compared to OcempGUI.

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


Re: Pythonic way to determine if a string is a number

2009-02-15 Thread Python Nutter
Type casting seems to be the wrong way to go about this.

teststring = '15719'
teststring.isdigit()
returns True

That takes care of integers.

from string import digits
digits
'0123456789'

now you have all the digits and you can do set testing in your logic
to see if the teststring has anything in digits

A dumb way to test is alphanumeric

teststring2 = '105.22'
teststring2.isalnum()
returns True

now you can go on from there and test to further to eliminate
'abcd385laf8' which on alnum() also returns true.

Have fun,
Cheers,
PN


2009/2/16  pyt...@bdurham.com:
 What's the Pythonic way to determine if a string is a number? By
 number I mean a valid integer or float.

 I searched the string and cMath libraries for a similar function
 without success. I can think of at least 3 or 4 ways to build my
 own function.

 Here's what I came up with as a proof-of-concept. Are there
 'better' ways to perform this type of test?

 Thanks,
 Malcolm

 code
 def isnumber( input ):
try:
if '.' in input:
num = float( input )
else:
num = int( input )
return True

except ValueError:
return False

 if __name__ == '__main__':
tests = 
12
-12
-12.34
.0
.
1 2 3
1 . 2
just text


for test in tests.split( '\n' ):
print 'test (%0s), isnumber: %1s' % \
  ( test.strip(), isnumber( test ) )

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

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


Re: Pythonic way to determine if a string is a number

2009-02-15 Thread Python Nutter
silly me, forgot to mention

build a set from digits + '.' and use that for testing.

Cheers,
PN


2009/2/16 Python Nutter pythonnut...@gmail.com:
 Type casting seems to be the wrong way to go about this.

 teststring = '15719'
 teststring.isdigit()
 returns True

 That takes care of integers.

 from string import digits
 digits
 '0123456789'

 now you have all the digits and you can do set testing in your logic
 to see if the teststring has anything in digits

 A dumb way to test is alphanumeric

 teststring2 = '105.22'
 teststring2.isalnum()
 returns True

 now you can go on from there and test to further to eliminate
 'abcd385laf8' which on alnum() also returns true.

 Have fun,
 Cheers,
 PN


 2009/2/16  pyt...@bdurham.com:
 What's the Pythonic way to determine if a string is a number? By
 number I mean a valid integer or float.

 I searched the string and cMath libraries for a similar function
 without success. I can think of at least 3 or 4 ways to build my
 own function.

 Here's what I came up with as a proof-of-concept. Are there
 'better' ways to perform this type of test?

 Thanks,
 Malcolm

 code
 def isnumber( input ):
try:
if '.' in input:
num = float( input )
else:
num = int( input )
return True

except ValueError:
return False

 if __name__ == '__main__':
tests = 
12
-12
-12.34
.0
.
1 2 3
1 . 2
just text


for test in tests.split( '\n' ):
print 'test (%0s), isnumber: %1s' % \
  ( test.strip(), isnumber( test ) )

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


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


Re: Found a very nice, small, cross-platform GUI toolkit for Python.

2009-02-15 Thread Python Nutter
Had a look and it is still under my radar unfortunately because of
TkInter. OceanGUI has a lot of large decencies (Pygame, SDL libraries,
PyObjC, etc.) to install on my system to just to get a GUI thats no
better loking than TkInter which comes pre-installed (no dependencies)
on most every major platform.

If I was writing a game I might be interested, but I'd want to do some
serious skinning of that GUI to make it look better.

For applications installing the full wxWidgets or Qt toolkits would be
less disk space and dependcies than OceanGUI and performance would
probably be higher. TkInter also has many skins/themes you can add
that makes it rather, although not 100% native looking on target
systems.

For example, check out
http://tclmacbag.autons.net/screenshots.phtml

For 86K download/dependencies I can get a rather Mac looking GUI.

Cheers,
PN


2009/2/16  laplacia...@gmail.com:
 I think I just found the GUI toolkit for Python I've been searching
 for. It seems to meet all of the following requirements:

  * free software
  * small (I don't need batteries -- Python already comes with those.)
  * easy to use
  * actively maintained
  * cross-platform
  * easy to install
  * based on a stable and actively-maintained C library
  * does not depend on an external scripting language (for example,
 Tcl)
  * well-documented
  * not too many dependencies
  * can easily integrate with PyOpenGL
  * support for accessibility

 and it's also written in Python.

 I have no idea how it's stayed under the radar in the Python community
 for this long, yet here it is: [OcempGUI](http://ocemp.sourceforge.net/
 gui.html). The C library it depends upon? [SDL](http://
 www.libsdl.org/) (via [PyGame](http://www.pygame.org/news.html)).

 The sf project page is http://sourceforge.net/projects/ocemp/.

 Installation only requires getting SDL installed, then PyGame, and
 then a `sudo python setup.py install` for OcempGUI. `cd` into its `doc/
 examples` directory and run a few of the examples (ex. `python
 hello_world.py`).

 The part of [the manual](http://ocemp.sourceforge.net/manual/ocempgui-
 manual.html) that seems most like a beginner tutorial is http://
 ocemp.sourceforge.net/manual/gui_applications.html.
 --
 http://mail.python.org/mailman/listinfo/python-list

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


Re: Programmatically changing network proxy settings on the Mac

2009-02-11 Thread Python Nutter
OS X is POSIX/UNIX system so your basic plan of going about things:
1. Learn what proxy/network subsystem Tiger uses
2. Learn what proxy/network subsystem Leopard uses (same as 1., or has
it changed?)
3. Based on 1 and 2 learn the config file names and locations.
4. Based on 3 you will determine if the file is text or xml format so
learn file processing for whichever one
5. Read the config file, Make some changes in OS X, read the config
file and compare changes.
6. Programatically script changes to those config file(s).
7. Learn if any service/daemon needs to be restarted or if an
interface needs to be brought down/up to bring in those changes to the
config file.
8. Script in what you learned in 7.
9. Finished.

2009/2/11  arunasu...@gmail.com:
 Hi,

 Anybody have suggestions of how network proxy settings can be changed
 programmatically on the Mac, Tiger and Leopard. Are there any helpful
 python api's that can be used.

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

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


Re: explain

2009-02-11 Thread Python Nutter
If your use is to Generically want to use python on Windows XP you
install the standard/generic Python that you download from python.org

Without any details to decide with, I would also say download version
2.5.4 of Python from python.org

2009/2/12 Saeed Iravani si.4...@yahoo.com:
 Hello, I want to use python but I do not know that I install Python or
 ActivePython or VPython or Jython?
 My operating system is Windows XP SP2.
 Please explain for me completely.


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


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


Re: Integrating awk in Python

2009-01-16 Thread Python Nutter
If you or anyone who reads the thread is interested in using Python in
an advanced way you use generators and build processing chains that
will take the performance of Python to the edge and even give old AWK
a run for its money for certain types of processing.

Python:
wwwlog = open(access-log)
bytecolumn = (line.rsplit(None,1)[1] for line in wwwlog)
bytes  = (int(x) for x in bytecolumn if x != '-')
print Total, sum(bytes)

Python execution time: 25.96 seconds

AWK:
% awk '{ total += $NF } END { print total }' big-access-log

AWK execution time: 37.33 seconds



With generators you can plug in filters at any stage:

lines = lines_from_dir(big-access-log,.)
lines = (line for line in lines if 'robots.txt' in line)
log   = apache_log(lines)
addrs = set(r['host'] for r in log)the beauty of generators is that
you can plug
filters in at almost any stage

The second line increased the execution time of a 1.3GB log file.
Without it the execution was shameful at 53 minutes
With the second line added execution time was 93 seconds

David Beazley presented a great talk and accompanying PDF at
PyCon'2008. It would be great if these generator tricks / patterns
came more to the focus of the commuinity.

Link if interested: http://www.dabeaz.com/generators/Generators.pdf



2009/1/16 Alfons Nonell-Canals alfons.non...@upf.edu:
 Hello,
 I'm developing a software package using python. I've programmed all
 necessary tools but I have to use other stuff from other people. Most of
 these external scripts are developed using awk.

 At the beggining I thought to translate them and program them in python
 but I prefer to avoid it because it means a lot of work and I should do it
 after each new version of this external stuff. I would like to integrate
 them into my python code.

 I know I can call them using the system environment but it is slower than if
 I call them inside the package. I know it is possible with C, do you have
 experience on integrate awk into python calling these awk scripts from
 python?

 Thanks in advance!

 Regards,
 Alfons.


 --
 
 Alfons Nonell-Canals, PhD
 Chemogenomics Lab
 Research Group on Biomedical Informatics (GRIB) - IMIM/UPF
 Barcelona Biomedical Research Park (PRBB)
 C/ Doctor Aiguader, 88 - 08003 Barcelona
 alfons.non...@upf.edu - http://cgl.imim.es
 Tel. +34933160528

 http://alfons.elmeuportal.cat
 http://www.selenocisteina.info

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


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


Re: SSL certificate parsing?

2009-01-05 Thread Python Nutter
If no one answers, the way I do my work with certificates is I just
wrap OpenSSL myself by doing a popen call (probably now should be
using subprocess for any future scripts I write). I then redirect the
output that normally goes to the shell window into a buffer then I
search/slice out the fields using standard Python string searching.
You could go to regex's but its overkill in my opinion if you can
simply do standard string searches. The buffer always follows a set
pattern so you are not going to have to search wildly varying output
from OpenSSL call to OpenSSL call.

I looked at PyOpenSSL but I have country specific OIDs that are
standard by not in the default ISO standard. Most libraries fall short
on supporting what I need and it was brain dead easy to just call
OpenSSL in my script directly and capture the output for parsing.

Its up to you what you want to do with the extracted information, you
could just populate a dict with it and perhaps shelve or store it for
later use if you have such a need or as in my case since I only
process the certificates once I just use the parsed information
immediately in my scripts logic decision tree(s) to create various
output.

Cheers,
PN

2009/1/5 Taras Ivashchenko naplan...@gmail.com:
 Hello, list!

 I use pyopenssl [0] for checking SSL certificates.
 And one of such checks is if given certificate is self-signed.
 I can do it using values of X509v3 extensions: the subject key identifier and
 the authority key id:
 X509v3 Subject Key Identifier:
 0E:D4:AA:B1:09:91:7C:36:60:EA:56:4E:9C:57:00:AF:9C:4D:02:00
 X509v3 Authority Key Identifier:
 keyid:0E:D4:AA:B1:09:91:7C:36:60:EA:56:4E:9C:57:00:AF:9C:4D:02:00

 I read documentation of pyOpenSSL but I didn't find way how to grub
 this information
 from certificate using, for example, methods of X509 object.

 May be there is another way to parse SSL certificates?
 I will be glad to get ever text version of given SSL certificate :)

 [0] http://pyopenssl.sourceforge.net/

 P.S. I already wrote to  pyopenssl mailing list, but there is now
 answer there :(

 Тарас Иващенко (Taras Ivashchenko)
 --
 Software is like sex: it's better when it's free., - Linus Torvalds.
 --
 http://mail.python.org/mailman/listinfo/python-list

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


Re: Learning Python now coming from Perl

2008-12-06 Thread Python Nutter
Perl Cookbook for Python Programmers:
http://pleac.sourceforge.net/pleac_python/index.html

P3K as starting point (slight cringe) as long as you know the caveats.

I'm of the mind as Christopher with regard to how Python 3.0 has been
released on Python.org:

I don't think that Python 3.0 is a bad thing. But that it's
displayed so prominently on the Python web site, without any kind of
warning that it's not going to work with 99% of the Python code out
there, scares the hell out of me. People are going to download and
install 3.0 by default, and nothing's going to work. They're going to
complain, and many are going to simply walk away.
- Christopher Lenz

Python3 is beautiful, and I am totally with James Bennet
http://www.b-list.org/weblog/2008/dec/05/python-3000/

That said I would suggest you learn the whole history of the Py3K
project and its 19+ years of 20/20 hindsight on what works well and
what doesn't so you can if you want to jump right into Python3 fully
informed on why it is the way it is and why you need to wait for 3rd
party libraries to catch up and release a Python 3 compatible version
and why all the Internal libraries are no worry except for the fact
some of them have disappeared in the cleanup or merged into a single
library. Then you can make sense of all the 2.x books and posts and
know where to start when trying to apply it to Python 3.

Cheers,
PN
(Python 2.5.2, Stackless Python 2.5.2, Python 2.6 and Python 3.0 on my box)

P.S. Look into iPython as your new favourtie shell and virtualenv to
help you keep all your projects straight and you'll be very productive
in no time =)


2008/12/7 Bertilo Wennergren [EMAIL PROTECTED]:
 I'm planning to start learning Python now, using Python 3000.
 I have no previous Python skills, but I now Perl pretty well.
 I'm also well experienced with JavaScript.

 Any pointers and tips how I should go about getting into
 Python?
--
http://mail.python.org/mailman/listinfo/python-list


Re: Learning Python now coming from Perl

2008-12-06 Thread Python Nutter
 In article [EMAIL PROTECTED],
  Steven D'Aprano [EMAIL PROTECTED] wrote:

 Well, as an old-time unix hacker (who learned REs long before Perl
 existed), my question to you would be, Is there any problem which
 *shouldn't* be solved with an RE? :-)

 One of the reasons REs don't get used in Python as much as in Perl is
 because strings have useful methods like startswith(), endswith(), and
 split(), and also the in operator.  These combine to give you easy ways
 to do many things you might otherwise do with REs.


I agree, I'm going through the new book Python for Unix and Linux
Administration now and although in general I like what they say, they
take you through the built in string functions and then introduce REs
and end the chapter leaving the reader with the impression that REs
are the better solution and I only agree with the case of the
problem/program they presented.

However I used the built ins more effectively using the indexes
returned within the string and I've built plenty of scripts that did
not need to move to REs to perform the text/file processing that I
did. This intermediate use of string built-in functions was missing
between the first string-function and RE versions of code and imho it
is not letting the readers see that string-functions are even more
powerful than the reader is lead to believe and that REs are pushed
more towards edge cases than the impression the reader seems to be
left with which is to use REs more.

At least if you push REs inform the readers where to get the a RE GUI
builder written in Python so they can build and *test* the complex and
unwieldy REs to perform anything beyond the basic pattern searches.

Cheers,
PN
--
http://mail.python.org/mailman/listinfo/python-list


Re: SHA1withRSA in python

2008-11-11 Thread Python Nutter
For simple hashing algorithms, then use the aformentioned built in
hashlib in Python.

However for the rest you need M2Crypto to get a wrapper around OpenSSL:

M2Crypto is the most complete Python wrapper for OpenSSL featuring
RSA, DSA, DH, HMACs, message digests, symmetric ciphers (including
AES); SSL functionality to implement clients and servers; HTTPS
extensions to Python's httplib, urllib, and xmlrpclib; unforgeable
HMAC'ing AuthCookies for web session management; FTP/TLS client and
server; S/MIME; ZServerSSL: A HTTPS server for Zope and ZSmime: An
S/MIME messenger for Zope. M2Crypto can also be used to provide SSL
for Twisted.

http://chandlerproject.org/Projects/MeTooCrypto


Cheers,
PN

2008/11/12 Mailing List SVR [EMAIL PROTECTED]:
 Hi all,

 in java there are several libraries for sha1withrsa, there is something
 similar in python?

 thanks
 Nicola

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

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


Python on iPhone actually rather good

2008-11-04 Thread Python Nutter
Mini install guide for python on the iPhone:

Cydia = Install SSH helps make initial configuration easier until you
get used to MobileTerminal
Cydia = Install MobileTerminal (closest to a bash shell you get on
your iPhone currently)
Cydia = Install Finder (graphical alternative to using
SSH/MobileTerminal for setting permissions, navigating file system,
moving/copying files, etc.)
Cydia = Install Python (currently installs CPython 2.5.1)
Cydia = Install PyObjC (this is your hook into iPhone API)
Cydia = Install Setuptools (currently install 0.6c7)
Cydia = Install iPhone/Python (examples, the hello world is a PyObjC
call into the iPhone API to load and scroll the contacts list in the
phone)

Not much left to have a fast running python implementation in your
pocket except IMHO ipython. Now that you have Setuptools installed,
you can run easy_install directly on your iPhone and download iPython
over the air.

The iPhone OS X architecture is of course a BSD Unix Userland
environment so you should feel right at home.

The two accounts, root and mobile both share the same default password
'alpine'. So once you setup your phone I recommend you change the
password for each account right away just to secure your phone a
little more. Root you won't need, Mobile is what the default account
is on the current iPhone OS implementation for the standard user
(you).

Easiest way to access your phone is SSH from your Mac, Linux, or
Windows box. (or just use MobileTerminal.app on the iphone directly
keeping in mind you will default to the mobile account in the shell)
Simply join your iPhone over wifi to your wireless access point or
ad-hoc-network, and display your iPhone's ip address. Now you are
ready to ssh into it.
$ssh root@your iphones ip address
password: alpine
$chpass
change your password for root
while you are here might as well install ipython
$easy_install ipython
$exit

now same for mobile
$ssh root@your iphone ip address
password: alpine
$chpass
change your password for mobile

$ipython
test your ipython if it loads, yes? good. now just exit()

$cd .ipython
$nano ipy_user_conf.py
or vi or emac or whatever you like, its easier for beginners to try nano

CTRL+W (find)
Where: #import ipy_editors
Now for those who are following along using MobileTerminal.app here
is a quick guesture routine
 Single Tap screen to bring up a quick tap box grid of common unix
commands that get pasted when selected into the shell
 Double Tap screen to hide the onscreen keyboard and see the full screen.
 Drag Top left downward diagonally to right for CTRL
 Drag Top right downward diagonally to left for TAB -- good for tab
completion in the bash shell

ok back to editing ipy_user_conf.py
Delete the # comment character

Scroll down MobileTerminal.app users just drag up, down, left, or
right quickly for cursor movement

Add your new line below the text # Or roll your own
ipy_editors.install_editors(nano +$line $file)

CTRL+X (exit)
Y to save

Now test your ipython link to nano editor
$ipython
In [1]: edit test.py
nano should now launch and you can edit your python script on your
iPhone directly, when you save it, iPython will execute the python
code
In [2]: exit()
$cat test.py
your code should display, good now we are done
$rm test.py remove our test file

Its up to you where you want to save your python scripts. I would
suggest in Documents under your account (mobile).
for example launch MobileTermina.app
$cd ~
$cd D* or just D and try the tab completion gesture Top right
drag diagonally down to left
$mkdir python or whatever you want to call your directory


What is missing? Tkinter, iPhone uses its own API, Desktop Manager
(Springboard), etc.
What is different? PyObjC, this is where you get to use those iPhone
API calls from within your python script on the iPhone including GUI
API calls.

Now you have Python in your Pocket that you can take anywhere and whip
it out anytime the Python bug hits you and you want to work on some
code.

You can use SSH to move/copy/sync your files to your desktop.
Or other ways: AirSharing app over wifi, etc.

I'll be giving iPhone Python 2.5.1 a workout on on of Mark Lutz's
books and report any more gotchas that I come across.

Cheers,
PN
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python certification

2008-10-19 Thread Python Nutter
Yeah. The day Python goes Certification required to get a job is the day I
quit Python forever and move on to another language.

Certification prooves you're an idiot who needs to spend money to work
for another idiot who doesn't know enough about programming to know if
they hire competent programmers and need an idiot paper to make them
feel better and sleep better at night.

2008/10/18 Lawrence D'Oliveiro [EMAIL PROTECTED]:
 In message [EMAIL PROTECTED], Ben Finney wrote:

 srinivasan srinivas [EMAIL PROTECTED] writes:

 I m planning to do certification in Python??

 Why the question marks? Are you asking us whether this is true?

 Perhaps he's one of those people who end sentences with a rising inflection?
 Found among Australasians, possibly elsewhere?
 --
 http://mail.python.org/mailman/listinfo/python-list

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


Re: Python for the iPhone?

2008-09-18 Thread Python Nutter
Yes it does involve Jailbreaking.

Python
GCC
Java
and Ruby

are all available to run on the iPhone after you Jailbreak it.

Just run the Cydia appliacation (jailbreak's AppStore) to install
anything you want.

For me I have not installed Python (yet). Jailbreak was only to tether
iPhone to my Macbook since I've moved house and living out of a hotel
until move into my next house. I would never have jailbroken if Apple
did not killswitch the NetShare application. Tethering is 100% legal
in my country and Apple just lost me in only 2 weeks of iPhone
ownership.

Cydia - OpenSSH.
Then I just reverse ssh socks proxied into my iPhone and shazam.
Internet access here I am. (Downloading all my Mac updates as I type).

Cheers,
PN

On 17/09/2008, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Anybody tried this port of Python to the iPhone?

 http://www.modmyi.com/nativeapps/python-v251/
 http://iphone.natetrue.com/

 Hasn't been updated since July 2007.  Maybe just a proof-of-concept?  I'm
 guessing it involves jailbreaking the phone.

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

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


Re: An FTP Client...My first real program!

2008-08-13 Thread Python Nutter
ery low level and not very useful for beginners as a lot of the heavy
lifting and management is still left up to you, the programmer.

The module ftputil is a high-level interface to the ftplib module. The
FTPHost objects generated from it allow many operations similar to
those of os and os.path. An example:

# download some files from the login directory
host = ftputil.FTPHost('ftp.domain.com', 'user', 'secret')
names = host.listdir(host.curdir)
for name in names:
   if host.path.isfile(name):
   host.download(name, name, 'b')  # remote, local, binary mode
# make a new directory and copy a remote file into it
host.mkdir('newdir')
source = host.file('index.html', 'r')  # file-like object
target = host.file('newdir/index.html', 'w')  # file-like object
host.copyfileobj(source, target)  # similar to shutil.copyfileobj
source.close()
target.close()


Now if you are again purely in it for a challenge or for and
educational roller coaster ride, ignore the suggestion to look at
higher level ftp modules =)

Cheers,
PN
--
http://mail.python.org/mailman/listinfo/python-list


Re: An FTP Client...My first real program!

2008-08-13 Thread Python Nutter
sorry cut off due to original email being sent not to the list due to gmail:

A second for that suggestion--the ftp module in the python standard library is
very low level and not very useful for beginners as a lot of the heavy
lifting and management is still left up to you, the programmer.

2008/8/14 Python Nutter [EMAIL PROTECTED]:
 ery low level and not very useful for beginners as a lot of the heavy
 lifting and management is still left up to you, the programmer.

 The module ftputil is a high-level interface to the ftplib module. The
 FTPHost objects generated from it allow many operations similar to
 those of os and os.path. An example:

 # download some files from the login directory
 host = ftputil.FTPHost('ftp.domain.com', 'user', 'secret')
 names = host.listdir(host.curdir)
 for name in names:
   if host.path.isfile(name):
   host.download(name, name, 'b')  # remote, local, binary mode
 # make a new directory and copy a remote file into it
 host.mkdir('newdir')
 source = host.file('index.html', 'r')  # file-like object
 target = host.file('newdir/index.html', 'w')  # file-like object
 host.copyfileobj(source, target)  # similar to shutil.copyfileobj
 source.close()
 target.close()


 Now if you are again purely in it for a challenge or for and
 educational roller coaster ride, ignore the suggestion to look at
 higher level ftp modules =)

 Cheers,
 PN

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


Re: Any Game Developers here?

2008-07-19 Thread Python Nutter
I used to use PyGame but the horrible delay waiting for OS X binaries
put me off.

I now use Pyglet extensively, and combine Pyglet + Rabbyt to get
amazing sprite handling speeds.

Pyglet/Rabbyt make use of OpenGL which comes installed on all the
major systems out there.

PyGame requires the installation of the SDL library to work so is a
lot larger installation requirement.

There are two books I know of currently in print on game programming,
both use PyGame as it was out first. One book is horrible and only
worth for cleaning yourself up after you use the bathroom. The second
is really well written (The L express game programming book) and
highly recommended if you need to get some basic game design and
programming under your belt in Python.

That said its stupidly easy to port examples to work on Pyglet/Rabbyt
so you won't do yourself a dis-service if you want to buy the book but
want to develop later in Pyglet/Rabbyt.

Cheers,
PN

P.S. Since you've likely found Pyglet and PyGame already, the only
other reference URL you need is for Rabbyt so go here for that:
http://matthewmarshall.org/projects/rabbyt/


2008/7/19 Michael Lubker [EMAIL PROTECTED]:
 Any people that use Python as the predominant language for their game
 development here?

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

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


Re: Any Game Developers here?

2008-07-19 Thread Python Nutter
PS. To see some real games developed under pressure/time constraints
in Python you should visit PyWeek to see what individuals and teams
can create in only a weeks time!

http://pyweek.org/


2008/7/19 Michael Lubker [EMAIL PROTECTED]:
 Any people that use Python as the predominant language for their game
 development here?

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

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


Re: Best Python packages?

2008-07-19 Thread Python Nutter
I think the hidden gems in multimedia/game production are Pyglet and
Rabbyt. Whereas PyGame is the older api, its large and bloated and has
of course a heavy dependency on SDL. Pyglet and Rabbyt are
lightweight, efficient, have some amazing functions and hit native
OpenGL in all the major OS distributions and Bruce The Presentation
Tool utilizes the former to take on MS PowerPoint to show what you can
do besides games =)

Pyglet: http://pyglet.org/
Rabbyt: http://matthewmarshall.org/projects/rabbyt/
Bruce The Presentation Tool: http://code.google.com/p/bruce-tpt/

Cheers,
PN


 In the original post you asked for hidden gems and now it seems you
 just want to know about Madonna or Justin Timberlake.

 Maybe a look on this collection helps

 http://wiki.python.org/moin/UsefulModules
 --
 http://mail.python.org/mailman/listinfo/python-list

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


ANN: Mac OS X versions of Rabbyt 0.81 - A fast 2D sprite engine using OpenGL

2008-07-10 Thread Python Nutter
Just a quick announcement,

I have supplied PPC and Intel compiled eggs for the Rabbyt libary on Pypi

http://pypi.python.org/pypi/Rabbyt/

Rabbyt-0.8.1-py2.5-macosx-10.3-ppc.egg (md5)
Built on OS X 10.5.4 for PowerPC equipped Macs

Rabbyt-0.8.1-py2.5-macosx-10.3-i386.egg (md5)
Built on OS X 10.5.4 for Intel equipped Macs


If you know anything about Rabbyt or want to run any of the Rabbyt +
pyglet tutorials or demonstration programs, you can now easily install
it onto your Mac.

Cheers,
PN
--
http://mail.python.org/mailman/listinfo/python-list


Re: Freesoftware for auto/intelligent code completing in Python

2008-07-03 Thread Python Nutter
If you guys can get your head out of IDE land, you'll find iPython
does a fantastic job at introspection and Auto-completion, you can
launch shell commands and editors and when done saving be back in the
iPython shell, save memory/variable space to disk so you can come back
the next day and continue off where you were. It puts IDEs to shame.

If you can't get your Windows-centric IDE need eliminated, then Wing
IDE 101 will not auto-complete, its been deliberately disabled to
force students (hence 101) to memorize python/function names.

Komodo Edit is a free download and will Auto-complete.

Cheers,
PN
--
http://mail.python.org/mailman/listinfo/python-list


Re: Programming question

2008-06-11 Thread Python Nutter
2008/6/12 Brad Navarro [EMAIL PROTECTED]:
 Basically, what I am trying to do is get a list of each file's attributes
 within a directory. Basically, the information that the 'ls –l' command


Python For System Administrators:
http://www.ibm.com/developerworks/aix/library/au-python/


handy to also just search on python in IBM's Developer Works to get
all the juicy goodies =)

Cheers,
PN
--
http://mail.python.org/mailman/listinfo/python-list