🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.lang.python
4 messages
4 total messages Started by Lucifer Sat, 28 Dec 2002 20:58
ladowanie pluginow
#461
Author: Lucifer
Date: Sat, 28 Dec 2002 20:58
8 lines
1011 bytes
Z pewnego skryptu musze importowac inny skrypt i wywolac z niego jedna 
funkcje, np cos jak:

from "jakis_plugin" import funkcja
funkcja()

-- 
Lucifer
Re: ladowanie pluginow
#462
Author: Adam Przybyla
Date: Sat, 28 Dec 2002 21:32
29 lines
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
Re: ladowanie pluginow
#463
Author: Adam Karpierz
Date: Sat, 28 Dec 2002 22:41
9 lines
1100 bytes
Uzytkownik "Lucifer" <lucifer@nospan.endeavour.eu.org> napisal:

> from "jakis_plugin" import funkcja
> funkcja()

Przyjrzyj sie funkcji __import__()

--
Adam Karpierz
Re: ladowanie pluginow
#464
Author: Lucifer
Date: Mon, 30 Dec 2002 13:53
4 lines
969 bytes
Lucifer dziekuje za odpowiedzi.

-- 
Lucifer
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads