pycodestyle_magic icon indicating copy to clipboard operation
pycodestyle_magic copied to clipboard

cannot check 'python dict codestype' in jupyter lab

Open yushiokamura opened this issue 5 years ago • 1 comments

Hi, I use pycodestyle_magic. This magic code is very nice.

When I check pythgon dict code style by %%pycodestyle, an error occurs.

for example, when I try

%%pycodestyle
{"a":0,"b":1}

then return ValueError

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-19-2c11b8fb9c7b> in <module>
----> 1 get_ipython().run_cell_magic('pycodestyle', '', '{"a":0,"b":1}\n')

~/python3.8/site-packages/IPython/core/interactiveshell.py in run_cell_magic(self, magic_name, line, cell)
   2379             with self.builtin_trap:
   2380                 args = (magic_arg_s, cell)
-> 2381                 result = fn(*args, **kwargs)
   2382             return result
   2383 

~/python3.8/site-packages/pycodestyle_magic.py in pycodestyle(line, cell, auto)
    173         #logger.info(line)
    174         # on windows drive path also contains :
--> 175         line, col, error = line.split(':')[-4:]
    176         # do not subtract 1 for line for %%pycodestyle, inc pre py3.6 string
    177         if auto:

ValueError: too many values to unpack (expected 3)

It seems that the cause is that ":" is included in the code. right?

Is there a way around this error?

yushiokamura avatar Dec 14 '20 06:12 yushiokamura

#20 seems to be the same issue. Potential workaround proposed on #20

jtweeder avatar Jan 11 '22 13:01 jtweeder