How to generate execute file that include enthought.traits.api ,enthought.traits.ui.api ?

Discussion in 'Python' started by ray, Jun 4, 2010.

  1. ray

    ray Guest

    Hi all,
    I code the program that using enthought.traits.api ,
    enthought.traits.ui.api.
    I want to genereate execute file.I try PY2EXE,bb-
    freeze,cx_freeze,Pyinstaller ,but the execute files can not run
    successful.
    The attach file is my source code.
    My environment :
    1.Python 2.6.2
    2. OS platform is MS Windows XP.

    Anybody can share the experience ?

    -Here is my source code:
    from enthought.traits.api import *
    from enthought.traits.ui.api import *
    from enthought.traits.ui.menu import *
    import binhex,binascii,base64



    """ Using Base64 to decode / encode message
    it will depening on your VISA/MCD ,to assemble CVV value
    Author: Ray Yeh 2008/12/02"""

    class Base64(HasTraits):
    option= Enum('D','E')
    card_type=Enum('V','M')
    input_text=Str
    display=Str
    intro= Str
    code_button=Button()
    decode_result=''
    ct_value =Str


    view1=View(Group(Item('option',label='Choice your function,
    [E]Encode, [D]Decode:'),
    Item('card_type',label='Select your CAVV
    [V]isa ,[M]asterCard:'),
    Item('input_text',label='Type your
    message',style='custom'),
    Item('display',style='custom'),
    Group(Item('code_button',label="Encode/
    Decode")),
    label='Test Base64 tools',
    show_border=True
    ),
    kind='live',
    buttons=OKCancelButtons,
    width=800,height=600,
    resizable=True,
    title='Base64 Encoder tool'
    )
    def dec2hex(self,n):
    """return the hexadecimal string representation of integer
    n"""
    return "%X" % n

    def hex2dec(self,s):
    """return the integer value of a hexadecimal string s"""
    return int(s, 16)

    def mcd(self):
    self.ct_value=str(self.hex2dec(self.decode_result[0:2]))
    self.display="----- MasterCard Base64 Decoding message ---\n
    \
    1.Control_type %s \n\
    2.HMAC= %s \n\
    3.ACS identify= %s\n\
    4.Auth-Method= %s \n\
    5.Bin-identify= %s\n\
    6.Transaction-seq=%s\n\
    7.MAC= %s\n\
    8.Expire-date(yymm)= %s\n\
    9.Cvv = %s\n\
    10.Service-Code= %s\n\
    11.Decode message=%s"\
    %(self.decode_result[0:2],self.decode_result[2:18],\
    self.decode_result[18:20],self.decode_result[20:21],\
    self.decode_result[21:22],self.decode_result[22:30],\

    self.decode_result[30:40],self.hex2dec(self.decode_result[26:30]),\

    self.decode_result[31:34],self.decode_result[20:21]+self.ct_value[1:],
    \
    self.decode_result)


    def visa(self):
    self.display= '----- VISA Base64 Decoding message ---\n\
    1.3D Secure Authentication Results Code= %s\n\
    2.Second Factor Authentication Code= %s\n\
    3.CAVV Key Indicator= %s\n\
    4.CVV output= %s\n\
    5.Unpredicactable number=%s\n\
    6.Authencation Tracking Number=%s\n\
    7.Expire-date(yymm)=%s\n\
    8.Cvv = %s\n\
    9.Service-Code=%s\n\
    10.Decode message=%s'\
    %(self.decode_result[0:2],self.decode_result[2:4],\
    self.decode_result[4:6],self.decode_result[6:8],\
    self.decode_result[10:14],self.decode_result[14:30],\
    self.decode_result[10:14],self.decode_result[7:10],\
    self.decode_result[1:4],self.decode_result)


    def _code_button_changed(self):
    if self.option in ['E']:
    self.even=divmod(len(self.input_text),2)
    if self.even[1] <> 0:
    self.display = "Len of Encode message is not EVEN"
    elif self.input_text.isalnum() == False:
    self.display = "Encode message MUST alphanumeric"
    else:

    self.display=binascii.b2a_base64(binascii.a2b_hex(self.input_text))
    elif self.option in ['D']:
    self.even=divmod(len(self.input_text),2)
    if self.even[1] <> 0:
    self.display = "Len of Decode message is not EVEN"
    else:

    self.decode_result=binascii.b2a_hex(binascii.a2b_base64(self.input_text))
    if self.card_type in ['V']:
    self.visa()
    elif self.card_type in ['M']:
    self.mcd()

    if __name__ == '__main__':
    a=Base64()
    a.configure_traits(view='view1')
    ray, Jun 4, 2010
    #1
    1. Advertising

  2. ray

    Robert Kern Guest

    Re: How to generate execute file that include enthought.traits.api, enthought.traits.ui.api ?

    On 6/3/10 10:05 PM, ray wrote:
    > Hi all,
    > I code the program that using enthought.traits.api ,
    > enthought.traits.ui.api.
    > I want to genereate execute file.I try PY2EXE,bb-
    > freeze,cx_freeze,Pyinstaller ,but the execute files can not run
    > successful.
    > The attach file is my source code.
    > My environment :
    > 1.Python 2.6.2
    > 2. OS platform is MS Windows XP.
    >
    > Anybody can share the experience ?


    Our GUI components use some dynamic imports to provide the backend
    implementations. Most of those tools require you to explicitly state some of
    those backend-specific subpackages since they cannot introspect them directly
    from the import statements. Specifically, enthought.traits.ui.wx and
    enthought.pyface.ui.wx (replace "wx" with "qt4" if you are using PyQt). The way
    you do this is different for each tool; you will have to consult its documentation.

    You will want to ask future questions about ETS on our mailing list:

    https://mail.enthought.com/mailman/listinfo/enthought-dev

    --
    Robert Kern

    "I have come to believe that the whole world is an enigma, a harmless enigma
    that is made terrible by our own mad attempt to interpret it as though it had
    an underlying truth."
    -- Umberto Eco
    Robert Kern, Jun 4, 2010
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. eric jones

    ANN: Job Openings at Enthought

    eric jones, May 17, 2004, in forum: Python
    Replies:
    0
    Views:
    322
    eric jones
    May 17, 2004
  2. RMJ

    Enthought Python + Cygwin

    RMJ, Jun 15, 2004, in forum: Python
    Replies:
    3
    Views:
    997
    Jason Tishler
    Jun 16, 2004
  3. Ash

    Enthought python - Traits

    Ash, Oct 12, 2006, in forum: Python
    Replies:
    2
    Views:
    2,781
  4. Andreas Bogenberger
    Replies:
    3
    Views:
    875
    Andreas Bogenberger
    Feb 22, 2008
  5. Replies:
    2
    Views:
    107
Loading...

Share This Page