TypeError: <lambda>() takes 0 positional arguments but 1 was given
Author: ahmadmustafaanis
State: closed

### Describe the bug

```
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[<ipython-input-35-7b6becee3685>](https://localhost:8080/#) in <cell line: 1>()
----> 1 from datasets import Dataset

9 frames
[/usr/local/lib/python3.10/dist-packages/datasets/__init__.py](https://localhost:8080/#) in <module>
     20 __version__ = "2.15.0"
     21 
---> 22 from .arrow_dataset import Dataset
     23 from .arrow_reader import ReadInstruction
     24 from .builder import ArrowBasedBuilder, BeamBasedBuilder, BuilderConfig, DatasetBuilder, GeneratorBasedBuilder

[/usr/local/lib/python3.10/dist-packages/datasets/arrow_dataset.py](https://localhost:8080/#) in <module>
     61 import pyarrow.compute as pc
     62 from huggingface_hub import CommitOperationAdd, CommitOperationDelete, DatasetCard, DatasetCardData, HfApi
---> 63 from multiprocess import Pool
     64 from requests import HTTPError
     65 

[/usr/local/lib/python3.10/dist-packages/multiprocess/__init__.py](https://localhost:8080/#) in <module>
     31 
     32 import sys
---> 33 from . import context
     34 
     35 #

[/usr/local/lib/python3.10/dist-packages/multiprocess/context.py](https://localhost:8080/#) in <module>
      4 
      5 from . import process
----> 6 from . import reduction
      7 
      8 __all__ = ()

[/usr/local/lib/python3.10/dist-packages/multiprocess/reduction.py](https://localhost:8080/#) in <module>
     14 import os
     15 try:
---> 16     import dill as pickle
     17 except ImportError:
     18     import pickle

[/usr/local/lib/python3.10/dist-packages/dill/__init__.py](https://localhost:8080/#) in <module>
     24 
     25 
---> 26 from ._dill import (
     27     dump, dumps, load, loads, copy,
     28     Pickler, Unpickler, register, pickle, pickles, check,

[/usr/local/lib/python3.10/dist-packages/dill/_dill.py](https://localhost:8080/#) in <module>
    166 try:
    167     from _pyio import open as _open
--> 168     PyTextWrapperType = get_file_type('r', buffering=-1, open=_open)
    169     PyBufferedRandomType = get_file_type('r+b', buffering=-1, open=_open)
    170     PyBufferedReaderType = get_file_type('rb', buffering=-1, open=_open)

[/usr/local/lib/python3.10/dist-packages/dill/_dill.py](https://localhost:8080/#) in get_file_type(*args, **kwargs)
    154 def get_file_type(*args, **kwargs):
    155     open = kwargs.pop("open", __builtin__.open)
--> 156     f = open(os.devnull, *args, **kwargs)
    157     t = type(f)
    158     f.close()

[/usr/lib/python3.10/_pyio.py](https://localhost:8080/#) in open(file, mode, buffering, encoding, errors, newline, closefd, opener)
    280             return result
    281         encoding = text_encoding(encoding)
--> 282         text = TextIOWrapper(buffer, encoding, errors, newline, line_buffering)
    283         result = text
    284         text.mode = mode

[/usr/lib/python3.10/_pyio.py](https://localhost:8080/#) in __init__(self, buffer, encoding, errors, newline, line_buffering, write_through)
   2043                 encoding = "utf-8"
   2044             else:
-> 2045                 encoding = locale.getpreferredencoding(False)
   2046 
   2047         if not isinstance(encoding, str):

TypeError: <lambda>() takes 0 positional arguments but 1 was given
```

or 

