Help with Veneer python project: Unexpected Type error


I’m currently trying to complete this exercise:

Check that artwork.owner is the same (==) as self (i.e., make sure the client owns the art they’re trying to sell).
Create a new Listing with the given art, price, and client.
Add the listing to the marketplace using veneer.add_listing().

However when i am using my show_listing method it prints the new listing I have just added using the previous function but then in addition print a Type Error. I’ve attached what gets printed out below including the error.

Girl with a Mandolin (Fanny Tellier) for sale at $6M.
Traceback (most recent call last):
  File "", line 92, in <module>
  File "", line 53, in show_listings
TypeError: __str__ returned non-string (type NoneType)

As you can see it prints out the listing correctly but then adds an additional error message. Im a little stuck to why this is.

My full code is pasted here:

#Listings Class

class Listings:

  def __init__(self, art, price, seller): = art
    self.price = price 
    self.seller = seller

  def __repr__(self):
    print("{n} for sale at {p}.".format(, p = self.price))

# Client class

class Client:

  def __init__(self, name, location, is_museum): = name
    self.location = location 
    self.is_muesum = is_museum
  def sell_artwork(self, artwork, price):
    if artwork.owner == self:
      new_listing = Listings(artwork, price, self)
      print("You can't sell this piece")
  def buy_artwork(self, artwork):
    if not(artwork.owner == self) and artwork in veneer.listing:
      art_listing = veneer.listing.index(artwork)
      artwork.owner = self

# Marketplace class

class Marketplace:
  def __init__ (self):
    self.listings = []

  def add_listing(self, new_listing):
  def remove_listing(self, old_listing):
  def show_listings(self):
    for listing in self.listings:

#ART class
class Art:
  def __init__(self, artist, title, medium, year, owner):
    self.artist = artist 
    self.title = title 
    self.medium = medium
    self.year = year
    self.owner = owner

  def __repr__(self):
    return "{n}. \"{t}\". {y}, {m}. {o}, {l}.".format(n = self.artist, t = self.title, y = self.year, m  = self.medium, o =, l = self.owner.location)

# Marketplace Instances

veneer = Marketplace() 

# Client Instances

edytta = Client("Edytta Halpirt", "Private Collection", False)

moma = Client("The MOMA", "new York", True)

# Art instance

girl_with_mandolin = Art("Picasso, Pablo", "Girl with a Mandolin (Fanny Tellier)", "oil on canvas", 1910, edytta)


edytta.sell_artwork(girl_with_mandolin, "$6M")


You need to be careful with the repr method. It’s a function that should return a representation. Without a valid return you’ll run into errors. See the docs for info and based on the way you’re using it consider having a look at __str__ in the same docs.


Hello, @systemmaster47674, and welcome to the Codecademy Forums!

Note that instruction 23 includes the following:

Create a new class called Listing .

The prescribed name reflects the fact that an instance of that class is to represent a single listing of Art. Instead, you named the class Listings. If you change its name to Listing, you will also need to instantiate that class using its corrected name in the sell_artwork method of the Client class.

1 Like

Thanks both.

@tgrtim updated the repr method and that fixed it all thank you.

And @appylpye thats a good point thanks for the support on it.

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.