Skip to content

Plantage de la commande magique avec l'option --arrange sur un texte non ASCII (sous Windows) #62

@laowantong

Description

@laowantong
%%mocodo --arrange
... numéro ...

lève l'erreur

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Input In [43], in <cell line: 1>()
----> 1 get_ipython().run_cell_magic('mocodo', '--arrange', '\nPOMPIER :\nROLE :\nGROUPE : sigle, numero de local, numéro de telephone\nTELEPHONE :\nSPECIALITE :\nDATE :\n    \nRESPONSABLE, 01 POMPIER, 11 GROUPE\nENSEIGNE, 11 GROUPE, 11 SPECIALITE \nATTRIBUER, XX POMPIER, XX ROLE\n')

File ~\anaconda3\lib\site-packages\IPython\core\interactiveshell.py:2347, in InteractiveShell.run_cell_magic(self, magic_name, line, cell)
   2345 with self.builtin_trap:
   2346     args = (magic_arg_s, cell)
-> 2347     result = fn(*args, **kwargs)
   2348 return result

File ~\anaconda3\lib\site-packages\mocodo\magic_command.py:122, in MocodoMagics.mocodo(line, cell)
    120 parser.add_argument("--flip", nargs="?")
    121 (_, options) = parser.parse_known_args(options)
--> 122 input_path.write_text(stdoutdata, encoding="utf8")
    123 options.extend(["--input", str(input_path), "--output_dir", str(output_dir)])
    124 if execute_command(options):

File ~\anaconda3\lib\pathlib.py:1283, in Path.write_text(self, data, encoding, errors)
   1279 """
   1280 Open the file in text mode, write to it, and close the file.
   1281 """
   1282 if not isinstance(data, str):
-> 1283     raise TypeError('data must be str, not %s' %
   1284                     data.__class__.__name__)
   1285 with self.open(mode='w', encoding=encoding, errors=errors) as f:
   1286     return f.write(data)

TypeError: data must be str, not bytes

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions