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
#1
Hi, I am trying to create a json file that stores my users email for subscription purposes. I get an error that says, 'Type error: dump() missing 1 required positional'. Here is my code:

print('Welcome to the Urban ')

import json

import username

import favartist


def userfav():
    userfav = input('Please select your favorite artist: \n ')
    a = 'Yes' or 'yes'
    ab = 'No' or 'no'
    if userfav == 'Drake':
        subs = input('Would you like to subscribe to notifications for Drake?:')
        if subs == a:
            print('Thank you for subscribing')
        elif subs == ab:
            print('You ca subscribe later')
        else:
            print('Selection is invalid')
    elif userfav == 'J.Cole':
        subs = input('Would you like to subscribe to notifications for J.Cole?:')
        if subs == a:
            print('Thank you for subscribing')
        elif subs == ab:
            print('You ca subscribe later')
        else:
            print('Selection is invalid')

    elif userfav == 'Anderson Paak':
        subs = input('Would you like to subscribe to notifications for Drake?:')
        if subs == a:
            print('Thank you for subscribing')
            ussubem()
        elif subs == ab:
            print('You ca subscribe later')
        else:
            print('Selection is invalid')


userfav()

def ussubem():
    userfav = True
    a = True
    sub_e = input('Please enter your subscription email: \n ')
    em = sub_e
    return print('Thank you, will now receive regular emails about The Urban Macchiato to,' + sub_e)

ussubem()

with open('usersub.json', 'w+') as json_file:
    json.dump(ussubem)
Reply


Messages In This Thread
Type error: dump() missing 1 required positional argument: fp - by jaycuff13 - Jul-11-2019, 08:38 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  TypeError: Diagram.render() takes 1 positional argument but 2 were given sachin1361 0 232 Apr-23-2024, 06:39 AM
Last Post: sachin1361
  Wrong type error rowan_bradley 6 1,304 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,276 Jul-22-2023, 11:33 PM
Last Post: jhancock
  i want to use type= as a function/method keyword argument Skaperen 9 1,948 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,988 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,895 May-09-2022, 12:49 PM
Last Post: deanhystad
  Python Anytree - Is not of type 'NodeMixin' error georgebijum 3 2,123 May-05-2022, 01:43 PM
Last Post: Gribouillis
  What is positional argument self? Frankduc 22 5,903 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