Using ECF shared editing with Python - python

I can use the shared editing feature of ECF with Java fine perfectly fine. When I try to do it with Python files it also works, but there is no syntax highlighting.
I installed PyDev to get syntax highlighting, but then the context menu does not have the "share editor" option. I removed PyDev and the option came back. I installed Dynamic Languages Toolkit in hopes that its Python syntax highlighting was compatible and I got the same effect (context menu lacks the "share editor" option).
Is there a way to have a shared editing session with Python files and syntax highlighting?

You have to add the context menu into the PyDev editor manually.
You can do this by setting up a plugin with the following inplugin.xml:
<plugin>
<extension point="org.eclipse.ui.menus">
<menuContribution
locationURI="popup:org.python.pydev.editor.PythonEditor.EditorContext">
<dynamic
class="org.eclipse.ecf.docshare.menu.DocShareRosterMenuContributionItem"
id="com.foo.MyVeryOwnEditorContextID.dynamic1">
</dynamic>
</menuContribution>
</extension>
</plugin>
Here, org.python.pydev.editor.PythonEditor.EditorContext is the context id of the PyDev Editor.
If you want to add the context menu item to another editor you'll have to change this id. It can be found by pressing Shift-Alt-F1 while using in editor you want to add it to.
com.foo.MyVeryOwnEditorContextID.dynamic1 simply has to be a unique id of your choice.
You then have to put the plugin .jar file into your plugins folder in the eclipse directory.

There's a Github project called ECF4PyDev which provides a module to perform map the ECF menu commands into PyDev. The project also includes the necessary files in order for direct installation, which makes it easy to use with the Eclipse software installer.
Installation
in Eclipse, go to "Help" -> "Install New Softare..." then click the "Add" button. Add the following information:
Name
ECF for PyDev
Location
http://gilberterik.github.com/ECF4PyDev
The UI should then show a checkbox for ECFPyDev. Select it, then hit next. Continue to follow the wizard until the installation is complete. It may take a moment to finish the install - be patient. After installation, you should be prompted to restart Eclipse.

Related

Pycharm does not show recommendations [duplicate]

PyCharm's autocomplete isn't working for installed libraries. I have the following code:
from boto.emr.connection import EmrConnection
conn = EmrConnection(aws_keys.access_key_id, aws_keys.secret_key)
I want the editor to tell me what methods I have available to me when I press Ctrl+Space.
The boto library is installed in my environment, but it doesn't seem to be detected by PyCharm. How can I set this up correctly?
You've installed the 3rd-party library into a virtualenv, but PyCharm doesn't know about that by default. If nothing is specified, it will choose the system Python install as the interpreter. You need to go into the project settings and configure the interpreter to point at the virtualenv. PyCharm will then index the interpreter and allow you to autocomplete.
The virtualenv may be auto-detected in the dropdown menu on the left. If it is not, click the gear to the right, click "Add local", and select /path/to/virtualenv/bin/python (or \Path\to\virtualenv\Scripts\python.exe on Windows).
The above answer didn't work for me, because I wasn't able to find any project related setting in my setting,and the python Interpreter was empty.
The solution was to delete .idea file, from project root, close Pychram then go to project directory and open it with Pycharm:
$pycharm-professional or $pycharm-professional .
when it lunch a pop up window on the bottom right will appear and as you the following
select configure python interpreter then a new window must appear:
chose to use Pipenv as your interpreter or any other solution that is for your case.
Now the Project setting should appear again in Pycharm setting, and the recommendation must be already working.

Configuring python interpretor with pycharm

Whenever I am configuring python interpreter, on compiling a pop-up is popping up to edit, modify, or uninstall python ,below is the screenshot
The Auto Config feature of the IDE looks for it in the PATH set by the user.
Better way to do it is add it in your system variables from where the IDE could pick it up.
For Mac its under the Library\Frameworks\Python.framework\Versions\X.Y\bin\
For Windows its mostly under C:\PythonXY\python.exe
& For more 'what ifs' you can find it documented here.

Indexing of external library fails in PyCharm 4.5

This issue has come up with previous versions of PyCharm (see this SO post and this one), but it manifests somewhat differently in 4.5.
I am trying to add another library to the Python path of my current project. This is an internal library and consists of a bunch of .py files in a different directory from the current project. I carry out the following steps:
Go to File -> Settings -> Project: summary -> Project Interpreter
Click on the gear icon near the top right corner of the screen that appears in the dialog
Select More... from the context menu that pops up
Click on the interpreter I am using
Click on the last of the 4 icons to the right of that, the thing with a folder and arrows, with tooltip "Show paths for the selected interpreter"
Push + in the resulting popup
Use the file dialog to add the path of the library
Having done this, the result is:
Good:
Running the current project code from a Run Configuration works; that is, the external library is picked up in the PYTHONPATH
The added path does not immediately disappear from the interpreter path dialog, as it was doing in 4.0 (see comment to this answer in one of the SO posts mentioned above).
Bad:
Indexing of the new library fails, and all references to the external library are marked as unresolved references in the editor
I have even tried File -> Invalidate Caches / Restart... and pressed the Invalidate and Restart button that appears. After sitting and waiting for indexing to finish, I get the same result. I have been very careful with setting the right path, and it seems to be correct, given that running the code actually works.
Does anyone know of a workaround for this issue, short of adding the external code as a content root?
I ran into a very similar issue. I am working on an OpenStack component, and all third-party libraries were getting marked as unresolved references. It turned out to be because the .tox directory is automatically excluded by PyCharm, which prevents any virtual environments in that directory from getting indexed properly.
To fix this, I went to the Editor > File Types dialog of the Preferences menu, and removed the .tox folder from the Ignore files and folders option.
Checked w/ JetBrains support, they confirmed that the only ways to add external libraries to a PyCharm project are:
Add the library as a Content Root
OR
Open it as separate project in the same window and attach it to your current project
Not the cleanest approaches, as they both basically mean adding the other library's actual code to your project. But they are the only ones at this point.

How do I configure a Python interpreter in IntelliJ IDEA with the PyCharm plugin?

There is a tutorial in the IDEA docs on how to add a Python interpreter in PyCharm, which involves accessing the "Project Interpreter" page. Even after installing the Python plugin, I don't see that setting anywhere.
Am I missing something obvious?
With the Python plugin installed:
Navigate to File > Project Structure.
Under the Project menu for Project SDK, select "New" and
Select "Python SDK", then select "Local".
Provided you have a Python SDK installed, the flow should be natural from there - navigate to the location your Python installation lives.
I was getting the error (IntelliJ on Ubuntu 18.04) while python SDK was configured.
To fix that, I had to do this:
File -> Project Structure -> Modules
Click on the Dependencies tab, and click on + and select the python SDK
Click on Apply
After that, the warning went away and autocompletion also started working properly
So here is a simple project, where I have used Selenium and added that using external path
Now you need to open Project Structure and go to SDK Section
Now Select your project's virtual environment. In the Classpath tab add the PYTHONPATH by clicking + button
and now the modules will be recognized
If you have multiple modules in your project, with different languages, you can set the interpreter in the following way:
File -> Project Structure...
Select Modules in the list on the left
Select the Python module in the list of modules
On the right-hand side, either choose an existing Python SDK from the dropdown list, or click on the New... button to create either a virtualenv, or create a new Python SDK from a Python installation on your system.
Follow these steps:
Open Setting (Ctrl + Alt + s)
Click on plugins
Find Browse Repositories and click
Search for "python"
Select Python SDK or pycharm
Restart the IDE
Go to project structure
Select the python SDK in projects or create a new project with python SDK.

PyDev Package Explorer doesn't show files in Eclipse

I have been working for weeks using Eclipse's PyDev (Eclipse 3.8.1) and usually I click on files in Package Explorer to navigate through them. Now all of a sudden my Python project looks empty in the Package Explorer, just showing standard python libs.
I tried many things such as:
Refreshing project.
Importing again project to workspace.
Looking at custom filters in "customize view".
Opening project file in the editor and then using "link with editor".
Closing PyDev Package Explorer and opening it again.
Closing and opening Eclipse again (several times).
None of those showed the files. I don't know what is wrong with this project. I think it is not related, but it is also a git project.
Do you know what else is missing for me to try?
Thanks.
Found the solution in PyDev FAQ
The usual checks are:
In the PyDev Package Explorer menu, is the top level elements pointing to working sets, if yes, change it to "Project".
In the PyDev Package Explorer menu, customize view, the content has both, PyDev Navigator Content and Resources checked?
In the PyDev Package Explorer menu, customize view, is it possible that the filters selected are hiding all your elements?
The first item solved my problem.
This is a workaround. You could create a new working set and select the projects that you have created and wish to see them in the PyDev Package Explorer. This trick worked for me.
Steps to create a working set :
Click on the inverted triangle in the PyDec Package explorer.
Select "Select Working Set"
Click New button.
Select Resources and click Next
Select the projects that you wish to have them seen on the explorer -> mention a name of the working set and click Finish button.

Categories

Resources