Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python and pylance are throwing errors after vs code update #6373

Open
RBnzr opened this issue Sep 11, 2024 · 32 comments
Open

python and pylance are throwing errors after vs code update #6373

RBnzr opened this issue Sep 11, 2024 · 32 comments
Assignees
Labels
needs repro Issue has not been reproduced yet settings-override Feedback that pyrightconfig.json is taking precedence user responded Was "waiting for user response" and they responded

Comments

@RBnzr
Copy link

RBnzr commented Sep 11, 2024

Type: Bug

keep getting unexpected indent error

Extension version: 2024.9.1
VS Code version: Code 1.92.2 (fee1edb8d6d72a0ddff41e5f71a671c23ed924b9, 2024-08-14T17:29:30.058Z)
OS version: Windows_NT x64 10.0.19045
Modes:

System Info
Item Value
CPUs 12th Gen Intel(R) Core(TM) i5-12600K (16 x 3686)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 63.77GB (43.86GB free)
Process Argv --crash-reporter-id 44261052-917d-401d-b885-b5cacbea1c48
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
pythonnoceb:30805159
asynctok:30898717
pythonmypyd1:30879173
2e7ec940:31000449
pythontbext0:30879054
accentitlementst:30995554
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
jg8ic977:31013176
a69g1124:31058053
dvdeprecation:31068756
dwnewjupyter:31046869
impr_priority:31102340
nativerepl1:31134654
refactort:31108082
pythonrstrctxt:31112756
flighttreat:31134774
wkspc-onlycs-t:31132770
wkspc-ranged-c:31125598
fje88620:31121564

@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Sep 11, 2024
@rchiodo
Copy link
Contributor

rchiodo commented Sep 11, 2024

Thanks for the issue, do you have an example that causes the problem?

@rchiodo rchiodo added the waiting for user response Requires more information from user label Sep 11, 2024
@mbanani
Copy link

mbanani commented Sep 11, 2024

Not sure if it's related, but I starting seeing errors like reportPrivateImportUsage and reportArgumentType that didn't show up previously after updating. I can also confirm that rolling back to version 2024.8.2 made those messages disappear.

@rchiodo
Copy link
Contributor

rchiodo commented Sep 11, 2024

Not sure if it's related, but I starting seeing errors like reportPrivateImportUsage and reportArgumentType that didn't show up previously after updating. I can also confirm that rolling back to version 2024.8.2 made those messages disappear.

I would hazard a guess that your new errors are a result of better typechecking in Pyright. Of course, a code example would let us know for sure.

@keunhong
Copy link

keunhong commented Sep 11, 2024

Also possibly related, I have type checking mode set to "off" yet I'm still seeing type errors:

"python.analysis.typeCheckingMode": "off"

@Hnasar
Copy link

Hnasar commented Sep 11, 2024

Not sure if it's related, but I starting seeing errors like reportPrivateImportUsage and reportArgumentType that didn't show up previously after updating. I can also confirm that rolling back to version 2024.8.2 made those messages disappear.

We're also seeing an increase in errors even though we left python.analysis.typeCheckingMode set to the default (off).
Upon seeing the increased errors we turned it off temporarily. It seems like a bug from our end that new false positives started showing up.

@rchiodo
Copy link
Contributor

rchiodo commented Sep 11, 2024

Also possibly related, I have type checking mode set to "off" yet I'm still seeing type errors:

"python.analysis.typeCheckingMode": "off"

@keunhong do you have an example? The only errors you should get is syntax errors, although there's another change that might be the cause of this.

Pyright recently changed such that if there's a pyrightconfig.json or a pyproject.toml with a tool.pyright section, its settings trump any settings in your settings.json.

You can read this for more information if that's the case:
https://github.com/microsoft/pylance-release/wiki/Settings.json-overridden-by-Pyrightconfig.json-or-Pyproject.toml

@rchiodo rchiodo assigned rchiodo and unassigned bschnurr Sep 11, 2024
@rchiodo rchiodo added the settings-override Feedback that pyrightconfig.json is taking precedence label Sep 11, 2024
@akrherz
Copy link

akrherz commented Sep 11, 2024

Thank you @rchiodo ! I am in the same boat here with the updated pylance/pyright spewing all kinds of type checking issues, lots of within pandas! Anyway, for others that have a [tool.pyright] in pyproject.toml, this needs set to delay the pain

