Python for Smartcards on Windows XP (Python 2.4)

2007-05-18 Thread Thin Myrna
Dear all

I headed for for a Smartcard lib for Python and found PyCSC. The zipped
sources do not build [1] and the installer (exe file) wants to see a Python
2.5 installation. Does anyone know of an installer for Python 2.4?

Kind regards
Thin Myrna

[1] "python setup.py install" yields 

F:\Software.Python\PyCSC\PyCSC-0.3>python setup.py install
running install
running bdist_egg
running egg_info
writing .\PyCSC.egg-info\PKG-INFO
writing top-level names to .\PyCSC.egg-info\top_level.txt
installing library code to build\bdist.win32\egg
running install_lib
running build_py
running build_ext
error: The .NET Framework SDK needs to be installed before building
extensions for Python.

This is strange, becaus ethere shouldn't be any dep's on .NET. Instead it
should use MSVC6 to compile/link into pycsc.pyd.


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


Re: Why canNOT import from a local directory ?

2007-05-18 Thread Thin Myrna
Jia Lu wrote:

> Hi all
> 
>  I created a folder named *lib* and put a py file *lib.py* in it.
>  In the upper folder I created a py file as:
> 
> 
> import lib.lib
> 
> def main():
> """
> __doc__
> """
> lib.lib.test()
> 
> 
> # 
> if __name__ == "__main__":
> main()
> 
> 
> But I got an error :
> #.:python main.py
> Traceback (most recent call last):
>   File "main.py", line 6, in ?
> import lib.lib
> ImportError: No module named lib.lib
> 
> Why ?

You need to define a file __init__.py in your newly created lib directory.

HTH
Thin

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


Re: wxPython unexpected exit

2007-09-07 Thread Thin Myrna

"Jimmy" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi, wxPython is cool and easy to use, But I ran into a problem
> recently when I try to write a GUI.
> The thing is I want to periodically update the content of StatixText
> object, so after create them, I pack them into a list...the problem
> comes when I later try to extract them from the list! I don't know
> why?
> my code is as following:
>
> import wx, socket
> import thread
>
> class MyFrame(wx.Frame):
>
> firstrun = 0
> def __init__(self):
> wx.Frame.__init__(self, None, -1, 'Notifier')
> self.panel = wx.Panel(self, -1)
> self.length = 50
> self.scale = 0.6
> self.count = 5
> self.size = wx.Frame.GetSize(self)
> self.distance = self.size[1] / self.count
> self.labellist = []
> self.gaugelist = []
>
> def ParseAndDisplay(self, data):
> print "Successful access to main Frame class"
> print 'And receive data: ', data
> if MyFrame.firstrun == 0:
> print 'First time run'
> items = 3
> for i in range(items):
> self.labellist.append(wx.StaticText(self.panel, -1, data+str(i),
> (150, 50+i*20), (300,30)))
> MyFrame.firstrun = 1
> else:
> self.labellist[0].SetLabel('AAA')//PROGRAM WILL ABORT HERE!!!
> self.labellist[1].SetLabel("Guo")
> self.labellist[2].SetLabel("Qiang")
>
>
> class NetUdp:
>
> def __init__(self):
> self.port = 8081
> self.s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
> self.s.bind(("", self.port))
> print "Listening on port", self.port
>
> def recvdata(self):
> data, addr = self.s.recvfrom(1024)
> return data
>
>
> def netThread():
> netudp = NetUdp()
> while True:
> data = netudp.recvdata()
> frame.ParseAndDisplay(data)
>
> if __name__ == '__main__':
> firstrun = 0
> app = wx.PySimpleApp()
> frame = MyFrame()
> frame.Show()
> # start network thread first
> id = thread.start_new_thread(netThread, ())
> # main wxpython loop begins
> app.MainLoop()
>
> I know the code is ugly, but can anyone really save me here!
>

Communication OS thread -> wx has to be done in a certain way. You must not 
do this directly, i.e. you must not call wx code from w/i an OS thread. See 
the wxPython Demo for an example of what you want to do: Process and 
Events -> Threads.

Cheers
Thin


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


Re: Suggested Reading

2007-12-15 Thread Thin Myrna
Benoit wrote:
> I got myself into programming late in the summer and have dabbled in
> python for the most part in that time, recently beginning work on a
> music player.  In January, I start my minor in Information
> Technology.  I'd like to get ahead a bit, however, and over the break
> would like to do some reading. I seek your recommendations in the
> field of database design basics and network programming, with a bias
> towards texts which specifically address Python.  By network
> programming, I mean fundamental understanding of sockets, TCP/UDP,
> right up to HTTP serving, etc.  Thanks ahead of time.

Steve Holden's Python Web Programming might be what you are looking for. 
It covers all the topics needed to deal with sockets, databases, up to 
building complete web apps. One of my books I'd never give away.

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


PyInstaller: Need some hints (perhaps a good example?)

2008-01-02 Thread Thin Myrna
I gave PyInstaller a shot and was pleased by the results so far. The 
usual problems occurred with missing data and icon files (the latter for 
splash screens only). However, it's a bit hard for me to overcome them. 
I tried COLLECT but the files don't seem to be added to the install. The 
reason is most likely, that I dont know, where to put the result of 
COLLECT: Is it pyz, is it exe, or...?

