Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

In Python+Q# notebooks, error messages point to line numbers off-by-one #731

Open
tcNickolas opened this issue Sep 30, 2022 · 3 comments
Open
Labels
Area-Kernel Issue relates to the IQ# kernel. Area-Python Issue relates to the Python client for the IQ# kernel. Kind-Bug Something isn't working

Comments

@tcNickolas
Copy link
Member

Describe the bug
In Python+Q# notebooks (both local and hosted on Azure Quantum), error message points to the line number off-by-one due to %%qsharp magic command taking up the first line. (Same as microsoft/QuantumKatas#658.)

To Reproduce
Run any %%qsharp cell with a compilation error in it.

Expected behavior
Displayed line numbers should match the ones where the error is.

@tcNickolas tcNickolas added the bug label Sep 30, 2022
@cgranade
Copy link
Contributor

Thanks for pointing this out. At the moment, we don't have a mechanism to set the line offset based on how the code was passed. I agree it'd be worth adding, but it may take a little bit of work to plumb that through Jupyter executions so as to make sure that the final compilation has that context. We'll try to take a look at this, then. Thanks!

@cgranade cgranade added Kind-Bug Something isn't working Area-Kernel Issue relates to the IQ# kernel. Area-Python Issue relates to the Python client for the IQ# kernel. and removed bug labels Sep 30, 2022
@tcNickolas
Copy link
Member Author

Would a simple workaround like appending an empty string to the code in the %%qsharp magic command before it's passed on to compilation work?

@cgranade
Copy link
Contributor

Ah, fair point— it may yeah... can look at that soon, then, hopefully.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area-Kernel Issue relates to the IQ# kernel. Area-Python Issue relates to the Python client for the IQ# kernel. Kind-Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants