"Martin v. Löwis" <[EMAIL PROTECTED]> writes:
> Ben Finney schrieb:
> > Question: I have Python modules named without '.py' as the extension,
> > and I'd like to be able to import them. How can I do that?
>
> I recommend to use imp.load_module.
I've tried this; as Patrick Maupin alludes to, it c
Ben Finney schrieb:
> Question: I have Python modules named without '.py' as the extension,
> and I'd like to be able to import them. How can I do that?
I recommend to use imp.load_module.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
Hello Ben,
> Question: I have Python modules named without '.py' as the extension,
> and I'd like to be able to import them. How can I do that?
http://docs.python.org/lib/module-imp.html (hint: load_source :)
HTH,
Miki
http://pythonwise.blogspot.com/
--
http://mail.python.org/mailman/listinfo/p
"Patrick Maupin" <[EMAIL PROTECTED]> writes:
> Ben Finney wrote:
> > Question: I have Python modules named without '.py' as the extension,
> > and I'd like to be able to import them. How can I do that?
>
> This is a piece of cake in Python.
>
> >>> from types import ModuleType
> >>> x = ModuleTy
Ben Finney wrote:
> Howdy all,
>
> Question: I have Python modules named without '.py' as the extension,
> and I'd like to be able to import them. How can I do that?
>
> Background:
>
> On Unix, I write programs intended to be run as commands to a file
> with no extension. This allows other program
Ben Finney wrote:
> Howdy all,
>
> Question: I have Python modules named without '.py' as the extension,
> and I'd like to be able to import them. How can I do that?
This is a piece of cake in Python.
>>> from types import ModuleType
>>> x = ModuleType('myModName')
>>> data = open('myfilename').
"John Machin" <[EMAIL PROTECTED]> writes:
> Ben Finney wrote:
> > "John Machin" <[EMAIL PROTECTED]> writes:
> > > If it can [modify sys.path], it can copy the MUT to some temp
> > > directory, adding .py to the end of the name of the new file,
> > > and put the temp directory in sys.path can'
On Tue, 2006-08-08 at 11:06 +1000, Ben Finney wrote:
> Howdy all,
>
> Question: I have Python modules named without '.py' as the extension,
> and I'd like to be able to import them. How can I do that?
>
> Background:
>
> On Unix, I write programs intended to be run as commands to a file
> with n
Ben Finney wrote:
> "John Machin" <[EMAIL PROTECTED]> writes:
>
> > Ben Finney wrote:
> > > Now that I've got it written as a Python module, I'd like to write
> > > unit tests for that module, which of course will need to import
> > > the program module to test it. The unit test can explicitly add
"John Machin" <[EMAIL PROTECTED]> writes:
> Ben Finney wrote:
> > Now that I've got it written as a Python module, I'd like to write
> > unit tests for that module, which of course will need to import
> > the program module to test it. The unit test can explicitly add
> > the directory where the p
Ben Finney wrote:
> Howdy all,
>
> Question: I have Python modules named without '.py' as the extension,
> and I'd like to be able to import them. How can I do that?
>
> Background:
>
> On Unix, I write programs intended to be run as commands to a file
> with no extension. This allows other progra
Howdy all,
Question: I have Python modules named without '.py' as the extension,
and I'd like to be able to import them. How can I do that?
Background:
On Unix, I write programs intended to be run as commands to a file
with no extension. This allows other programs to use the command as an
interf
12 matches
Mail list logo