[tool.pyright]
typeCheckingMode = "off"

@RBnzr
Copy link
Author

RBnzr commented Sep 11, 2024

Thanks for the issue, do you have an example that causes the problem?

Hey @rchiodo: Sure I can send a code chunk that was not working, and there were no indentation issues what so ever. what's the best way for me to send it to you?

@github-actions github-actions bot added user responded Was "waiting for user response" and they responded and removed waiting for user response Requires more information from user labels Sep 11, 2024
@rchiodo
Copy link
Contributor

rchiodo commented Sep 11, 2024

Hey @rchiodo: Sure I can send a code chunk that was not working, and there were no indentation issues what so ever. what's the best way for me to send it to you?

I assume you can't just paste it in the issue. You can also email me. It's my user id at microsoft dot com.

@RBnzr
Copy link
Author

RBnzr commented Sep 11, 2024

from gql import gql, Client
from gql.transport.requests import RequestsHTTPTransport   
from copy import deepcopy
from Utils.environment import get_azure_secret
from Utils.decorators.decorators import rename_columns_decorator
from Models._external.stack_adapt import lookup_client_id, campaign_group_dimensions, campaign_dimensions, ads_dimensions, campaign_facts
from Utils.developer.data_exploration import flatten_dict
from gql import gql, Client
from gql.transport.requests import RequestsHTTPTransport
import json

class Connector:
    def __init__(self, client):
        self._client = lookup_client_id(client)
        self.advertiser_id = self._client
        
        self.url = "https://api.stackadapt.com/graphql"
        self.token = get_azure_secret('StackAdaptToken') 
        self.headers = {
            'Authorization': f'Bearer {self.token}'
        }
        
        self.transport = RequestsHTTPTransport(url=self.url, headers=self.headers)
        self.client = Client(transport=self.transport, fetch_schema_from_transport=True)

    def execute_query(self, query, variables=None):
        result = self.client.execute(query, variable_values=variables)
        return result

so when I was trying to see where the error is occurring , up until this chunk above I got no errors.
However right after I kept getting unexpected indentation for each line:

   def _map_results_to_schema(self, result, schema): 
        """Maps results from Snapchat API to a schema

        Args:
            result (dict): Result from Snapchat API
            schema (dict): Schema to map results to

        Returns:
            row (dict): Row mapped to schema
        """
        row = deepcopy(schema)
        for k,v in result.items():
            row[k] = result[k]
        return row

and everything else. this is just a small code chunk. what was weird is that none of the code changed and when I would run as a python file the code would execute properly. This is one connector we have a bunch and all of them were returning the same error.
Do you need anything else?

@rchiodo
Copy link
Contributor

rchiodo commented Sep 11, 2024

Your second chunk has a tab in it, that's causing the indentation error.

Can see it here (I turned on showing whitespace in VS code)

Image
(Edited to show tab better)

Not sure why we can't parse a tab though. Seems like it should be fine. Maybe there's a new bug introduced in the Pyright parser.

@rchiodo
Copy link
Contributor

rchiodo commented Sep 11, 2024

Actually, it seems this is on purpose. The parser verifies tabs and spaces are consistent. This is by design. Has been for a while.

@rchiodo
Copy link
Contributor

rchiodo commented Sep 11, 2024

This error was introduced 8 months ago, so it isn't something new in 2024.9.1.

@erictraut
Copy link
Contributor

Can someone create a self-contained minimal repro?

The Python parser does support mixing tabs and spaces even though this isn't recommended. The pyright parser is designed to mirror the behavior of the Python parser. Here is the documentation for how the Python parser treats tabs. If there are cases where pyright's behavior doesn't match that of the Python parser, that's something we should look at.

@rchiodo
Copy link
Contributor

rchiodo commented Sep 11, 2024

Yeah, that repro doesn't run for me even with removing all the imports I don't have. I get the same indentation error that the Pylance parser produces.

I changed it to this:

class TestIndentation:
    def __init__(self):
        print('Created class')

    def func_two(self):
        print('Function two')
        return 4
    
	def call_func_two(self): 
        print('Calling Function two')
        return self.func_two()

    def func_three(self):
        print('Function three')
        return 5

x = TestIndentation()
x.call_func_two()

Running that gives the same error that Pylance/Pyright produces:

  File "c:\Users\rchiodo\source\testing\test_pylance\test_indentation.py", line 10
    def call_func_two(self): 
