Personal tools
You are here: Home Documentation Error References TypeError: argument 1 must be string in constructor
Support

Get Help

Join our chat rooms or support forums if you have more specific questions.

Plone Training
Learn how to design, build, and deploy a website in Plone through one of the numerous Plone training sessions around the world.
Find Plone training…
 
Document Actions

TypeError: argument 1 must be string in constructor

This Error Reference applies to: Any version.
This Error Reference is intended for: Any audience.

TypeError: argument 1 must be string, not YourTool A construtor seems to take string argument instead of self.

A class constructor has absurd arguments. For me, this came up, when my Tool was unable to initialize itself:

      portal.manage_addProduct[PROJECTNAME].manage_addTool(UsabilityTool.meta_type)
      File "E:\usability\Test\plone2\Data\Products\CMFCore\utils.py", line 427, in manage_addTool
      obj = tool()
      TypeError: argument 1 must be string, not UsabilityTool

Nasty bastard, this was very hard to pin down. UsabilityTool.__init__ seemed to be Python native method-wrapper. I had to poke around class hierarchy a while before founding out that I was using a module instead of a class in the super class declaration:

    from OFS import SimpleItem

    class UsabilityTool(PloneBaseTool, UniqueObject, SimpleItem, Referenceable, PropertyManager):

Here SimpleItem is module instead of a class import. You can fix this:

    from OFS.SimpleItem import SimpleItem

by Mikko Ohtamaa last modified October 3, 2005 - 19:12
Contributors: Mikko Ohtamaa
All content is copyright Plone Foundation and the individual contributors.

For any issues with the web site functionality, please file a ticket.

Please consult the policy on plone.org content if you want your content published on this site.

Servers and hosting by