BradenM / micropy-cli

Micropython Project Management Tool with VSCode support, Linting, Intellisense, Dependency Management, and more!
https://micropy-cli.readthedocs.io
MIT License
316 stars 25 forks source link

getting various errors #525

Closed Mrqozy closed 1 year ago

Mrqozy commented 1 year ago

Describe the bug im getting many errors such as "Expected no arguments to "Pin" constructor" led=Pin(2,Pin.OUT)

Expected 0 positional arguments even for print function!

Expected Behavior Pin requires positional arguments

Current Behavior im getting many errors such as "Expected no arguments to "Pin" constructor" led=Pin(2,Pin.OUT) image

Steps to Reproduce

  1. use pin constructor
  2. use print function

Possible Solution

Logs

Context (Environment)

BradenM commented 1 year ago

@Mrqozy,

Hi. This gives very little to go off and I cannot help without more details. Please add logs as well as more context around what stubs you are using, what device you are using, your configuration, etc.

Mrqozy commented 1 year ago

@Mrqozy,

Hi. This gives very little to go off and I cannot help without more details. Please add logs as well as more context around what stubs you are using, what device you are using, your configuration, etc.

im using micropython-esp32-stubs and almost every other stub give "print" is not defined" and "range" is not defined" error.

im using esp32

pymakr.conf { "address": "192.168.4.1", "username": "micro", "password": "python", "sync_folder": "src", "open_on_start": true, "safe_boot_on_upload": false, "py_ignore": [ "pymakr.conf", ".vscode", ".gitignore", ".git", "project.pymakr", "env", "venv", ".python-version", ".micropy/", "micropy.json" ], "fast_upload": false }

image

Mrqozy commented 1 year ago

print and range are recognized after commenting out this line "python.analysis.typeshedPaths": [".micropy\micropython_esp32_stubs-1.19.1.post13", ".micropy\BradenM-micropy-stubs-4f5a52a\frozen", ".micropy\hhhh", "typings"],

full settings.json: { // Loaded Stubs: micropython-esp32-stubs

"python.languageServer": "Pylance",
"python.analysis.autoSearchPath": true,
"python.autoComplete.extraPaths": [".micropy\\micropython_esp32_stubs-1.19.1.post13", ".micropy\\BradenM-micropy-stubs-4f5a52a\\frozen", ".micropy\\hhhh"],
"python.analysis.diagnosticSeverityOverrides": { "reportMissingModuleSource": "none" },
// "python.analysis.typeCheckingMode": "basic",
"python.autoComplete.typeshedPaths":  [".micropy\\micropython_esp32_stubs-1.19.1.post13", ".micropy\\BradenM-micropy-stubs-4f5a52a\\frozen", ".micropy\\hhhh", "typings"],
// "python.analysis.typeshedPaths":  [".micropy\\micropython_esp32_stubs-1.19.1.post13", ".micropy\\BradenM-micropy-stubs-4f5a52a\\frozen", ".micropy\\hhhh", "typings"],

"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.analysis.extraPaths": [
    ".micropy\\micropython_esp32_stubs-1.19.1.post13",
    ".micropy\\BradenM-micropy-stubs-4f5a52a\\frozen",
    ".micropy\\hhhh"
]

}

UchihaYuki commented 1 year ago

im getting many errors such as "Expected no arguments to "Pin" constructor"

Have you solved your problem? I have encountered the same thing.

UchihaYuki commented 1 year ago

Instead of using esp32-micropython-1.15.0 as the stubs of my project, I switch to the following:

"stubs": {
    "micropython-esp32-stubs": "1.19.1.post13",
    "micropython-stdlib-stubs": "0.9.0"
}

Everything works now. But I still have other problems.

Mrqozy commented 1 year ago

im getting many errors such as "Expected no arguments to "Pin" constructor"

Have you solved your problem? I have encountered the same thing.

Like I mentioned comment these lines in the settings.json under the folder .vscode

For pwm error you can just type next to the error line #type: ignore

This will tell pylance to ignore the error.

It's not a perfect solution but it's a start, until now the creators of this resp. didn't reply again even after I provided the info they asked for.

Mrqozy commented 1 year ago

Instead of using esp32-micropython-1.15.0 as the stubs of my project, I switch to the following:

"stubs": {
    "micropython-esp32-stubs": "1.19.1.post13",
    "micropython-stdlib-stubs": "0.9.0"
}

Everything works now. But I still have other problems.

Can you use multiple stubs in one project?

Mrqozy commented 1 year ago

im getting many errors such as "Expected no arguments to "Pin" constructor"

Have you solved your problem? I have encountered the same thing.

image this is the fix, frequency is not positional argument but a keyword one

Mrqozy commented 1 year ago

sorry for the mistake i just had to use a keyword argument for the frequency not a positional argument