I have to write an application for a GSM Modem from Telit that uses Python 1.5.2+
I have been using PyCharm CE only as an editor for my code but debugging and testing my code directly on modem hardware.
I've tried to configure my project to use Python 1.5.2+ and PyCharm calls it as "Unknown" as seen below:
I also tried use Python Console but PyCharm doesn't support it.
I don't have enough experience with PyCharm, so I only want to confirm that it doesn't support Python 1.5.2+ or I'm doing something wrong. In last case, how can I configure it to use Python 1.5.2+?
The eldest Python, which PyCharm supports, is 2.4.
Related
Is it possible to use Spyder in conjunction with Micropython? Currently I use an application called Thonny which provides access (and discovery) of my remote (USB) device using a remote interpreter dialog box. I'd like to use Spyder in a similar manner. Spyder has a remote interpreter facility but I an unable to discover my USB device within facility. I'm using Windows10.
I can't find any currently available way of interacting with your MicroPython device directly from within Spyder, but of course you can use Spyder to edit your code and transfer it to the micro using rshell, for example.
In principle it looks like it should be possible to write a Spyder plugin for MicroPython, if your desktop Python skills are good and you fancy a project.
Depending on what board you're running MicroPython on you might be able to use a plugin for Pycharm. There are Pycom plugins for VSCode and Atom but I don't know whether those work for any boards other than the Pycom ones.
I have the Python Extensions for Windows installed. Within the PythonWin IDE I can get autocomplete on Automation objects (specifically, objects created with win32com.client.Dispatch):
How can I get the same autocomplete in VS Code?
I am using the Microsoft Python extension.
The Python Windows Extensions has a tool called COM Makepy, which apparently generates Python representations of Automation objects, but I can't figure out how to use it.
Update
Apparently, the Microsoft Python extension uses Jedi for autocompletion.
I've filed an issue on the extension project on Github.
Note that in general I have Intellisense in Python; it's only the Intellisense on Automation objects that I am missing.
Review
I have confirmed your problem in VSCode, although it may be possible IntelliSense works fine. Note Ctrl+Space invokes suggestions for a pre-defined variable:
However, there does not appear to be public attributes available for win32com.client by default. This may be why IntelliSense does not appear to work.
Test
Having installed win32com for Python 3.6, I have confirmed the following code in Jupyter notebook, IPython console and the native Python REPL:
import win32com.client
app = win32com.client.Dispatch("Word.Application")
len(dir(app))
# 55
[x for x in dir(app) if not x.startswith("_")]
# []
This issue of hidden attributes is not a new. Please confirm this test in another environment/IDE. It may be your environment or particular version of PythonWin pre-loads certain variables in the global namespace.
Verify the following:
The Python extension is installed
A Python interpreter is selected
A Python file is selected; this starts up the Python server
References
Post by the extension's creator for troubleshooting autocompletion issues.
Thread on how autocompletion works via PyScriptor
I don't think that the example you show with PythonWin is easily reproducible in VS Code. The quick start guide of win32com itself (cited below) says, its only possible with a COM browser or the documentation of the product (Word in this case). The latter one is unlikely, so PythonWin is probably using a COM browser to find the properties. And because PythonWin and win32com come in the same package, its not that unlikely that PythonWin has a COM browser built in.
How do I know which methods and properties are available?
Good question. This is hard! You need to use the documentation with the
products, or possibly a COM browser. Note however that COM browsers
typically rely on these objects registering themselves in certain
ways, and many objects to not do this. You are just expected to know.
If you wanted the same functionality from the VS Code plugin a COM browser would have to be implemented into Jedi (IntelliSense of the VS Code plugin).
Edit: I found this suggestion, on how a auto-complete, that can find these hidden attributes, could be done:
These wrappers do various things that make static analysis difficult,
unless we were to special case them. The general solution for such
cases is to run to a breakpoint and work in the live runtime state.
The auto-completer should then include the complete list of symbols
because it inspects the runtime.
The conversation is from an mailing list of the python IDE wingwide. Here you can see, that they implemented the above mentioned approach:
I think your problem is related to defining Python interpreter.
Choose proper Python interpreter by executing python interpreter command in VS Code command palette by pressing f1 or ctrl+shift+p key.
I have a Python-program that uses ctypes and a C-shared library (dll-file). As an IDE, I am using Eclipse, where both projects will be developed (the C-shared library and the python program that uses it).
My idea is: when I start the Python-program in Debug-mode, can I somehow debug the shared library, which is written in C, too? Meaning: Can I set breakpoints and when the Python-program reaches that breakpoint in the shared library, executing stops and I can change variable values etc.?
Actually, it is a fairly simple thing to do using the CDT and PyDev environments in Eclipse.
I assume here that you have already configured the projects correctly, so you can build and debug each one seperately.
Basically, you simply need to start the Python project in Debug mode and then to attach the CDT debugger to the running python process. To make it easier I'll try to describe it step by step:
Run your Python project in debug mode. Put a breakpoint somewhere after the loading of the dll using ctypes. Make note of the pid of the python process created (you should see a first line in the console view stating the pid. something like: pydev debugger: starting (pid: 1234))
Create a Debug configuration for your CDT project, choosing the type "C/C++ Attach to Application". You can use the default configuration.
Debug your project using the configuration you've created. A window should appear, asking you which process you want to attach to. Choose the python process having the right pid.
You can now add breakpoints to you C code.
You'll have two debuggers in the debug perspective, as if they were two different processes. You should always make sure the C/C++ debugging session is running when you work with the python debugger - as long as the C/C++ debugging session is suspended, the python debugger will be unresponsive.
As far as I know, not in eclipse.
However, Python tools for visual studio has this capability:
https://pytools.codeplex.com/wikipage?title=Mixed-mode%20debugging
It is also possible to get this for free. From the Microsoft website, you'll need (as well as a copy of Windows)
1) Visual Studio (paid Pro+ version or free Express versions (starting w 2.1Beta))
2) PTVS extension (this gives VS Python support)
3) A Python interpreter and Python Libraries (these are not bundled with PTVS)
This means that you can debug python and c side-by-side. Calls to libraries written in c are captured by the debugger, provided that they were compiled with symbols by visual studio.
Note that the capabilities of mixed mode debugging tend to be less featured for native python, but it is still capable of using the regular native debugger.
I'm developing a QT based application on ARM, iMX6 device.
Using toolchain from Freescale and Eclipse CDT Kepler, I would like to use pretty printer with GDB.
I followed the tutorial on http://anadoxin.org/blog/node/98 and the setup seems fine (no error while starting GDB).
However when looking at debug view panel, I'm not able to look at any datatype (not only QT but also int, double etc, the whole panel is blank. Furthermore also writing print variable to gdb Eclipse console doesn't generate a valid output).
I think my setup is fine:
GNU gdb (GDB) 7.6 for ARM device
Python: Python 2.7.3
Eclipse: Kepler
KUbuntu 12.04
Is there anyone that can help me understand what is wrong?
Can I send any command to gdb console in order to understand why pretty printer aren't working fine, and even worse, they corrupt the whole gdb debug view variables?
Any help will be really appreciated
I finally fixed it.
The problem was that my toolchain for ARM was built without the support for Python in GDB. If you search the web, you will find that there is a flag in the configuration named (--with-python).
Using it and rebuilding gdb, you will be able to use the python scripts available at
Pretty printers
Hope this will be helpful for the stackoverflow community.
best regards
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.