3

I complied QuantLib in Visual Studio 2017 and built the library under Release x64. Then I installed QuantLib Swig according to the instruction here: https://www.quantlib.org/install/windows-python.shtml

The directories in VS are set as in the screenshot: enter image description here

Then I tested a plain vanilla European option using QuantLib which ran without error:

option = EuropeanOption(PlainVanillaPayoff(Option.Call,100),EuropeanExercise(Date(11,5,2021)))

However I cannot check the variable option in the IDE (I use Spyder) and saw error:

Spyder was unable to retrieve the value of this variable from the console.

The error message was:

cannot pickle 'SwigPyObject' object

I see the value of this variable is EuropeanOption object of QuantLib.QuantLib module.

Version:

Python: 3.8
Quantlib: 1.19
QuantLib-SWIG: 1.19
boost: 1_74_0
Spyder: 4.1.4

Would very much appreciate any help.

Biswajit Chopdar
  • 831
  • 5
  • 12
  • 31
yi_fr
  • 33
  • 1
  • 3

1 Answers1

1

(Spyder maintainer here) Unfortunately not all Python objects can be explored through the Variable explorer. Only those that are picklable can be viewed, and the error message you posted above says EuropeanOption is not.

Furthermore, there's no workaround to avoid this issue because being picklable is a basic property of Python objects, and can't be changed by Spyder.

Carlos Cordoba
  • 33,273
  • 10
  • 95
  • 124
  • Thank you Carlos! This is clear. However is there any other IDE which will allow viewing the objects through variable explorer? – yi_fr Oct 14 '20 at 05:53
  • Not that I know of. However, we plan to improve the implementation of how objects are retrieved in the future, to allow non-picklable objects to be viewed as well. – Carlos Cordoba Oct 14 '20 at 14:21