Article View: pl.comp.lang.python
Article #462Re: ladowanie pluginow
From: Adam Przybyla
Date: Sat, 28 Dec 2002 21:32
Date: Sat, 28 Dec 2002 21:32
29 lines
1931 bytes
1931 bytes
Lucifer <lucifer@nospan.endeavour.eu.org> wrote:
> Z pewnego skryptu musze importowac inny skrypt i wywolac z niego jedna
> funkcje, np cos jak:
> from "jakis_plugin" import funkcja
> funkcja()
... jesli to jest pytanie, to musisz dodac sciezke do twoich
pluginow do sys.path, potem zerknij jak te moduly sa zrobione
i zrob podobnie;-) Zobacz modul dbhash.py z jedna zdefiniowana funkcja:
----------------------------------------------------------------------
"""Provide a (g)dbm-compatible interface to bsdhash.hashopen."""
import sys
try:
import bsddb
except ImportError:
# prevent a second import of this module from spuriously succeeding
del sys.modules[__name__]
raise
__all__ = ["error","open"]
error = bsddb.error # Exported for anydbm
def open(file, flag = 'r', mode=0666):
return bsddb.hashopen(file, flag, mode)
-----------------------------------------------------------------------
Juz chyba wiesz jak dopisac swoje funkcje;-) Z powazaniem
Adam Przybyla
Technical Details
Message-ID:
<aul58r$mlv$1@news.tpi.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!news.icm.edu.pl!news.nask.pl!news.internetia.pl!newsfeed.gazeta.pl!newsfeed.tpinternet.pl!news.tpi.pl!not-for-mailReferences:
<aul38r$9kk$1@news.tpi.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!news.icm.edu.pl!news.nask.pl!news.internetia.pl!newsfeed.gazeta.pl!newsfeed.tpinternet.pl!news.tpi.pl!not-for-mail
From: Adam Przybyla <adam@gliwice.pl>
Newsgroups: pl.comp.lang.python
Subject: Re: ladowanie pluginow
Date: Sat, 28 Dec 2002 21:32:13 +0000 (UTC)
Organization: tp.internet - http://www.tpi.pl/
Lines: 29
Sender: Adam Przybyla <adam@castle.ertel.com.pl>
Message-ID: <aul58r$mlv$1@news.tpi.pl>
References: <aul38r$9kk$1@news.tpi.pl>
NNTP-Posting-Host: castle.ertel.com.pl
X-Trace: news.tpi.pl 1041111133 23231 195.116.54.3 (28 Dec 2002 21:32:13 GMT)
X-Complaints-To: usenet@tpi.pl
NNTP-Posting-Date: Sat, 28 Dec 2002 21:32:13 +0000 (UTC)
User-Agent: tin/1.5.12-20020427 ("Sugar") (UNIX) (Linux/2.4.18 (i686))
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit