probcomp / Venturecxx

Primary implementation of the Venture probabilistic programming system
http://probcomp.csail.mit.edu/venture/
GNU General Public License v3.0
28 stars 6 forks source link

Add missing modification of unicode string value #629

Closed marcoct closed 8 years ago

marcoct commented 8 years ago

Unicode strings passed in expressions to be evaluated were not modified, and resulted in the following exception when the puma backend was used:

*** evaluation: No registered converter was able to produce a C++ rvalue of type std::string from this Python object of type unicode
**************************************************
Stack trace from worker:
**************************************************
Traceback (most recent call last):
  File "/scratch/marcoct/ssifventure_test/env/local/lib/python2.7/site-packages/venture/multiprocess.py", line 104, in wrapped
    res = f(*args, **kwargs)
  File "/scratch/marcoct/ssifventure_test/env/local/lib/python2.7/site-packages/venture/multiprocess.py", line 342, in <lambda>
    return safely(lambda *args,**kwargs: getattr(self.obj, attrname)(*args, **kwargs))
  File "/scratch/marcoct/ssifventure_test/env/local/lib/python2.7/site-packages/venture/engine/trace.py", line 64, in evaluate
    self.trace.eval(baseAddr,exp)
TypeError: No registered converter was able to produce a C++ rvalue of type std::string from this Python object of type unicode

Caused by
No registered converter was able to produce a C++ rvalue of type std::string from this Python object of type unicode
**************************************************
Stack trace from worker:
**************************************************
Traceback (most recent call last):
  File "/scratch/marcoct/ssifventure_test/env/local/lib/python2.7/site-packages/venture/multiprocess.py", line 104, in wrapped
    res = f(*args, **kwargs)
  File "/scratch/marcoct/ssifventure_test/env/local/lib/python2.7/site-packages/venture/multiprocess.py", line 342, in <lambda>
    return safely(lambda *args,**kwargs: getattr(self.obj, attrname)(*args, **kwargs))
  File "/scratch/marcoct/ssifventure_test/env/local/lib/python2.7/site-packages/venture/engine/trace.py", line 64, in evaluate
    self.trace.eval(baseAddr,exp)
TypeError: No registered converter was able to produce a C++ rvalue of type std::string from this Python object of type unicode

The offending element of the expression was a unicode string.