[Tutor] need help for using ssl in python

2006-11-14 Thread Akanksha Govil
Hi,I need to create an ssl socket. But i am getting the folowing error:Traceback (most recent call last):  File "client-Nextone.py", line 35, in ?    resp = port.editCallPlanConfig(req)  File "/home/nabanita/new_soap_zsi/NexToneSubnet_services.py", line 38, in editCallPlanConfig    self.binding.Send(None, None, request, soapaction="setCallPlanConfig", **kw)  File "/usr/local/lib/python2.4/site-packages/ZSI/client.py", line 266, in Send    self.h.connect()  File "/usr/local/lib/python2.4/httplib.py", line 1073, in connect    ssl = socket.ssl(sock, self.key_file, self.cert_file)AttributeError: 'module' object has no attribute 'ssl'I have installed OpenSSL/ module for python 2.4 and also openssl-0.9.7d-15.15.3 python-openssl-0.6-2.1 openssl-devel-0.9.7d-25.1  Please help.Akanksha 


Everyone is raving about the all-new Yahoo! Mail beta.___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] free IDE for Python?

2006-11-14 Thread Basil Shubin
Vadhri, Srinivas пишет:
> Hi
> 
>  
> 
> A newbie to Python. What is the free IDE for Python development 
> activities? ActiveState’s Komodo IDE needs a license and a fee.
> 
>  
> 
> Any recommendations?

You can look at GNU Emacs + python-mode or even try out ECB (Emacs Code 
Browser - IDE for Emacs)

-- 
Basil Shubin
Freelance Software Developer
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] free IDE for Python?

2006-11-14 Thread Tim Johnson
* Matthew Gordon <[EMAIL PROTECTED]> [061113 14:54]:
> agreed. if you plan on programming in a few different languages, i
> would suggest picking up vim, emacs, or another multi-language
> environment. you can get a plugin (at least for emacs) that highlights
> syntax, indents, etc.
 
  I've used vim in the past for python and recommend it for ease of
  use and support. I also use emacs, which may be found harder to
  learn but has the advantage of being able to evaluate code directly
  in the editor.
  tim

> - matt
> 
> 
> On 11/13/06, Mike Hansen <[EMAIL PROTECTED]> wrote:
> >
> >
> > > -Original Message-
> > > From: [EMAIL PROTECTED]
> > > [mailto:[EMAIL PROTECTED] On Behalf Of Vadhri, Srinivas
> > > Sent: Monday, November 13, 2006 4:03 PM
> > > To: tutor@python.org
> > > Subject: [Tutor] free IDE for Python?
> > >
> > > Hi
> > >
> > >
> > >
> > > A newbie to Python. What is the free IDE for Python
> > > development activities? ActiveState's Komodo IDE needs a
> > > license and a fee.
> > >
> > >
> > >
> > > Any recommendations?
> > >
> > >
> > >
> > > Regards,
> > >
> > > Srinivas Vadhri
> > >
> >
> > http://www.python.org/infogami-faq/tutor/tutor-whats-the-best-editor-ide
> > -for-python/
> >
> > Or tinyurl ..http://tinyurl.com/yxjxgc
> >
> > I use VIM. I've been experimenting with Eclipse and Pydev. You'll get
> > almost as many answers as there are people on this list.
> >
> > Mike
> >
> >
> > -
> >
> >   NOTICE:  This e-mail transmission and any documents or files attached to
> >   it contain information for the sole use of the above-identified 
> > individual or entity.
> >
> >   Its contents may be privileged, confidential, and exempt from disclosure 
> > under the law.
> >   Any dissemination, distribution, or copying of this communication is 
> > strictly prohibited.
> >
> >   Please notify the sender immediately if you are not the intended 
> > recipient.
> >
> > FGNS
> >
> >
> > ___
> > Tutor maillist  -  Tutor@python.org
> > http://mail.python.org/mailman/listinfo/tutor
> >
> >
> >
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor

-- 
Tim Johnson <[EMAIL PROTECTED]>
  http://www.alaska-internet-solutions.com
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] free IDE for Python?

2006-11-14 Thread wesley chun
> A newbie to Python. What is the free IDE for Python development activities?
> ActiveState's Komodo IDE needs a license and a fee.

lifting this list straight out of Core Python (and removing the
commercial ones):

Open Source
===
IDLE (comes with Python distribution)
http://www.python.org/idle/
Stani's Python Editor (wxWindows-based)
http://pythonide.stani.be/
PythonWin + Win32 Extensions
http://starship.python.net/crew/skippy/win32/
IDE Studio (IDLE+more)
http://starship.python.net/crew/mike/Idle/
Eclipse
http://pydev.sourceforge.net
http://www.eclipse.org/

