Python Forum
Type error: dump() missing 1 required positional argument: fp
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Type error: dump() missing 1 required positional argument: fp
#2
To make it work,also for now remove stuff that don't make sense.
import json

def ussubem():
    sub_e = input('Please enter your subscription email: \n ')
    return f'Thank you, will now receive regular emails about The Urban Macchiato to {sub_e}'

email = ussubem()
with open('usersub.json', 'w') as json_file:
    json.dump(email, json_file)
When you do userfav = True it's overwrite function userfav() then all code is gone and it's only True.
To check a condition in function then something like this:
if 'email stuff' in userfav():
    # Write json
else:
    # Not okay,try again
Reply


Messages In This Thread
RE: Type error: dump() missing 1 required positional argument: fp - by snippsat - Jul-11-2019, 09:42 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  TypeError: Diagram.render() takes 1 positional argument but 2 were given sachin1361 0 236 Apr-23-2024, 06:39 AM
Last Post: sachin1361
  Wrong type error rowan_bradley 6 1,309 Aug-07-2023, 10:44 AM
Last Post: rowan_bradley
  Strange argument count error rowan_bradley 3 764 Aug-06-2023, 10:58 AM
Last Post: rowan_bradley
  Type Error: Unsupported Operand jhancock 2 1,281 Jul-22-2023, 11:33 PM
Last Post: jhancock
  i want to use type= as a function/method keyword argument Skaperen 9 1,949 Nov-06-2022, 04:28 AM
Last Post: Skaperen
  Error TypeError: output_type_handler() takes 2 positional arguments but 6 were given paulo79 1 1,990 Oct-17-2022, 06:29 PM
Last Post: paulo79
  "SUMIF" type query in Python (help required) BlainEillimatta 0 878 Oct-06-2022, 09:08 AM
Last Post: BlainEillimatta
  Error: _vhstack_dispatcher() takes 1 positional argument but 9 were given alexfrol86 3 5,899 May-09-2022, 12:49 PM
Last Post: deanhystad
  Python Anytree - Is not of type 'NodeMixin' error georgebijum 3 2,126 May-05-2022, 01:43 PM
Last Post: Gribouillis
  What is positional argument self? Frankduc 22 5,907 Mar-06-2022, 01:18 AM
Last Post: Frankduc

Forum Jump:

User Panel Messages

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