TabError: inconsistent use of tabs and spaces in indentation
PS C:\Users\rchiodo\source\testing\test_pylance> 

@raylu
Copy link

raylu commented Sep 11, 2024

we're experiencing this issue too. with python.analysis.typeCheckingMode set to off,
an empty section in pyproject.toml:

[tool.pyright]

this code

def say(s: str):
	s.hi()

produces a reportAttributeAccessIssue

either adding typeCheckingMode = "off" to pyproject.toml or removing the [tool.pyright] section gives the old behavior

downgrading to 2024.8.2 also works

@RBnzr
Copy link
Author

RBnzr commented Sep 11, 2024

Your second chunk has a tab in it, that's causing the indentation error.

Can see it here (I turned on showing whitespace in VS code)

Image (Edited to show tab better)

Not sure why we can't parse a tab though. Seems like it should be fine. Maybe there's a new bug introduced in the Pyright parser.

I think the tab was due to the way I copy pasted it into the comment.
below is how it shows in my repo as you can see no tabs.
image

I think the issue might be related to VS code update as well. Did the settings of typeCheckingMode = "off" to pyproject.toml or removing the [tool.pyright] change from last months vs code to this months vs code?

@rchiodo
Copy link
Contributor

rchiodo commented Sep 11, 2024

What exactly is the error you're getting @RBnzr? Can you share a screenshot?

@rchiodo
Copy link
Contributor

rchiodo commented Sep 11, 2024

Oh and settings changes are entirely related to the Pylance extension. VS code update didn't have any impact on them.

@Hnasar
Copy link

Hnasar commented Sep 11, 2024

Pyright recently changed such that if there's a pyrightconfig.json or a pyproject.toml with a tool.pyright section, its settings trump any settings in your settings.json.

You can read this for more information if that's the case: Wiki: Settings.json overridden by Pyrightconfig.json or Pyproject.toml

After looking at my own config indeed this is what's causing issue for us. This change has effectively changed the default of pyright (to mean pylance's typeCheckingMode) from disabled to enabled for anyone who has any pyright config (whether pyrightconfig.json or pyproject.toml).

This is a significant regression for us and has led to us being forced to disable pyright for all of our users team members. (cc @luabud)

Consider our scenario:

  • Mypy is the primary type checker we use, and that has 100% passing rate.
  • However, some advanced users wanted to start using pyright, despite some false positive errors.
  • So we started to maintain a pyright config with a few options to make things work better, even though there are still false positives.
  • Because vscode/pylance's default typeCheckingMode is "off" (docs) this meant that in the common case, most users did not see any errors.
  • Any users who wanted to enable pyright, could just toggle typeCheckingMode in their vscode user settings.json.

However, with this pylance 2024.9.1 update, because pyright's default typeCheckingMode is "standard" (docs), it effectively turned on pyright for all users. And we started getting a lot of complaints and confusion.

Our (hopefully temporary) workaround is to set "typeCheckingMode": "off", in our pyrightconfig.json. This resolves the false positive errors in the common case, but has the unfortunate side effect that advanced users cannot easily opt-in and enable pyright — a significant regression, because we are trying to encourage people to start using pyright, but now that is harder. I don't see a way of easily changing this default per-user to make it opt-in.

I hope this change can be reverted, or a workaround to address the use-case be shared.

Thanks for your work on this!

(Also, maybe I missed it, but I can't see where this change was mentioned in the changelogs for either pylance or pyright — that's made debugging this pretty time consuming.)
edit: Rich pointed out the blurb in https://github.com/microsoft/pyright/releases/tag/1.1.376 — thanks! :

Changed composition of settings that affect type checking behaviors. Previously, some LSP settings that affect type checking could override config files. Now, the config file always "wins". Command-line parameters passed to the CLI version of pyright win over both LSP settings and config files.

The commit that introduced this change is microsoft/pyright@2aa9bf4c2

@rchiodo
Copy link
Contributor

rchiodo commented Sep 11, 2024

Here's where this changed in Pyright:
https://github.com/microsoft/pyright/releases/tag/1.1.376

@erictraut
Copy link
Contributor

erictraut commented Sep 12, 2024

@Hnasar, can you provide more information about your use case? In particular, who are "our users" in this context? Are you a library maintainer, and "our users" are consumers of your library? I ask because the pyproject.toml file for a library is typically irrelevant to consumers of the library.

