Python Forum
TypeError: missing 3 required positional arguments:
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TypeError: missing 3 required positional arguments:
#4
(Aug-17-2021, 06:24 PM)deanhystad Wrote: This code makes no sense to me. What do you expect it to do?
    def get_or_create_node_id(self,node_name,c,cur,nodes):
        if node_name in nodes:
            print ("%s found in dict, has id %s" % ( node_name, nodes[node_name] ))
            return int(nodes[node_name])
        else:
            print("creating new node entry ..")
            sql = "INSERT INTO nodes VALUES (DEFAULT, '%s')" % (node_name)
            cur.execute(sql)
            c.commit()
            return self.get_or_create_node_id(node_name)

it looks in the database of the "node" is already there, if yes it returns the id of the node (db id), if no it creates the node in the db.
Reply


Messages In This Thread
RE: TypeError: missing 3 required positional arguments: - by wardancer84 - Aug-18-2021, 10:17 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  TypeError: Diagram.render() takes 1 positional argument but 2 were given sachin1361 0 379 Apr-23-2024, 06:39 AM
Last Post: sachin1361
  TypeError: a bytes-like object is required ZeroX 13 5,138 Jan-07-2023, 07:02 PM
Last Post: deanhystad
  Error TypeError: output_type_handler() takes 2 positional arguments but 6 were given paulo79 1 2,130 Oct-17-2022, 06:29 PM
Last Post: paulo79
  TypeError: a bytes-like object is required, not 'str' - Help Please. IanJ 3 5,129 Aug-29-2022, 05:53 PM
Last Post: deanhystad
  TypeError: not enough arguments for format string MaartenRo 6 3,181 Jan-09-2022, 06:46 PM
Last Post: ibreeden
  TypeError: missing a required argument: 'y' gible 0 3,107 Dec-15-2021, 02:21 AM
Last Post: gible
  TypeError: run_oracle_job() missing 1 required positional argument: 'connection_strin python_student 1 2,077 Aug-06-2021, 08:05 PM
Last Post: SheeppOSU
  python 3: TypeError: a bytes-like object is required, not 'str' wardancer84 3 6,808 Jul-09-2021, 05:55 PM
Last Post: deanhystad
  TypeError: max_value() missing 2 required positional arguments: 'alpha' and 'beta' Anldra12 2 4,333 May-15-2021, 04:15 PM
Last Post: Anldra12
  TypeError: sum() missing 1 required positional argument: 'num2' Insen 3 5,713 Jan-06-2021, 04:25 PM
Last Post: Insen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020