```
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[<ipython-input-36-652e886d387f>](https://localhost:8080/#) in <cell line: 1>()
----> 1 import datasets

9 frames
[/usr/local/lib/python3.10/dist-packages/datasets/__init__.py](https://localhost:8080/#) in <module>
     20 __version__ = "2.15.0"
     21 
---> 22 from .arrow_dataset import Dataset
     23 from .arrow_reader import ReadInstruction
     24 from .builder import ArrowBasedBuilder, BeamBasedBuilder, BuilderConfig, DatasetBuilder, GeneratorBasedBuilder

[/usr/local/lib/python3.10/dist-packages/datasets/arrow_dataset.py](https://localhost:8080/#) in <module>
     61 import pyarrow.compute as pc
     62 from huggingface_hub import CommitOperationAdd, CommitOperationDelete, DatasetCard, DatasetCardData, HfApi
---> 63 from multiprocess import Pool
     64 from requests import HTTPError
     65 

[/usr/local/lib/python3.10/dist-packages/multiprocess/__init__.py](https://localhost:8080/#) in <module>
     31 
     32 import sys
---> 33 from . import context
     34 
     35 #

[/usr/local/lib/python3.10/dist-packages/multiprocess/context.py](https://localhost:8080/#) in <module>
      4 
      5 from . import process
----> 6 from . import reduction
      7 
      8 __all__ = ()

[/usr/local/lib/python3.10/dist-packages/multiprocess/reduction.py](https://localhost:8080/#) in <module>
     14 import os
     15 try:
---> 16     import dill as pickle
     17 except ImportError:
     18     import pickle

[/usr/local/lib/python3.10/dist-packages/dill/__init__.py](https://localhost:8080/#) in <module>
     24 
     25 
---> 26 from ._dill import (
     27     dump, dumps, load, loads, copy,
     28     Pickler, Unpickler, register, pickle, pickles, check,

[/usr/local/lib/python3.10/dist-packages/dill/_dill.py](https://localhost:8080/#) in <module>
    166 try:
    167     from _pyio import open as _open
--> 168     PyTextWrapperType = get_file_type('r', buffering=-1, open=_open)
    169     PyBufferedRandomType = get_file_type('r+b', buffering=-1, open=_open)
    170     PyBufferedReaderType = get_file_type('rb', buffering=-1, open=_open)

[/usr/local/lib/python3.10/dist-packages/dill/_dill.py](https://localhost:8080/#) in get_file_type(*args, **kwargs)
    154 def get_file_type(*args, **kwargs):
    155     open = kwargs.pop("open", __builtin__.open)
--> 156     f = open(os.devnull, *args, **kwargs)
    157     t = type(f)
    158     f.close()

[/usr/lib/python3.10/_pyio.py](https://localhost:8080/#) in open(file, mode, buffering, encoding, errors, newline, closefd, opener)
    280             return result
    281         encoding = text_encoding(encoding)
--> 282         text = TextIOWrapper(buffer, encoding, errors, newline, line_buffering)
    283         result = text
    284         text.mode = mode

[/usr/lib/python3.10/_pyio.py](https://localhost:8080/#) in __init__(self, buffer, encoding, errors, newline, line_buffering, write_through)
   2043                 encoding = "utf-8"
   2044             else:
-> 2045                 encoding = locale.getpreferredencoding(False)
   2046 
   2047         if not isinstance(encoding, str):

TypeError: <lambda>() takes 0 positional arguments but 1 was given
```

### Steps to reproduce the bug

`import datasets` on colab

### Expected behavior

work fine

### Environment info

colab

`!pip install datasets`

Comments: This looks like a problem with your environment rather than `datasets`.

I meet the same problem,
and originally use
```python
locale.getpreferredencoding = lambda : "UTF-8"
```
and change to
```
locale.getpreferredencoding = lambda x: "UTF-8"
```
and it works.

> I meet the same problem, and originally use
> 
> locale.getpreferredencoding = lambda : "UTF-8"
> 
> and change to
> 
> ```
> locale.getpreferredencoding = lambda x: "UTF-8"
> ```
> 
> and it works.

Thanks, works for me too.