1

I'm new to Python, happily transitioning from Perl where I rely a lot on Data::Dumper.

I'm trying to get dumper.dump() to dump info on a class from within a script. It works fine from the shell. From within a script, dump() just shows the class name, but no instance data.

In the following, square.py defines the Square class and executes:

s = Square(['color','black'])
dumper.dump(s)

The output is:

$ python3 square.py 
<Square at 7fd1cc5518d0: <__main__.Square object at 0x7fd1cc5518d0>>

dump() doesn't display the instance data passed into the constructor. But it does display instance data in the shell.

I've tried changing instance_dump to 'all' with no success.

I'm using dumper version 1.04 and python 3.4.3.

  • Without seeing your code and shell output it is difficult to find what may cause this. I created a simple class that accepts a list and stores it as instance data on self and `dump()` printed the class name and instance data from both the shell and script. – Noah Dec 13 '15 at 05:52

0 Answers0