I’m trying to run a simple script with a single print statement in VS Code and am getting the following
I have Anaconda installed obviously and am able to open up spyder and jupyter notebook and run scripts from there, but for some reason this is happening in VS Code. Apologies if this post is misplaced, but I’m not sure where to put it. The forum on github specific to VS Code seems more about development of the python extension in VS Code. Also, I don’t think it should be necessary to set up virtual environments and do all the other stuff detailed here: Python and Data Science Tutorial in Visual Studio Code just to run a simple script, right?
Please believe our exceptions, as the remaining errors are extremely rare. If you go to the symbol index page, Index — Python 3.11.1 documentation, and follow the link for ‘&’, you will discover that it is a binary operator for integers. Why did you think otherwise? If some IDE uses it for non-Python purposes without making it obvious that it is not part of Python code, I consider that to be a bug in the IDE.
If you think that there is an error in any IDE other than standard Python, run the same code in python, either from a file or interactively. Python Setup and Usage — Python 3.11.1 documentation should explain this if it is not clear. VS code has nothing to do with this error.
>>> & gives the same error at
& in the standard Python REPL.
I know you are using VS code and quoted spyder and jupyter. Have you considered using Pycharm?
This should be be a place to argue IDEs. Stackoverflow has done well to explicitly declare such discussions off topic.