I am new to python. I am writing programs in NetBeans.
NetBeans 8.1
Python Plugin for NetBeans
Python 3.5.1
Plugin is set up for 3.5.1, instead of the default 2.7
NetBeans complains when I write the statement
print ("_ ", end='')
The error is
no viable alternative at input '='
It appears that NetBeans is checking for 2.7 syntax, instead of 3.5. I am able to run the code, so NetBeans is using 3.5 to execute.
How do I configure NetBeans so it uses the correct syntax checking?
After the recommendation of #alecxe, I reported a bug to NetBeans.
NetBeans does not support python 3.x. The plugin runs the correct version, but the IDE syntax checking is linked to 2.x.
Thank you for your report. Note that we do not officially support
Python 3.x yet. However, It is a high-importance task on our nbPython
Jira board... Marking this bug as Duplicate. Suggest you follow
Bug#229940 for notification.
PS. PyCharm is great.
The problem is reproducible on my end too. Even if the default Python Environment is set to Python3.5 and the Project Interpreter is also set to Python3.5, it still uses Python2 specific syntax checks. For example, it does not highlight the print if it is used as a statement and not function:
I don't think this particular behavior is configurable and this is a bug (I suspect the bundled Jython is used for the "live" syntax checking). You should definitely file an issue here.
External tools like PyLint might help, but it is not yet integrated.
And, just saying, PyCharm has a completely free community edition.
Related
All support seems to be for Python version 3. Surely there must be a way to get correct syntax highlighting / basic linting for Python 2.7 in VS Code?
I am doing a piece of uni coursework that requires us to use version Python 2.7 and want to be able to get this set up and working within VS Code for easy development and debugging.
Any plugins or modifications to the settings of IntelliSense I can use?
Cheers,
For auto-completion, you can turn off auto-completions, or select Pylance as your language server as it may provide a good experience if the code is compatible enough with Python 3. We will continue to support selecting Python 2.7 as an interpreter in your workspace. For tools that keep support for Python 2.7 in their actively maintained version, we will continue to support using them with Python 2.7.
For more information.
PyCharm 2017.2 highlights my f-strings with the message Python version 3.5 does not support a 'F' prefix.
But...
In File | Settings | Editor | Inspections, Code compatibility inspection is unchecked, both for Default (stored in IDE) and for Project Default (stored in project). (I have seen other questions where the answer was about this point. Not applicable here.)
Even if I turn Code compatibility inspection on and check only Python 3.6, I still get the message about Python 3.5.
File | Invalidate Caches / Restart fixes it briefly, until the Indexing message goes away, then it comes back.
I don't have Python 3.5 installed (only 2.7, 3.6 and 3.7). Python 3.7 is set as the project interpreter.
This behaviour is new, since I started using Python 3.7 for real. If I change the interpreter back to Python 3.6 it goes away. I don't regard that as a useful workaround.
Either this is a bug I should report, or I am missing something that should be obvious. Anyone care to tell me which it is?
I think PyCharm 2017.2 is too old and you should use PyCharm 2018.2. That old version was published before Python 3.7, so you may encounter troubles…
So I'm trying to set up Eclipse for Python use.
I downloaded the 64 bit Eclipse, 64-bit Java SDK environment, and the PyDev extension for Eclipse.
I've been trying to follow this particular tutorial: https://www.youtube.com/watch?v=CryTwaJGpPM
I am using Python's 2.7 grammar yet my print statement (print p) is saying invalid syntax and works if I use Python 3.0 grammar [print (p)]
The following screenshots outlining the run config, interpreter, grammar version I'm using, and output.
http://imgur.com/a/jvnTa
Any idea on why it's enforcing the 3.0 grammar?
I would like to use 2.7 or 2.6.
Thanks for your help.
Look carefully at your screenshot of the run configuration. All of your paths are set to C:\Python34. Change them to your Python 2 directory, so you'll be using the correct (Python 2) libraries.
Also, look at your last screenshot: you may have Python 2 selected as your grammar, but you've configured it to use your Python 3.4 interpreter when it actually executes. Change your interpreter setting to wherever your Python 2 interpreter is and it will execute your scripts with that interpreter instead.
I've been writing C extensions to Python for a while, but have been on other tasks for the past year or so. It looks like I'm going to come back to this soon, but in the meantime I've upgraded my Mac to Mavericks. And of course, suddenly, EEK! GDB is gone! And I can't find a startup file for LLDB (like the existing GDB version in Misc/gdbinit) that knows how to reach into the CPython interpreter and tell me about objects. (Or any easy Emacs-LLDB integration like I had with GDB.)
What's the consensus on the best way to debug C extensions now? Go build a custom GDB? Learn LLDB and write my own integration? Use some IDE that 'just does' all this? Just stop trying to do this on a Mac and do it in Linux instead?
(Just to make things even more fun, I need to do this in Python 2.6 to be compatible with our existing RHEL installations... which means I also need to fix the readline bug that causes Python 2.6 to crash on Mavericks -- and that's how I discovered these issues. Sigh.)
I'm trying to find a decent IDE that supports Python 3.x, and offers code completion/in-built Pydocs viewer, Mercurial integration, and SSH/SFTP support.
Anyhow, I'm trying Pydev, and I open up a .py file, it's in the Pydev perspective and the Run As doesn't offer any options. It does when you start a Pydev project, but I don't want to start a project just to edit one single Python script, lol, I want to just open a .py file and have It Just Work...
Plan 2, I try Komodo 6 Alpha 2. I actually quite like Komodo, and it's nice and snappy, offers in-built Mercurial support, as well as in-built SSH support (although it lacks SSH HTTP Proxy support, which is slightly annoying).
However, for some reason, this refuses to pick up Python 3. In Edit-Preferences-Languages, there's two option, one for Python and Python3, but the Python3 one refuses to work, with either the official Python.org binaries, or ActiveState's own ActivePython 3. Of course, I can set the "Python" interpreter to the 3.1 binary, but that's an ugly hack and breaks Python 2.x support.
So, does anybody who uses an IDE for Python have any suggestions on either of these accounts, or can you recommend an alternate IDE for Python 3.0 development?
Cheers,
Victor
Try PyCharm from JetBrains.
You did not mention these so I'm not sure if you've tried them but there are:
- Aptana (aptana.com)
- The Eric Python IDE (http://eric-ide.python-projects.org/)
- WingWare Python IDE (wingware.com)
I haven't used any of them so I don't know if they will match your needs, but I'd expected them to be pretty close as they are all mature.
As for PyCharm, I've been using it for a while and it's fine, actully I like it very much.
However I'm a Python noob and probably do not use many advanced features so YMMV.