I'm also curious why you previously added an empty [tool.pyright] section to your pyproject.toml file. I think this should have been a no-op before the recent change. Can you just delete this section? That should restore the previous behavior.

The reason we made this change was to support projects that use pyright for type checking. Previously, contributors to a project were seeing inconsistent type checking behaviors between their pyright command line tool and their editor because some members of the team were (unintentionally) overriding type checker configuration in their language server settings. The new behavior is deterministic in that pyright type checking settings in a config file always take precedence over language server settings.

@Hnasar
Copy link

Hnasar commented Sep 12, 2024

can you provide more information about your use case?

By 'users' I mean to say 'team members who contribute to our repository' (I help maintain the linter config for a large repository).

We have a pyrightconfig.json which influences pylance in terms of file indexing, and go to definition. For example, we define things like stubPath, pythonVersion and several executionEnvironments which are settings shared among different subprojects within the repository.

Previously, contributors to a project were seeing inconsistent type checking behaviors between their pyright command line tool and their editor because some members of the team were (unintentionally) overriding type checker configuration in their language server settings

I can see the benefit of deterministic configs between CLI and editor. One way to resolve this issue is by setting a project's workspace settings accordingly. For example, if a project wants to enforce a particular level of checks, vscode's settings precedence has workspace settings with a higher precedence than user settings: so if there is a .vscode/settings.json with

    "python.analysis.typeCheckingMode": "standard",

then there's no way for team members to unintentionally override the config.

Separately, I can envision this change causing other issues; for example, if most of a codebase adheres to typeCheckingMode=standard but some developer prefers to be held to typeCheckingMode=strict then they could previously override their editor config (on a per-developer basis) to see extra errors in the editor without affecting CLI runs of pyright, e.g. in CI.

Perhaps pylance should use the pyright config as a lower bound, but allow users to opt-in to a higher level of checks?

Basically my user story is — As someone who maintains a baseline shared config for a number of team members, I want to have checked-in config for pright/pylance that by default hides errors in the editor, but provides a way for users to opt-in to stricter checks without having to resort to a bunch of different copies of the pyright config. Said differently, I want to decouple the project config from the user config.

@erictraut
Copy link
Contributor

@Hnasar, thanks for the additional details about your use case. Very helpful.

Your usage of pyrightconfig.json to influence behaviors of pylance strikes me as pretty atypical. Could you provide more details about why you're using this approach? You mentioned that you're using executionEnvironments. How are you using that to influence pylance behaviors? The pyrightconfig.json file (as its name implies) applies to pyright's type analysis behaviors. Pylance's language server features that layer on top of pyright are generally controlled by language server settings. The fact that you felt compelled to use pyrightconfig.json to influence pylance behaviors may hint at some missing functionality in pylance.

Am I correct in assuming that your team's .vscode/settings.json file is under source control? If so, it would be preferable to move all pylance settings to this file. That would allow you to delete the pyrightconfig.json and the [tools.pyright] section of pyproject.toml. If you can do that, I think you'd get the behavior you're looking for.

If that approach doesn't work, another option is to set typeCheckingMode to "off" in your pyrightconfig.json file. You can then tell team members who want to use pyright as a type checker to temporarily edit their pyrightconfig.json file to override this.

I see a couple of issues with your proposal to use the pyright config as a lower bound. First, composition of settings is more complex than that. The typeCheckingMode serves as an initial baseline for a bunch of settings, but each of those can be further overridden in the config file. Second, a lower bound doesn't achieve what we were trying to do with our recent change — to make type checking settings consistent across CI and the editor for all project contributors. To achieve this goal, we need to make sure that config settings always take precedence over language server settings.

It sounds like you are not concerned about members of your team seeing divergent type analysis behaviors. That contradicts feedback that we've received from other pylance / pyright users, so we'll need to think about whether (and how) to reconcile this contradictory feedback.

One more question, if you don't mind me asking. I'm curious why your team is using mypy for type checking rather than pyright. Maintaining support for two different type checkers can be costly. Mypy is known to have a lot of idiosyncrasies, bugs, and non-conformance with the Python typing spec. Is there something that keeps you from switching to pyright for type checking? If you did this, it would eliminate issues with configuration because you'd be using the same config for your editor and CI.

@raylu
Copy link

raylu commented Sep 12, 2024