General overall IDE list

http://wiki.python.org/moin/IntegratedDevelopmentEnvironments

of course, this is all in addition to vi(m) and emacs.  :-)

good luck!
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] free IDE for Python?

2006-11-14 Thread Richard Querin
On 11/14/06, Tim Johnson <[EMAIL PROTECTED]> wrote:
  I've used vim in the past for python and recommend it for ease of  use and support. I also use emacs, which may be found harder to  learn but has the advantage of being able to evaluate code directly  in the editor.
  timI have to chuckle when you recommend Vim for ease of use. Now don't start flaming me quite yet. I'm a big fan of Vim and I'm in the midst of learning it myself. I think it's a very powerful editor and I like it a lot. But recommending it for ease of use might be a little stretch. It's like a lot of things, the higher learning curve ultimately gets you greater rewards. 

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] review of beginner's code requested

2006-11-14 Thread James Cunningham
Hello.
I'm new to Python; for a project to get to know the language I wrote up an api for representing finite topologies, and for subsets of topologies for which the orbit (the number of ways to use closure, interior, and complement operators to get separate sets) is fourteen.
It can be used like this:
some_set = [[1, 2, 3], [1, 2], [2, 3], [1, 3], [1], [2], [3], []]a = FiniteTopology(some_set, [1, 2, 3])
...
With all attendant methods. The constructor will take a list of lists or a set of sets.
orbits_of_fourteen(8)
will generate all topologies on subsets of [1, 2, 3, 4, 5, 6, 7, 8], and look for subsets of those topologies whose orbits are of length fourteen. (It will also never end. I wouldn't recommend trying that; I put it in as an exercise.)
One thing I'm not sure of: if the user tries to create a FiniteTopology with a collection of sets that's not a topology, I throw a NotATopologyError in the constructor. But it looks like the FiniteTopology instance is still created. Is there any way to keep the instance from being created at all?
I'm also interested in tips about documentation and style.
Thanks a lot!
Best,James
#!/usr/bin/env python
class NotATopologyError(Exception):
    passclass FiniteTopology(object):
    """This represents a finite topology on a set of elements that can be    represented by Python's builtin set class. Its representation is of a set
    of frozensets, but its constructor will take a list of lists; let it be
    stressed that the elements on which the topology is defined must be    immutable."""
    def __init__(self, topology, main_set):        """Creates an instance of FiniteTopology, checking first to make sure
        that it *is* a topology. If it isn't, we raise a NotATopology        exception."""
        self.topology = set([frozenset(element) for element in topology])
        self.main_set = set(main_set)
        if not self._is_a_topology():            raise NotATopologyError()
    def get_topology(self):        return self.topology
    def _is_a_topology(self):        """Checks if self.topology
 is a topology."""        check_one = self._check_contains_empty_main()
        check_two = self._check_unions()        check_three = self._check_intersections()
        return check_one and check_two and check_three
    def _check_contains_empty_main(self):
        """A topology contains its set and the empty set."""
        return self.main_set in self.topology and set([]) in self.topology
    def _check_unions(self):        """A topology contains all unions of open sets."""
        for i in xrange(1, len(self.topology) + 1):            for subset in combinations(self.as_list(), i):
                current_union = set()                for one_set in subset:
                    current_union = current_union.union(one_set)                if not current_union in self.topology:
                    return False        return True
    def _check_intersections(self):        """A topology contains all pairwise intersections of open sets."""
        for item in self.topology:            for next_item in self.topology
:                intersect = set(item).intersection(next_item)                if not intersect in 
self.topology:                    return False        return True
    def as_list(self):        """Returns a list representation of the topology."""
        return [[i for i in j] for j in self.topology]
    def orbit(self, subset):        """Calculates the maximum number of ways we can use take complements,
        interiors, and closures of a set to make unique sets. There are at        most 14 ways to do this, and usually less."""
        orbit = set()
        complement = self.complement        closure = self.closure        interior = 
self.interior        orbit.add(frozenset(subset))
        orbit.add(frozenset(complement(subset)))        orbit.add(frozenset(complement(interior(subset
        orbit.add(frozenset(complement(interior(complement(subset)        
orbit.add(frozenset(complement(interior(complement(closure(subset))        orbit.add(frozenset(interior(subset)))
        orbit.add(frozenset(interior(closure(subset        orbit.add(frozenset(interior(complement(subset
        orbit.add(frozenset(interior(complement(interior(subset)        orbit.add(frozenset(interior(closure(interior(subset)
        orbit.add(frozenset(interior(closure(interior(complement(subset))        orbit.add(frozenset(closure(subset)))
        orbit.add(frozenset(closure(interior(subset        orbit.add(frozenset(closure(interior(complement(subset)
        return orbit
    def closure(self, subset):        """A limit point p of a set X is such that all open sets containing p
        contain another point of X not equal to p. The closure of a set is the        set plus all of its limit points.
        This finds all of the limit points of the subset and adds them."""
        subset = set(subset)        set_of_lps = set()
        for maybe_lp in self.m

Re: [Tutor] free IDE for Python?

2006-11-14 Thread William O'Higgins Witteman
On Tue, Nov 14, 2006 at 12:28:02PM -0500, Richard Querin wrote:
>   On 11/14/06, Tim Johnson <[EMAIL PROTECTED]> wrote:
>
>   I've used vim in the past for python and recommend it for ease of
>   use and support. I also use emacs, which may be found harder to
>
>   I have to chuckle when you recommend Vim for ease of use. Now don't start
>   flaming me quite yet. I'm a big fan of Vim and I'm in the midst of
>   learning it myself. I think it's a very powerful editor and I like it a
>   lot. But recommending it for ease of use might be a little stretch. It's
>   like a lot of things, the higher learning curve ultimately gets you
>   greater rewards.

Using vim is like riding a bicycle - it's hard to learn, but once you
get it, it becomes automatic and can make you intolerant of walking (...
everything ... is taking ... so ... long ...) :-)
-- 

yours,

William
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] sleep command in python?

2006-11-14 Thread paulino1
Is there a "sleep" command in python like the bash's sleep?
___

O SAPO já está livre de vírus com a Panda Software, fique você também!
Clique em: http://antivirus.sapo.pt

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] sleep command in python?

2006-11-14 Thread Andreas Kostyrka
* [EMAIL PROTECTED] <[EMAIL PROTECTED]> [061114 20:07]:
> Is there a "sleep" command in python like the bash's sleep?
import time

time.sleep(0.5)

Andreas
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] sleep command in python?

2006-11-14 Thread Bob Gailer
[EMAIL PROTECTED] wrote:
> Is there a "sleep" command in python like the bash's sleep?
import time
time.sleep(secs)
"Suspend execution for the given number of seconds. The argument may be 
a floating point number to indicate a more precise sleep time. The 
actual suspension time may be less than that requested because any 
caught signal will terminate the sleep() following execution of that 
signal's catching routine. Also, the suspension time may be longer than 
requested by an arbitrary amount because of the scheduling of other 
activity in the system."

-- 
Bob Gailer
510-978-4454

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] sleep command in python?

2006-11-14 Thread Kent Johnson
[EMAIL PROTECTED] wrote:
> Is there a "sleep" command in python like the bash's sleep?

time.sleep()
http://docs.python.org/lib/module-time.html

Kent

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Alternatives to PY2EXE

2006-11-14 Thread Etrade Griffiths
Hi

just finished developing my first app with wxPython and matplotlib and now 
trying to create an EXE file using PY2EXE for distribution.  However, this 
is proving to be an extremely frustrating experience and I am making very 
little progress.  Are there any "simple" alternatives to PY2EXE for 
shipping Python apps to Windows machines?

Thanks

Alun Griffiths


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] free IDE for Python?

2006-11-14 Thread Tim Johnson
* William O'Higgins Witteman <[EMAIL PROTECTED]> [061114 09:05]:
> On Tue, Nov 14, 2006 at 12:28:02PM -0500, Richard Querin wrote:
> >   On 11/14/06, Tim Johnson <[EMAIL PROTECTED]> wrote:
> >
> >   I've used vim in the past for python and recommend it for ease of
> >   use and support. I also use emacs, which may be found harder to
> >
> >   I have to chuckle when you recommend Vim for ease of use. Now don't start
> >   flaming me quite yet. I'm a big fan of Vim and I'm in the midst of
> >   learning it myself. I think it's a very powerful editor and I like it a
> >   lot. But recommending it for ease of use might be a little stretch. It's
> >   like a lot of things, the higher learning curve ultimately gets you
> >   greater rewards.
> 
> Using vim is like riding a bicycle - it's hard to learn, but once you
> get it, it becomes automatic and can make you intolerant of walking (...
> everything ... is taking ... so ... long ...) :-)

   I went from Boxer on windows - nice editor, CUA-style - to vim.
   Getting used the vim 'modal style' seemed exotic, but not 'arcane'.
   Once I got past that, I found vim incredibly nimble.
 
   I found emacs harder to learn than vim. I find that they both
   have their place. 
   
   BTW: vim offers 'hooks' to compile the python editor directly into
   the editor. That's a feature that portends many possibilities.

   tim

> yours,
> 
> William
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor

-- 
Tim Johnson <[EMAIL PROTECTED]>
  http://www.alaska-internet-solutions.com
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Alternatives to PY2EXE

2006-11-14 Thread tomd
I used PyInstaller, it was simple, but the app I used it for was rather simple 
too.

http://pyinstaller.hpcf.upr.edu/

-- 
Tom, http://www.vscripts.net/

on Tue, 14 Nov 2006 19:25:17 +, you wrote:
> Are there any "simple" alternatives to PY2EXE for
> shipping Python apps to Windows machines?
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] removing an image from a tkinter label

2006-11-14 Thread Orri Ganel




Hello all,

As part of a tkinter program that displays the currently playing
track's information (including artwork) from iTunes, I have a label
with an image in it (the artwork).  However, when the song played
doesn't have artwork, I'd like to remove artwork of the old song and
replace it with the text "No artwork".  However, I can't seem to find a
way to do that.  Short of destroying the label and creating a new one,
is there another way to accomplish this?  The relevant code appears
below.

Thanks in advance,
Orri

-
from Tix import *
from Tkconstants import *
from PIL import Image, ImageTk
import win32com.client, time, os, win32ui, win32con, win32gui

class Application(Frame):

   def createWidgets(self):
   self.artpic = Label(self, fg="white", bg="black")  # creating
the label to begin with
   try:
   self.image = ImageTk.PhotoImage(Image.open("C:\\Documents
and Settings\\Cookie\\Desktop\\temp.jpeg"))
   except:
   self.image = None
   self.artpic["image"] = self.image # adding the image if
there is one
   self.artpic.grid(row=0, column=0)
  ...

   def __init__(self, master=None):
   ...
   try:
   self.art = self.track.Artwork(1)
   except AttributeError:
   self.art = None
   self.newart = True
   if self.art:
   #print "image on opening"
   self.art.SaveArtworkToFile('C:\\Documents and
Settings\\Cookie\\Desktop\\temp.jpeg')
   ...
   self.updateInfo()
   self.waitAndSee()

   def updateInfo(self):
   if self.art and self.newart:
   #print "deleting current artwork, replacing with new artwork"
   self.image = ImageTk.PhotoImage(Image.open("C:\\Documents
and Settings\\Cookie\\Desktop\\temp.jpeg"))
   self.artpic["image"] = self.image
   elif not self.art:
   #print "deleting current artwork"
   self.image = None
          
self.artpic.destroy()     #
is
   self.artpic = Label(self, fg="white", bg="black")   # this
   self.artpic.grid(row=0, column=0)   #
necessary?
   self.artpic["text"] = "No Artwork"
   ...
   self.artpic.update_idletasks()
   ...
   self.master.update()

   def waitAndSee(self):
   while 1:
   if self.iTunes.CurrentTrack.GetITObjectIDs() !=
self.track.GetITObjectIDs():
   self.newart = True
   ...
   self.art = self.track.Artwork(1)
   if self.art:
   #print "saving new artwork"
   self.art.SaveArtworkToFile('C:\\Documents and
Settings\\Cookie\\Desktop\\temp.jpeg')
   else:
   self.newart = False
   self.updateInfo()
   time.sleep(1)

root = Tk()
app = Application(master=root)
app.mainloop()
try:
   root.destroy()
except TclError:
   pass
try:
   os.remove('C:\\Documents and Settings\\Cookie\\Desktop\\temp.jpeg')
except OSError:
   pass




___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] removing an image from a tkinter label

2006-11-14 Thread Orri Ganel

Orri Ganel wrote:


Hello all,

As part of a tkinter program that displays the currently playing 
track's information (including artwork) from iTunes, I have a label 
with an image in it (the artwork).  However, when the song played 
doesn't have artwork, I'd like to remove artwork of the old song and 
replace it with the text "No artwork".  However, I can't seem to find 
a way to do that.  Short of destroying the label and creating a new 
one, is there another way to accomplish this?  The relevant code 
appears below.


Thanks in advance,
Orri


In the end, setting lbl["image"] = "" worked (as opposed to None, which 
raises a TclError with the message that pyimage2 or whatever number of 
pictures had been put in so far didn't exist).  This is a surprisingly 
underdocumented fact, however.  Googling various combinations of 
Tkinter, label, image, and remove, failed to yield a fruitful result 
until the 4th or 5th page of the 5th or so combination.


In any case, thanks for your time.

Orri

begin:vcard
fn:Orri Ganel
n:Ganel;Orri
adr;dom:;;;Columbia;Maryland;21045
email;internet:[EMAIL PROTECTED]
title:Student
version:2.1
end:vcard

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor