Hi,
Using exec or eval ISN'T what should be done ever. When you have
troubles importing you should :
- Add some repository to your sys.path
and/or
- Use the buildin import method
and/or
- Use Mr Eby's Importing module (http://python.org/pypi/Importing)
Regards,
Laurent
hg a écrit :
> Hi,
>
>
Laszlo Nagy wrote:
>
>> Thanks,
>>
>> What I am doing is adding plugin support to PyCrust ... so I'm looking
>> for a mechanism where anyone can develop a plugin and have it loaded by
>> pycrust.
>>
>> the .py was a typo
>>
>>
>> why the "...Have at least an empty plugin/name1/__init__.py file...
> Thanks,
>
> What I am doing is adding plugin support to PyCrust ... so I'm looking for a
> mechanism where anyone can develop a plugin and have it loaded by pycrust.
>
> the .py was a typo
>
>
> why the "...Have at least an empty plugin/name1/__init__.py file..." ?
>
When you do
import plug
Laszlo Nagy wrote:
>
>> .../.../../plugin/name1/name1.py
>>
>> .../.../../plugin/namen/namen.py
>>
>>
>> I block at the beginning and tried this (test.py is a real file)
>>
> s = 'test.py'
> eval ('import ' + s)
>
> import test.py # This is invalid
> import test # Th
hg írta:
> hg wrote:
>
>
>> Hi,
>>
>> I have the following problem.
>>
>> I find in a directory hierarchy some files following a certain sets of
>> rules:
>>
>> .../.../../plugin/name1/name1.py
>>
>> .../.../../plugin/namen/namen.py
>>
>> each file will in turn have a class with the same na
hg wrote:
> Hi,
>
> I have the following problem.
>
> I find in a directory hierarchy some files following a certain sets of
> rules:
>
> .../.../../plugin/name1/name1.py
>
> .../.../../plugin/namen/namen.py
>
> each file will in turn have a class with the same name as the filename
> (min
> .../.../../plugin/name1/name1.py
>
> .../.../../plugin/namen/namen.py
>
>
> I block at the beginning and tried this (test.py is a real file)
>
s = 'test.py'
eval ('import ' + s)
import test.py # This is invalid
import test # This MAY be valid
import name1.name1 #
Hi,
I have the following problem.
I find in a directory hierarchy some files following a certain sets of
rules:
.../.../../plugin/name1/name1.py
.../.../../plugin/namen/namen.py
each file will in turn have a class with the same name as the filename
(minus .py)
I fetch those names in a li