our situation is the exact same as hnasar's! we primarily use mypy but some users want to turn on pyright. we put some settings in pyproject.toml in a [tool.pyright] section which is checked into version control. we have also added a typeCheckingMode="off" as a temporary workaround but, because there's no way to override settings in pyproject.toml via another file, this effectively turns it off for everyone

I'm also curious why you previously added an empty [tool.pyright] section to your pyproject.toml file.

my example of an empty section was just to repro the problem. our actual section has some configs to reduce typechecking errors

The new behavior is deterministic in that pyright type checking settings in a config file always take precedence over language server settings.

determinism is desirable, but the precedence seems backwards here. the editor uses the language server, which picks whether or not to use pyright. with this change, now the pyright config affects the editor, even though pyright doesn't know anything about it

it would be preferable to move all pylance settings to [.vscode/settings.json]. That would allow you to delete the pyrightconfig.json and the [tools.pyright] section of pyproject.toml

that's what we plan to do next (though we put our settings in a code-workspace because, annoyingly, folder configs override all other configs, so there's no way for users to override configs if we check in .vscode/settings.json). but that effectively means we cannot configure pyright itself. if we ever want to run pyright from the CLI or use pyright typechecking in any other editor besides vsc, we must reconfigure it again

this precedence really seems odd. we configure black, ruff, mypy, pylint, flake8 and non-python tools (eslint, tsc, etc.) globally and then the editor picks up the settings and layers any editor-specific changes on top. we can turn off black formatting in vsc and turn on ruff formatting without deleting the black config; we can turn off flake8 in vsc and use ruff lint without removing the flake8 config; but the only way to turn off pyright in vsc is to remove the pyright config

@Hnasar
Copy link

Hnasar commented Sep 12, 2024

(+1 to @raylu's perspective, moving settings into the language server makes it harder to use a shared config for pyright in other scenarios, and I like the comparison with other tooling configs.)

Your usage of pyrightconfig.json to influence behaviors of pylance strikes me as pretty atypical. Could you provide more details about why you're using this approach?

I didn't realize that there was a difference between pylance's configuration and pyright's configuration. My assumption (before this issue) is that they're equivalent. I see now that most of the settings that we have in pyrightconfig.json can be specified instead in .vscode/settings.json. As a workaround, I can try moving the settings there and seeing if I can delete the pyrightconfig.json; if so that would restore the previous behavior of "only those who have enabled typeChecking in their user settings will see pylance type checking errors" .

It sounds like you are not concerned about members of your team seeing divergent type analysis behaviors

With our company workflow, we have a multi-language large monorepo (millions of lines) with teams working on isolated projects. Each team works on a small subset of the repository, and has control over the static analysis tooling for their subdirectory. Some teams wish only to use pylint; others use mypy, etc. Recently some teams have expressed interest in pyright. Because of this, I'm not concerned about team members seeing different type analysis behaviors. As a baseline, team members don't see pylance analysis errors. Some team members who wish to opt-in to pylance analysis are happy to have the extra checks and don't mind the false positives.

(Another minor point I'm considering: we have a handful of team members who use neovim, with coc-pyright as a language server, and this tool also honors pyrightconfig.json for language server settings, which has made the file a convenient place to put type checking config used between these two language servers.)

Your usage of pyrightconfig.json to influence behaviors of pylance strikes me as pretty atypical. Could you provide more details about why you're using this approach?

As for why we use pyright's executionEnvironments, due to the size of our repository, pylance often struggles to index the entire repo.

We explored using pyright's excecutionEnvironment settings to limit the amount that pylance needs to index when working on a given subdirectory. I'm not convinced it works very well and seem to recall some bugs; so this is still an open issue for us. We also explored using vscode's workspace support, which didn't work for our use-case. It either requires duplicating .vscode/settings.json configs into separate top-level code-workspace files; or working out of a subdirectory as a multi-root workspace. Both options weren't great (code-workspace files are a hassle to open; and we have common utilities in the repo root, but the vscode terminal opens up with the multi-root subdir as cwd which team members found annoying). Our current best workaround is to have pyrightconfig.json as a symlink which developers on different teams can overwrite as needed and modify the extraPath lists.

why your team is using mypy for type checking rather than pyright

The major blocker to using pyright is a longstanding heavy reliance on attrs. Though I'm personally very appreciative of PEP 681, we have several thousand non-dataclass-transform usages of attrs features (things like @default or @validator). We also have a mypy plugin for some dynamic code transformations. Mypy has idiosyncrasies, but we have worked through them. And out of curiosity, I just ported my 20k line app to pyright and came across a handful of different idiosyncrasies.

Click for off-topic pyright idiosyncrasy

I can file some issues for the false positives once I investigate them a bit more, e.g. I see for a number of function calls into third party code, pyright seems to be getting confused about the origin of certain classes, and issuing false positives.

git_utils.py:98:25 - error: Argument of type "Commit" cannot be assigned to parameter "rev" of type "str | Commit | SymbolicReference | None" in function "iter_commits"
    Type "Commit" is not assignable to type "str | Commit | SymbolicReference | None"
      "commit.Commit" is not assignable to "git.objects.commit.Commit"

@RBnzr
Copy link
Author

RBnzr commented Sep 12, 2024

What exactly is the error you're getting @RBnzr? Can you share a screenshot?

Hey @rchiodo sorry I was away from my desk.
this is a part of the error:

Note that each error says line 1, this was the whole python class when running the full code chunk(more errors like below), and I tried it with another Class and it was giving the same error per line.

perhaps the issue might only be affecting classes?

```shell
class CustomConnector: ... def init(self, client): ... self._client = lookup_client_id(client) ... self.advertiser_id = self._client ...
... self.url = "https://api.Custom.com/graphql" ... self.token = get_azure_secret('CustomToken') ... self.headers = { ... 'Authorization': f'Bearer {self.token}' ... } ... ... self.transport = RequestsHTTPTransport(url=self.url, headers=self.headers) ... self.client = Client(transport=self.transport, fetch_schema_from_transport=True) ... def execute_query(self, query, variables=None): File "<stdin>", line 1 def execute_query(self, query, variables=None): IndentationError: unexpected indent result = self.client.execute(query, variable_values=variables) File "<stdin>", line 1 result = self.client.execute(query, variable_values=variables) IndentationError: unexpected indent return result File "<stdin>", line 1 return result IndentationError: unexpected indent

File "<stdin>", line 1 def _map_results_to_schema(self, result, schema): IndentationError: unexpected indent """Maps results from Snapchat API to a schema File "<stdin>", line 1 """Maps results from Snapchat API to a schema IndentationError: unexpected indent

File "<stdin>", line 1 Args: IndentationError: unexpected indent result (dict): Result from Snapchat API File "<stdin>", line 1 result (dict): Result from Snapchat API IndentationError: unexpected indent schema (dict): Schema to map results to File "<stdin>", line 1 schema (dict): Schema to map results to IndentationError: unexpected indent

File "<stdin>", line 1 Returns: IndentationError: unexpected indent row (dict): Row mapped to schema File "<stdin>", line 1 row (dict): Row mapped to schema IndentationError: unexpected indent """ File "<stdin>", line 1 """ IndentationError: unexpected indent row = deepcopy(schema) File "<stdin>", line 1 row = deepcopy(schema) IndentationError: unexpected indent for k,v in result.items(): File "<stdin>", line 1 for k,v in result.items(): IndentationError: unexpected indent row[k] = result[k] File "<stdin>", line 1 row[k] = result[k] IndentationError: unexpected indent return row File "<stdin>", line 1 return row IndentationError: unexpected indent



@rchiodo
Copy link
Contributor

rchiodo commented Sep 12, 2024

Sorry I'm not following. Is that the output from the runtime? Pylance isn't involved when running?

@RBnzr
Copy link
Author

RBnzr commented Sep 13, 2024

@rchiodo Those are the errors I get when running the code.

@rchiodo
Copy link
Contributor

rchiodo commented Sep 13, 2024

That should be a bug in your code, not Pylance or VS code. Updates to VS code or Pylance wouldn't affect the Python runtime. Unless there's some weird spacing problem? Maybe VS code is auto formatting with tabs?

@RBnzr
Copy link
Author

RBnzr commented Sep 13, 2024

@rchiodo
so why is it that when I downgraded pylance it worked fine?, is there a better way I can share the code with you so you can recreate the issue on your end?

@rchiodo
Copy link
Contributor

rchiodo commented Sep 13, 2024

You can zip the code and e-mail it to me. My email is my github id at microsoft dot com.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs repro Issue has not been reproduced yet settings-override Feedback that pyrightconfig.json is taking precedence user responded Was "waiting for user response" and they responded
Projects
None yet
Development

No branches or pull requests

9 participants