Python on the Power PC

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter Milliken

    #1

    Python on the Power PC

    Hi,

    I (think I have :-)) installed Python on my Pocket PC (obtained from
    http://fore.validus.com/~kashtan/).

    There were Tkinter binaries with it so I installed those as well. When I
    attempt to run the most simplistic of python programs using Tkinter, I get
    an error message stating that Python can't find any tkinter module.

    Any ideas what I have done wrong anybody?

    Thanks
    Peter

    import Tkinter

    if __name__ == '__main__':
    root = Tkinter.Tk()

    root.title('Hel lo World?')

    root.mainloop()


  • Fredrik Lundh

    #2
    Re: Python on the Power PC

    Peter Milliken wrote:
    [color=blue]
    > There were Tkinter binaries with it so I installed those as well. When I
    > attempt to run the most simplistic of python programs using Tkinter, I get
    > an error message stating that Python can't find any tkinter module.
    >
    > Any ideas what I have done wrong anybody?[/color]

    what does "import _tkinter" say ?

    where is the _tkinter.so module (or whatever that's called on the pocket pc,
    or power pc, or what it is you're using) installed ? what is sys.path set to ?

    running

    python -vv -c 'import _tkinter'

    might provide you with additional clues.

    </F>



    Comment

    • Steve Holden

      #3
      Re: Python on the Power PC

      Peter Milliken wrote:[color=blue]
      > Hi,
      >
      > I (think I have :-)) installed Python on my Pocket PC (obtained from
      > http://fore.validus.com/~kashtan/).
      >
      > There were Tkinter binaries with it so I installed those as well. When I
      > attempt to run the most simplistic of python programs using Tkinter, I get
      > an error message stating that Python can't find any tkinter module.
      >
      > Any ideas what I have done wrong anybody?
      >
      > Thanks
      > Peter
      >
      > import Tkinter
      >
      > if __name__ == '__main__':
      > root = Tkinter.Tk()
      >
      > root.title('Hel lo World?')
      >
      > root.mainloop()
      >
      >[/color]
      Are you sure it didn't say "_tkinter" was what it couldn't find?

      On my Windows system the Tkinter.py file tries to import an extension
      (compiled C) module called _tkinter (provided as _tkinter.dll) that
      provides the low-level Tkinter functionality. It's likely that that's
      missing.

      regards
      Steve
      --
      Steve Holden +44 150 684 7255 +1 800 494 3119
      Holden Web LLC www.holdenweb.com
      PyCon TX 2006 www.python.org/pycon/

      Comment

      • Peter Milliken

        #4
        Re: Python on the Power PC

        Unfortunately I am completely new to using the Pocket PC - the Python error
        message appear to come up in 2 "waves" or screens - the first screen
        contains the error message re can't find tkinter and is only visible for a
        fraction of a second (repeated running and trying to get the eyes to focus
        on each bit of information is very difficult! :-)) the second screen just
        says

        Traceback (inner most last):
        <NULL> <NULL>

        Unfortunately I can't work out any way to access the first screen to get the
        exact message.

        Also, I don't have any command line interface on the Pocket PC to follow
        Fred's suggestion and run Python with command line arguments set. I seem to
        be limited to just running a .py file from the File Explorer.

        In the "Program Filess\Python\L ib" path there is a _tkinter file but it is a
        ..pyd not a .dll.

        Peter

        "Steve Holden" <steve@holdenwe b.com> wrote in message
        news:mailman.18 25.1128928745.5 09.python-list@python.org ...[color=blue]
        > Peter Milliken wrote:[color=green]
        > > Hi,
        > >
        > > I (think I have :-)) installed Python on my Pocket PC (obtained from
        > > http://fore.validus.com/~kashtan/).
        > >
        > > There were Tkinter binaries with it so I installed those as well. When I
        > > attempt to run the most simplistic of python programs using Tkinter, I[/color][/color]
        get[color=blue][color=green]
        > > an error message stating that Python can't find any tkinter module.
        > >
        > > Any ideas what I have done wrong anybody?
        > >
        > > Thanks
        > > Peter
        > >
        > > import Tkinter
        > >
        > > if __name__ == '__main__':
        > > root = Tkinter.Tk()
        > >
        > > root.title('Hel lo World?')
        > >
        > > root.mainloop()
        > >
        > >[/color]
        > Are you sure it didn't say "_tkinter" was what it couldn't find?
        >
        > On my Windows system the Tkinter.py file tries to import an extension
        > (compiled C) module called _tkinter (provided as _tkinter.dll) that
        > provides the low-level Tkinter functionality. It's likely that that's
        > missing.
        >
        > regards
        > Steve
        > --
        > Steve Holden +44 150 684 7255 +1 800 494 3119
        > Holden Web LLC www.holdenweb.com
        > PyCon TX 2006 www.python.org/pycon/
        >[/color]


        Comment

        • mhykes@gmail.com

          #5
          Re: Python on the Power PC

          I'm using the same distribution (or at least that is what I started
          with). Try using the following sitecustomize.p y file:

          ###### sitecustomize.p y ######
          import sys
          syspath = sys.path
          libpath = '\\Program Files\\Python\\ Lib'
          syspath.append( libpath+'\\lib-tk')
          sys.path = none
          sys.path = syspath
          ############### ###############

          You will need to extract the python23.zip into \Program
          Files\Python\Li b, then add the sitecustomize.p y file to the same
          directory. Then Python should be able to find the Tkinter module that
          it is complaining about.

          - Matt

          Comment

          • Peter Milliken

            #6
            Re: Python on the Power PC

            Thanks for the reply Matt - you must have customised things though from the
            distribution because this can't (and doesn't! :-)) work i.e. I have
            (already) placed the python23.zip into \Program Files\Python\Li b but there
            is no lib-tk off that point (which is what I believe the .append instruction
            does in the customize script).

            In fact, looking at my Python24 installation on my PC, I can see a lib-tk
            directory off c:\Python24\Lib - but there is no such directory on my Pocket
            PC - can I just "copy" this directory directly onto my Pocket PC? <see
            below!>

            OK, copying the lib-tk directory over to my Pocket PC seems to make the file
            work - thanks for the help! :-)

            Peter


            <mhykes@gmail.c om> wrote in message
            news:1129415944 .336861.63730@g 47g2000cwa.goog legroups.com...[color=blue]
            > I'm using the same distribution (or at least that is what I started
            > with). Try using the following sitecustomize.p y file:
            >
            > ###### sitecustomize.p y ######
            > import sys
            > syspath = sys.path
            > libpath = '\\Program Files\\Python\\ Lib'
            > syspath.append( libpath+'\\lib-tk')
            > sys.path = none
            > sys.path = syspath
            > ############### ###############
            >
            > You will need to extract the python23.zip into \Program
            > Files\Python\Li b, then add the sitecustomize.p y file to the same
            > directory. Then Python should be able to find the Tkinter module that
            > it is complaining about.
            >
            > - Matt
            >[/color]


            Comment

            • Peter Milliken

              #7
              Re: Python on the Power PC

              Nope, spoke too soon! The Pocket PC seemed to be doing something and I
              thought it was OK - obviously you can't just copy "lib-tk" into the Pocket
              PC Python\Lib directory.

              What else might I be missing?

              Peter

              "Peter Milliken" <peterm@resmed. com.au> wrote in message
              news:hzB4f.119$ sV4.444@nnrp1.o zemail.com.au.. .[color=blue]
              > Thanks for the reply Matt - you must have customised things though from[/color]
              the[color=blue]
              > distribution because this can't (and doesn't! :-)) work i.e. I have
              > (already) placed the python23.zip into \Program Files\Python\Li b but there
              > is no lib-tk off that point (which is what I believe the .append[/color]
              instruction[color=blue]
              > does in the customize script).
              >
              > In fact, looking at my Python24 installation on my PC, I can see a lib-tk
              > directory off c:\Python24\Lib - but there is no such directory on my[/color]
              Pocket[color=blue]
              > PC - can I just "copy" this directory directly onto my Pocket PC? <see
              > below!>
              >
              > OK, copying the lib-tk directory over to my Pocket PC seems to make the[/color]
              file[color=blue]
              > work - thanks for the help! :-)
              >
              > Peter
              >
              >
              > <mhykes@gmail.c om> wrote in message
              > news:1129415944 .336861.63730@g 47g2000cwa.goog legroups.com...[color=green]
              > > I'm using the same distribution (or at least that is what I started
              > > with). Try using the following sitecustomize.p y file:
              > >
              > > ###### sitecustomize.p y ######
              > > import sys
              > > syspath = sys.path
              > > libpath = '\\Program Files\\Python\\ Lib'
              > > syspath.append( libpath+'\\lib-tk')
              > > sys.path = none
              > > sys.path = syspath
              > > ############### ###############
              > >
              > > You will need to extract the python23.zip into \Program
              > > Files\Python\Li b, then add the sitecustomize.p y file to the same
              > > directory. Then Python should be able to find the Tkinter module that
              > > it is complaining about.
              > >
              > > - Matt
              > >[/color]
              >
              >[/color]


              Comment

              Working...