Unexpected error: replace() takes 2 positional arguments but 3 were given

Oto Shavadze

In settings.py I have:

BASE_DIR = Path(__file__).resolve().parent.parent

Then In some view:

from django.http import HttpResponse
from django.conf import settings


def test_view(request):
    return HttpResponse( settings.BASE_DIR.replace("src", "") )

This gives error: replace() takes 2 positional arguments but 3 were given

It confuses me, how that error appears? also if do:

return HttpResponse( settings.BASE_DIR )

this returns full path, something like: /home/full/path/to/project/src

also this works

 return HttpResponse( "/home/full/path/to/project/src".replace("src", "") )

Can you help me and tell what is wrong with this line:

return HttpResponse( settings.BASE_DIR.replace("src", "") )

?

NKSM

Convert it to string:

str(settings.BASE_DIR).replace("src", "")

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Python: __init__() takes 2 positional arguments but 3 were given

From Dev

TypeError: _transform() takes 2 positional arguments but 3 were given

From Dev

TypeError: forward() takes 2 positional arguments but 3 were given

From Dev

TypeError: chunkIt() takes 2 positional arguments but 3 were given

From Dev

Odoo takes from 1 to 2 positional arguments but 3 were given

From Dev

TypeError: randint() takes 3 positional arguments but 4 were given

From Dev

How to resolve error "object_permission() takes 3 positional arguments but 4 were given"?

From Dev

TypeError: open() takes 0 positional arguments but 2 were given

From Java

Using a LabelEncoder in sklearn's Pipeline gives: fit_transform takes 2 positional arguments but 3 were given

From Dev

Money and TypeError: __init__() takes from 1 to 2 positional arguments but 3 were given

From Dev

sklearn.compose.ColumnTransformer: fit_transform() takes 2 positional arguments but 3 were given

From Dev

Money and TypeError: __init__() takes from 1 to 2 positional arguments but 3 were given

From Dev

python super :TypeError: __init__() takes 2 positional arguments but 3 were given

From Dev

TypeError : takes 0 positional arguments but 3 were given. Can't figure out what arguments

From Dev

TypeError: __init__() takes from 1 to 3 positional arguments but 4 were given

From Dev

__init__() takes 3 positional arguments but 4 were given when run

From Dev

__init__() takes from 1 to 3 positional arguments but 4 were given

From Dev

Python/MySQL TypeError: execute() takes from 2 to 4 positional arguments but 5 were given

From Dev

TypeError: init_animals() takes 1 positional arguments but 2 were given

From Dev

Running Flask with Gunicorn raises TypeError: index() takes 0 positional arguments but 2 were given

From Dev

TypeError: predict() takes from 1 to 2 positional arguments but 4 were given, google cloud shell

From Dev

TypeError: init_animals() takes 1 positional arguments but 2 were given

From Dev

logging makeRecord() takes 8 positional arguments but 11 were given

From Dev

TypeError: __init__() takes 4 positional arguments but 7 were given

From Java

Django 2.1.3 Error: __init__() takes 1 positional argument but 2 were given

From Dev

Django 2.1.3 Error: __init__() takes 1 positional argument but 2 were given

From Dev

Caught up in a Type Error: __init__() takes 1 positional argument but 2 were given

From Dev

TypeError: __init__() takes 1 positional argument but 3 were given

From Java

TypeError: method() takes 1 positional argument but 2 were given

Related Related

  1. 1

    Python: __init__() takes 2 positional arguments but 3 were given

  2. 2

    TypeError: _transform() takes 2 positional arguments but 3 were given

  3. 3

    TypeError: forward() takes 2 positional arguments but 3 were given

  4. 4

    TypeError: chunkIt() takes 2 positional arguments but 3 were given

  5. 5

    Odoo takes from 1 to 2 positional arguments but 3 were given

  6. 6

    TypeError: randint() takes 3 positional arguments but 4 were given

  7. 7

    How to resolve error "object_permission() takes 3 positional arguments but 4 were given"?

  8. 8

    TypeError: open() takes 0 positional arguments but 2 were given

  9. 9

    Using a LabelEncoder in sklearn's Pipeline gives: fit_transform takes 2 positional arguments but 3 were given

  10. 10

    Money and TypeError: __init__() takes from 1 to 2 positional arguments but 3 were given

  11. 11

    sklearn.compose.ColumnTransformer: fit_transform() takes 2 positional arguments but 3 were given

  12. 12

    Money and TypeError: __init__() takes from 1 to 2 positional arguments but 3 were given

  13. 13

    python super :TypeError: __init__() takes 2 positional arguments but 3 were given

  14. 14

    TypeError : takes 0 positional arguments but 3 were given. Can't figure out what arguments

  15. 15

    TypeError: __init__() takes from 1 to 3 positional arguments but 4 were given

  16. 16

    __init__() takes 3 positional arguments but 4 were given when run

  17. 17

    __init__() takes from 1 to 3 positional arguments but 4 were given

  18. 18

    Python/MySQL TypeError: execute() takes from 2 to 4 positional arguments but 5 were given

  19. 19

    TypeError: init_animals() takes 1 positional arguments but 2 were given

  20. 20

    Running Flask with Gunicorn raises TypeError: index() takes 0 positional arguments but 2 were given

  21. 21

    TypeError: predict() takes from 1 to 2 positional arguments but 4 were given, google cloud shell

  22. 22

    TypeError: init_animals() takes 1 positional arguments but 2 were given

  23. 23

    logging makeRecord() takes 8 positional arguments but 11 were given

  24. 24

    TypeError: __init__() takes 4 positional arguments but 7 were given

  25. 25

    Django 2.1.3 Error: __init__() takes 1 positional argument but 2 were given

  26. 26

    Django 2.1.3 Error: __init__() takes 1 positional argument but 2 were given

  27. 27

    Caught up in a Type Error: __init__() takes 1 positional argument but 2 were given

  28. 28

    TypeError: __init__() takes 1 positional argument but 3 were given

  29. 29

    TypeError: method() takes 1 positional argument but 2 were given

HotTag

Archive