# String Representation of an Object

**URL:** <https://forum.inductiveautomation.com/t/string-representation-of-an-object/34306>\
**Category:** Ignition\
**Created:** [April 29, 2020, 3:05pm UTC](https://forum.inductiveautomation.com/t/string-representation-of-an-object/34306 "2020-04-29T15:05:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dandersen](https://avatars.discourse-cdn.com/v4/letter/d/ecb155/32.png) [@dandersen](https://forum.inductiveautomation.com/u/dandersen)\
**Post date:** [April 29, 2020, 3:05pm UTC](https://forum.inductiveautomation.com/t/string-representation-of-an-object/34306/1 "2020-04-29T15:05:46Z")

</div>

Hit a hiccup with trying to print out an object. Not sure what is going on. The debug below is from the script console.

```auto
from shared.scheduler.model import ScheduleEntry

new = ScheduleEntry(1,2,3,4,5,6,7,8)
print str(new)

class test:
	def __init__ (self):
		self.id = 1
	def __str__ (self):
		return "string"
		
t = test()

print t

```

This is the class for ScheduleEntry:

```auto
class ScheduleEntry:
	def __init__ (self, id, priority, loadDate, startDate, endDate, recipe, minDosingTime, status):
		self.id = id
		self.priority = priority
		self.loadDate = loadDate
		self.startDate = startDate
		self.endDate = endDate
		self.recipe = recipe
		self.minDosingTime = minDosingTime
		self.status = status
		self.segmentsByDay = {}
		self.newEntry = False	
		
	def __str__ (self):
		return "string"

```

When I print out “new” I just get the representation of the object and not the string as expected but when I print out “t”, I get the string as expected

Console Output

```auto
>>> 
<model.ScheduleEntry instance at 0xd>
string
>>> 

```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 29, 2020, 3:47pm UTC](https://forum.inductiveautomation.com/t/string-representation-of-an-object/34306/2 "2020-04-29T15:47:23Z")

</div>

> [@dandersen](#):
>
> class ScheduleEntry:

You don't say what version of Ignition, but I'm pretty sure your class should be defined with parent `object`. First line like so:

```auto
class ScheduleEntry(object):

```

See "New Style Classes" in the python documentation:

[https://docs.python.org/2/reference/datamodel.html#new-style-and-classic-classes](https://docs.python.org/2/reference/datamodel.html#new-style-and-classic-classes)

Also, consider not using `import`. There are corner cases where old code can persist. Use the full path to `ScheduleEntry` when you construct your instance.

---

<div class="post-metadata">

**Author:** ![dandersen](https://avatars.discourse-cdn.com/v4/letter/d/ecb155/32.png) [@dandersen](https://forum.inductiveautomation.com/u/dandersen)\
**Post date:** [April 29, 2020, 4:20pm UTC](https://forum.inductiveautomation.com/t/string-representation-of-an-object/34306/3 "2020-04-29T16:20:07Z")

</div>

We are using Ignition 7.9.2 which uses Jython 2.5.3. Adding the the parent object didn’t make a difference but by not using the `import` and using the full path to construct the instance, that fixed the issue.