Is anyone willing to post an example or two here, how this is done?

Kind regards
Thin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Py2exe and Multi Treading problem.

2008-03-12 Thread Thin Myrna
Farsheed Ashouri wrote:
> NO it dont work. If I remove threading part, it works like a charm.
> Any Idea?

Of course it does then. Try to join the thread or do something else to 
prevent the non-threading part to exit prematurely.

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


Access to CAN-Bus

2008-06-09 Thread Thin Myrna
I'd like to access some drive hardware via CAN bus from Python under Linux
(sending rec'ing PDOs). Googling around I couldn't find a Python package,
but people who said that they are doing this, though. I guess they are
using their home brewn software. 

Any pointer to 
-  such software (anyone willing to share his experience?)
-  how to write such software?

Under Windows, I guess, I could use some COM or ctypes functionality to
access the hardware vendor's hardware. What if I wanted to access such
hardware from Linux? Is there a package that allows that in a vendor (who
doesn't support Linux) independent way?

Many thanks in advance
Thin



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


Re: Access to CAN-Bus

2008-06-09 Thread Thin Myrna
Thin Myrna wrote:

Thanks for all your answers. 

I've just contacted the vendor for Linux support. If I went for an other
vendor (I'm on a notebook, so USB-hardware is needed): Does anyone have
especially good experiences with a particular one? Anyone I should stay
away from?

Kind regards
Thin 

> I'd like to access some drive hardware via CAN bus from Python under Linux
> (sending rec'ing PDOs). Googling around I couldn't find a Python package,
> but people who said that they are doing this, though. I guess they are
> using their home brewn software.
> 
> Any pointer to
> -  such software (anyone willing to share his experience?)
> -  how to write such software?
> 
> Under Windows, I guess, I could use some COM or ctypes functionality to
> access the hardware vendor's hardware. What if I wanted to access such
> hardware from Linux? Is there a package that allows that in a vendor (who
> doesn't support Linux) independent way?
> 
> Many thanks in advance
> Thin

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


Re: ActiveState Code: the new Python Cookbook site

2008-07-11 Thread Thin Myrna
Trent Mick wrote:

> Stef Mientki wrote:
>> one small remark,
>> If I want to browse 200 recipes, at 10 per page  
>> ... please make something like 100 available per page,
>> are internet is fast enough nowadays.
> 
> Touche. Done:
> 
>http://code.activestate.com/recipes/?paginate_by=100
> 

The old cookbook offered choices by category. Did you drop that feature?

> Cheers,
> Trent
> 

Thin


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


Re: wxPython code giving strange errors.

2008-07-13 Thread Thin Myrna
teh_sAbEr wrote:

> I'm busy trying to learn wxPython, and i'm trying to run the following
> piece of code (its from the wxPyWiki tutorial):
> 
> import wx
> 
> ID_ABOUT = 101
> ID_EXIT = 110
> 
> class MainWindow(wx.Frame):
> def __init__(self,parent,id,title):
> wx.Frame.__init__(self,parent,wx.ID_ANY,title,size=(200,100))
> self.control = wx.TextCtrl(self,1,style=wx.TE_MULTILINE)
> self.CreateStatusBar()
> 
> filemenu = wx.Menu()
> filemenu.Append(ID_ABOUT,"&About"," Information about this
> program.")
> filemenu.AppendSeparator()
> filemenu.Append(ID_EXIT,"E&xit"," Terminate the program.")
> 
> menuBar = wx.MenuBar()
> menuBar.Append(filemenu,"&File")
> self.SetMenuBar(menuBar)
> self.Show(True)
> 
> app = wx.PySimpleApp()
> frame = MainWindow(None, -1, "Sample editor")
> app.MainLoop()
> 
> Simple enough, but every single time I try to run it IDLE gives me
> this instead of the app I was hoping for:
> 
> Traceback (most recent call last):
>   File "C:\Documents and Settings\Enrico Jr\My Documents\Jr's Crap
> \Python Stuff\Batch Picture Converter\main.py", line 24, in 
> frame = MainWindow(None, -1, "Sample editor")
>   File "C:\Documents and Settings\Enrico Jr\My Documents\Jr's Crap
> \Python Stuff\Batch Picture Converter\main.py", line 9, in __init__
> wx.Frame.__init__(self,parent,wx.ID_ANY,title,size=(200,100))
>   File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx
> \_windows.py", line 501, in __init__
> _windows_.Frame_swiginit(self,_windows_.new_Frame(*args,
> **kwargs))
> PyNoAppError: The wx.App object must be created first!
> 
> As far as I can tell, the wx.App object IS being created first. I
> suspect a race condition of some sort here, but can anyone shed some
> light on this?

The main frame has to be created by the app itself, e.g. like so:


class App(wx.App):

   def OnInit(self):

  self._frame = MainFrame( None, -1, _APP_CAPTION)
  self._frame.Show( True)
  self.SetTopWindow( self._frame)
  return True


def Run():
   app = App()
   app.MainLoop()


if __name__ == '__main__':
   Run()


HTH
Thin

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