​It looks like line 2473 triggers a call to __setitem__, which is strange
in it self as it was not done in py2. That call goes into our swig extended
python code which calls _get_parameter_keys. That call triggers a type
miss-match for its self argument. This occurs for example when a class that
are shared pointer stored is not properly marked as being a shared_ptr
class. I see that dolfin::Parameters is indeed marked as being shared ptr
stored, so it might be something else.

You can try adding some print statements for self inside the __getitem__
method in dolfin/swig/parameters/post.i before calling
_get_parameter_keys().

If you want me to check this out, can you please write a simple recipe for
installing py3 alongside py2, I am on vacation and in particular I am in
vacation-not-thinking-mode...

Johan


On Fri, Aug 1, 2014 at 10:45 AM, Martin Sandve Alnæs <[email protected]>
wrote:

> Note that you need the next branches of instant, fiat, ffc and master
> branch of ufl to test Aslaks dolfin branch.
>
> I don't understand what's happening here, this is swig-generated code
> which fails to match the python Parameters object with the C++ Parameters
> type.
>
> Martin
>
>
> On 1 August 2014 10:24, Aslak Bergersen <[email protected]> wrote:
>
>> I'm trying to get dolfin to run with python 3. Previously this summer I
>> have changed ffc, fiat, instant and ufl, which are now included in the
>> master/next branches.
>>
>> Dolfin now builds for python 2 and 3, but for python 3 it fails to import
>> from dolfin. You can find my code her:
>> https://bitbucket.org/aslakbergersen/dolfin/branch/aslakbergersen/topic-prepare-py3
>>
>> '''
>> Traceback (most recent call last):
>>   File "errorcontrol.py", line 26, in <module>
>>     from dolfin import *
>>   File
>> "/home/aslak/Work/FEniCS/install_dir_py3/lib/python3.2/site-packages/dolfin/__init__.py",
>> line 16, in <module>
>>     from . import cpp
>>   File
>> "/home/aslak/Work/FEniCS/install_dir_py3/lib/python3.2/site-packages/dolfin/cpp/__init__.py",
>> line 42, in <module>
>>     exec("from . import %s" % module_name)
>>   File "<string>", line 1, in <module>
>>   File
>> "/home/aslak/Work/FEniCS/install_dir_py3/lib/python3.2/site-packages/dolfin/cpp/common.py",
>> line 2458, in <module>
>>     class Event(object):
>>   File
>> "/home/aslak/Work/FEniCS/install_dir_py3/lib/python3.2/site-packages/dolfin/cpp/common.py",
>> line 2473, in Event
>>     thisown = _swig_property(lambda x: x.this.own(), lambda x, v:
>> x.this.own(v), doc='The membership flag')
>>   File
>> "/home/aslak/Work/FEniCS/install_dir_py3/lib/python3.2/site-packages/dolfin/cpp/common.py",
>> line 2093, in __setitem__
>>     if key not in self._get_parameter_keys():
>> TypeError: in method 'Parameters__get_parameter_keys', argument 1 of type
>> 'dolfin::Parameters const *
>> '''
>>
>> There seems to be an error whith swig and the new C API for python. I'm
>> using python 3.2 and swig 3.0.2. Does anyone have experience with this type
>> of error?
>>
>> --
>> Mvh
>> Aslak Bergersen
>> 993 22 848
>>
>>
>> _______________________________________________
>> fenics mailing list
>> [email protected]
>> http://fenicsproject.org/mailman/listinfo/fenics
>>
>>
>
> _______________________________________________
> fenics mailing list
> [email protected]
> http://fenicsproject.org/mailman/listinfo/fenics
>
>
_______________________________________________
fenics mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics

Reply via email to