You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
python 3.9.2 windows argparse no module _typeshed #5201
Traceback (most recent call last):
File "C:\Users\Star\git\optomata\options.py", line 1, in <module>
from _typeshed import AnyPath
ModuleNotFoundError: No module named '_typeshed'
Reacted by Pritom Mojumder, Vasupradharamac, Yogesh Chandrasekharuni, Jakub Sucheta, AndresQuiVal, Akshat Rustagi, Martin Lukasik, reecelui, tingirifistik, Arun Thakur and 1 more
Reacted by Zubayer Rahaman, Radosław Andrusiak, Dalunacrobate, Pritom Mojumder, Jakub Sucheta and reecelui
none, I copy paste a code and somehow scroll and never saw the problem was on the first line. (on a 3 line file ??? as I said visual studio troll me I don't know how, it add the import line I think)
Reacted by Adrian Staniec, Mathishblt, Jakub Sucheta, Pavel Hanitsch, Альберт, Monish Narwani and Juan Pablo Mantilla
Reacted by Pavel Hanitsch and Akarin_lh
Reacted by Zubayer Rahaman, Dejan and Jakub Sucheta
Can we get more details about how this is happening? What editor and version? What is the name of the file you save the code into? Which button do you click in the editor to run it?
I had the same error and thought i was going mad for a second.
For those asking for more details visual studio code autocomplete had added the following at top of file and then scrolled down causing line 1 to be hidden. As @Stargateur indicates this even happens in very short files.
from _typeshed import OpenTextMode
Reacted by Akuli, Shen, Jafeth Yahuma, Osama Abbas, アレクシス, Henry Haustein, Evelyn Yugsi Yugsi, Narendhar Manimohan, Sunil V Shenoy, jedwards and 3 more
Hey, guys! This happens because inside the code there's some attribute being called when creating basic functions like
open(file="AnyPath", mode=OpenTextMode)
Notice that 'AnyPath' and 'OpenTextMode' aren't variables you created in your code, they are already built in to python and your code is importing them and, whenever we call something from outside our file.py, we must declare it by using
from module import object
What VSCode did was complete the code with those necessary commands for this attributes to work
And what those attributes do?
I haven't gone that far in my research but I suppose it compiles some "raw" parameter for the function open()
open(file/path/and/name, openingMode): #the openingMode defines the purpose of opening the file open(myFile, "r") #means the file is open for read only privillege open(myFile, "w") #means the file is open for write only privilleges open(myFile, OpenTextMode) #probably means it's open with all privilleges
Activity
Stargateur commentedon Apr 10, 2021
OK nevermind, visual studio code troll me
RobertoTables commentedon Jun 2, 2021
So, what was the solution?
Stargateur commentedon Jun 2, 2021
none, I copy paste a code and somehow scroll and never saw the problem was on the first line. (on a 3 line file ??? as I said visual studio troll me I don't know how, it add the import line I think)
manudut commentedon Jun 22, 2021
Yeah, happened exactly the same to me...
Navneety007 commentedon Jun 27, 2021
Yeah same here people
Akuli commentedon Jun 27, 2021
Can we get more details about how this is happening? What editor and version? What is the name of the file you save the code into? Which button do you click in the editor to run it?
BradMclain commentedon Jun 28, 2021
I had the same error and thought i was going mad for a second.
For those asking for more details visual studio code autocomplete had added the following at top of file and then scrolled down causing line 1 to be hidden. As @Stargateur indicates this even happens in very short files.
gabriribeiro5 commentedon Aug 12, 2021
Why this happened?
[answer]:
Hey, guys! This happens because inside the code there's some attribute being called when creating basic functions like
open(file="AnyPath", mode=OpenTextMode)Notice that 'AnyPath' and 'OpenTextMode' aren't variables you created in your code, they are already built in to python and your code is importing them and, whenever we call something from outside our file.py, we must declare it by using
from module import objectWhat VSCode did was complete the code with those necessary commands for this attributes to work
And what those attributes do?
I haven't gone that far in my research but I suppose it compiles some "raw" parameter for the function open()
open(file/path/and/name, openingMode): #the openingMode defines the purpose of opening the fileopen(myFile, "r") #means the file is open for read only privillegeopen(myFile, "w") #means the file is open for write only privillegesopen(myFile, OpenTextMode) #probably means it's open with all privillegesagungkrishna-code commentedon Aug 21, 2021
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from _typeshed import ...
Use this work for me
itapekhin commentedon Oct 26, 2021
python 3.9
Возникала ошибка:
from _typeshed import Self
ModuleNotFoundError: No module named '_typeshed'
Мне помог импорт:
import typing
Mwatchorn26 commentedon Dec 30, 2021
Same here, it automatically added the "from _typeshed import" statement at line 1.
I wonder - Is this a VS Code issue, or caused by an extension?