question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multiline terminal command isn't processed properly

See original GitHub issue

I’ve included two notebooks, which are identical except for the terminal command.

  • one with a single-line terminal command
! bq --location=US load --autodetect --skip_leading_rows=1 --source_format=CSV {dataset_id}.us_states_local_file 'resources/us-states.csv'
  • one with a multi-line terminal command
!bq \
--location=US load \
--autodetect \
--skip_leading_rows=1 \
--source_format=CSV \
{dataset_id}.us_states_local_file \
'resources/us-states.csv'

The one with multiline doesn’t process properly, so when I run nbqa with black, I get:

Running black...
error: cannot format notebooks/official/bigquery_command_line_tool.ipynb: Cannot parse: cell_6:2:5: --lo 0x6AA55214

Archive.zip

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12

github_iconTop GitHub Comments

1reaction
MarcoGorellicommented, Sep 11, 2021

As an aside, seeing as you’re using nbQA at Google, I’d appreciate it if you could consider sponsoring the project

1reaction
MarcoGorellicommented, Sep 11, 2021

OK, I see what’s happened - you’re missing the extra Jupyter requirements when running black on the notebooks, and so they’re been formatted as if they were Python files. You probably ran black on the notebooks when the version was still 20.8b1, right?

If you want Jupyter support for black, you need to install it as

pip install -U black[jupyter]

I’d advise:

  • checkout your notebooks to the original state
  • pip install -U black[jupyter]
  • run black on the notebooks
  • run any other linting checks

The previous commit was fine btw (https://github.com/GoogleCloudPlatform/bigquery-notebooks/commit/56712e9a7f57c3acd047ae011fa98b8283c0611e)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Terminal prompt not wrapping correctly - Unix Stack Exchange
I have an issue where if I type in very long commands in bash the terminal will not render what I'm typing correctly....
Read more >
Linux Bash Script, Single Command But Multiple Lines?
This works, but I am wondering if I can format the script to show the command over multiple lines, something like this, so...
Read more >
Unable to recognize multiline command · Issue #49 - GitHub
Hi, I have the following command that is not working in Powershell 7.0.3 (Windows10, Visual Studio Code terminal).
Read more >
multi line variable does not work for parameters when used in ...
I have a script that is used to set up a couple default widgets on a wordpress site through wp-cli. script widgets.sh: read...
Read more >
multiline command chunks in bash history into multiple lines
bash_history has chucked the command on multiple separate entries and writing problem here; the history command result messed too.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found