[Bf-python] Blender 2.54 Python API

Campbell Barton ideasman42 at gmail.com
Sun Oct 17 23:10:45 CEST 2010


Would you be able to submit this as a bug report, attaching your
/home/ju/Bureau/test_blender/test_module directory?.
blender overrides the __import__ function so blender text blocks can
be imported and I never tested relative imports with blender before so
possible the problems there.

Indecently, I think the preferred way to override import with C/Python
is import hooks but I didn't look into it since so far our own
__import __ has been working fine.

On Sun, Oct 17, 2010 at 6:57 PM, Revue de Libre <revuedelibre at gmail.com> wrote:
>
> I obtain same result without spaces ( works on console, but not on blender console )
>
> Julien
>
> On Sun, Oct 17, 2010 at 20:24, Martin Poirier <theeth at yahoo.com> wrote:
>>
>> Not sure if that's actually an error, but the Py documentation on relative import doesn't mention that spaces are permitted between the leading dots and the module name.
>>
>> Can you try if changing this:
>>
>> from .. class3 import Class3
>>
>> to this:
>>
>> from ..class3 import Class3
>>
>> changes anything?
>>
>> Martin
>>
>> --- On Sun, 10/17/10, Revue de Libre <revuedelibre at gmail.com> wrote:
>>
>> From: Revue de Libre <revuedelibre at gmail.com>
>> Subject: Re: [Bf-python] Blender 2.54 Python API
>> To: "Blender Foundation Python list" <bf-python at blender.org>, bf-committers at blender.org
>> Received: Sunday, October 17, 2010, 1:41 PM
>>
>> Hello,
>>
>> Here is a way to reproduce my problem ( see tgz in attachment ) with blender console :
>>
>> On my console ( Ubuntu 10.04 ) :
>>
>> $python3.1
>> Python 3.1.2 (r312:79147, Apr 15 2010, 12:35:07)
>> [GCC 4.4.3] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> import sys
>> >>> sys.version_info
>> sys.version_info(major=3, minor=1, micro=2, releaselevel='final', serial=0)
>> >>> sys.path.append('/home/ju/Bureau/test_blender')
>> >>> import test_module
>> >>>
>>
>> --> No error
>>
>>  On blender console ( r32528 ) :
>>
>>  * Python Interactive Console 3.1.2 (r312:79147, Apr 15 2010, 12:51:29)  [GCC 4.4.3] *
>> Command History:  Up/Down Arrow
>> Cursor:           Left/Right Home/End
>> Remove:           Backspace/Delete
>> Execute:          Enter
>> Autocomplete:     Ctrl+Space
>> Ctrl +/-  Wheel:  Zoom
>> Builtin Modules: bpy, bpy.data, bpy.ops, bpy.props, bpy.types, bpy.context, bgl, blf, mathutils, geometry
>>
>>   WARNING!!! Blender 2.5 API is subject to change, see API reference for more info.
>>
>> >>> import sys
>> >>> sys.version_info
>> sys.version_info(major=3, minor=1, micro=2, releaselevel='final', serial=0)
>>
>> >>> sys.path.append('/home/ju/Bureau/test_blender')
>> >>> import test_module
>> Traceback (most recent call last):
>>   File "<blender_console>", line 1, in <module>
>>   File "/home/ju/Bureau/test_blender/test_module/__init__.py", line 1, in <module>
>>     from . class1 import Class1
>>   File "/home/ju/Bureau/test_blender/test_module/class1.py", line 1, in <module>
>>     from . directory1.class2 import Class2
>>   File "/home/ju/Bureau/test_blender/test_module/directory1/class2.py", line 1, in <module>
>>     from .. class3 import Class3
>> ImportError: No module named class3
>>
>> >>>
>>
>> Can anybody tell me if this error can be reproduced -- and how to solve it ?
>>
>> Thanks,
>>
>> Julien
>>
>>
>> On Tue, Oct 12, 2010 at 13:26, Marc Weber <marco-oweber at gmx.de> wrote:
>> > What else can you try?
>> > - use strace grepping for the plugin name to see where the filesystem is being accessed.
>> > - check known env vars such as PYTHON_SITE and PYTHONPATH (but they should
>> >  build up the sys.path)
>> > - check that both python versions are the same. So check against which pythnon
>> >  version blender  was compiled.
>> >
>> > That's all I can help. I'm not a Python guru. If you really can't find a way to
>> > debug it I can try reproducing your bug here on my system.
>> >
>> > Marc Weber
>> > _______________________________________________
>> > Bf-python mailing list
>> > Bf-python at blender.org
>> > http://lists.blender.org/mailman/listinfo/bf-python
>> >
>>
>>
>>
>>
>>
>> -----Inline Attachment Follows-----
>>
>> _______________________________________________
>> Bf-python mailing list
>> Bf-python at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-python
>>
>>
>> _______________________________________________
>> Bf-python mailing list
>> Bf-python at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-python
>>
>
>
>
> --
> Julien DUROURE
>
> 84 chemin de Cailhabat
> 31860 Labarthe Sur Lèze
>
> 06 09 40 42 97
>
>
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://lists.blender.org/mailman/listinfo/bf-python
>



--
- Campbell



More information about the Bf-python mailing list