473,320 Members | 2,122 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Python capability do like plugins ?

example :
/home/test/plugins
a.py
b.py
c.py

main program can dynamic import plugins directory's files....not normal
¡uimport¡v
like winamp
Jul 18 '05 #1
4 1093
Leon <sq**********@yahoo.com.tw> wrote:
example :
/home/test/plugins
a.py
b.py
c.py

main program can dynamic import plugins directory's files....not normal
¡uimport¡v
like winamp


The main program can insert the plugins directory into sys.path and
import at will (e.g with __import__) or do it with the imp module or in
several other ways. There's a number of recipes in the cookbook...
Alex
Jul 18 '05 #2
Thanks.....
I use a simple method...

sys.commands module --> get file list
re module --> filter file name and path
imp module --> load module
getattr() --> get varabiles

because none dll for unix, I don't know how to use *.pyd
and how to make *.pyd from *.py
"Alex Martelli" <al*****@yahoo.com>
???????:1glurfj.zi6798qu4p2fN%al*****@yahoo.com...
Leon <sq**********@yahoo.com.tw> wrote:
example :
/home/test/plugins
a.py
b.py
c.py

main program can dynamic import plugins directory's files....not normal
¡uimport¡v
like winamp


The main program can insert the plugins directory into sys.path and
import at will (e.g with __import__) or do it with the imp module or in
several other ways. There's a number of recipes in the cookbook...
Alex

Jul 18 '05 #3
Leon <sq**********@yahoo.com.tw> wrote:
Thanks.....
I use a simple method...

sys.commands module --> get file list
re module --> filter file name and path
imp module --> load module
getattr() --> get varabiles

because none dll for unix, I don't know how to use *.pyd
and how to make *.pyd from *.py


Not sure what you mean by "because none dll for unix". A *.pyd on
Windows is a DLL (meant for Python extension); you cannot make it from a
*.py, you make it from a *.c or the like. Equivalent on different Unix
variants are *.so, *.dynlib, and others yet.
Alex
Jul 18 '05 #4
Thank you very much,help me understand it ^_^
Now,I only use it (simple soluation). if other better soluation when modify
it
"Alex Martelli" <al*****@yahoo.com> ¼¶¼g©ó¶l¥ó·s»D
:1glwgve.20tqi2sdvlc0N%al*****@yahoo.com...
Leon <sq**********@yahoo.com.tw> wrote:
Thanks.....
I use a simple method...

sys.commands module --> get file list
re module --> filter file name and path
imp module --> load module
getattr() --> get varabiles

because none dll for unix, I don't know how to use *.pyd
and how to make *.pyd from *.py


Not sure what you mean by "because none dll for unix". A *.pyd on
Windows is a DLL (meant for Python extension); you cannot make it from a
*.py, you make it from a *.c or the like. Equivalent on different Unix
variants are *.so, *.dynlib, and others yet.
Alex

Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

50
by: Edward K. Ream | last post by:
I would like to say a few (actually more than a few) words here about some recent discoveries I have made concerning the interaction of Leo and Python. If you don't want to hear an inventor enthuse...
2
by: marco | last post by:
Hi, first of all ; sorry for my poor english ; i'm french ... and i hope you can understand below I use python (and wxpython) on a win32 platform, to build a simple "home theater pc". I want...
1
by: dgiagio | last post by:
Hi, I'm developing an application using the C language and Python for it's plugins. The C program connects to a MySQL database and keeps that connection active. Is it possible to 'share' this...
267
by: Xah Lee | last post by:
Python, Lambda, and Guido van Rossum Xah Lee, 2006-05-05 In this post, i'd like to deconstruct one of Guido's recent blog about lambda in Python. In Guido's blog written in 2006-02-10 at...
0
by: sleem | last post by:
Hi. I'm hacking up an irc bot in python using Joel Rosdahl's irclib. I want to be able to add plugins to my bot, without having to restart it. In specific, I would have a directory called...
5
by: Laszlo Nagy | last post by:
Hello, I was trying to get answers for these. SPE homepage was down. Then I found it on berlios (http://developer.berlios.de/forum/forum.php?forum_id=12695) but no one answered since 5 days. In...
22
by: Wildemar Wildenburger | last post by:
To make it short: Is there something like this already? There seem to loads of python frameworks for Web-Apps, but I have a hard time finding one for desktop-apps. I imagine it wouldn't be too...
7
by: yomgui | last post by:
Hi, Eclipse is just not really working on linux 64 bit (I tried ubuntu and centos, it is freesing and crashing and extremly slow) I use eclipse for python and cvs, what is "the" good...
7
by: Anthony | last post by:
Hi, I'm a FoxPro programmer, but I want to learn python before it's too late. I do a lot of statistical programming, so I import SPSS into python. In my opinion, the best features of Visual...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.