-
Notifications
You must be signed in to change notification settings - Fork 103
-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gedit 3.8.3 only supports python3 plugins #121
Comments
The EditorConfig core already supports Python 3. It should be fairly easy to support Python 3 with the Gedit plugin. |
Getting the plugin to load only takes a 2-line change, so that's good. Once it's loaded, though, things still don't work correctly, and I am still looking into that. Apparently, the GObject bindings have changed between python2 and python3. |
Ok, I have a locally-modified version of this plug-in which works correctly on my machine. I would like to push my changes up to GitHub, but I'm not sure what the best approach would be. The problem is that there are actually plugins in this repository, one for Gedit 2.x and one for Gedit 3.x. Both plugins share a common source file, |
Gedit 3 also needs to support Python 2 because not everyone is running a I think the best approach is to support both Python 2 and Python 3 in the My suggestion is: create a branch for your new Python 3-compatible code and On Mon, Sep 23, 2013 at 5:44 PM, William Swanson
Trey Hunner |
I originally thought this might not be possible, since the GObject API had changed a bit between Python 2 and Python 3. Fortunately, the Python 3 way works in Python 2 (tested in an Ubuntu VM) |
After doing a git blame on the gedit source code, it looks like the change to python3 was in commit 74cf9539, made after version 3.7.2-12 was tagged. Therefore, this only affects the most recent released version (3.8). The install script still needs to be modified to check for this version and install an updated plugin file. |
I think we can and should make only one plugin file that works regardless of the Gedit 3 version. Most of the Python projects I work on are both Python 2 and Python 3 compatible. It's usually not very difficult to do. |
I have already finished this part. It's in the pull request. The part that isn't done is the meta-data, which tells gedit which plugin loader to use. This is just a one-line change, but it needs to be conditional based on the version of gedit is in use. For 3.8, it needs to say |
Ah I see. I wonder how other plugins are handling this. This seems like it would be a very universal problem for Gedit plugins. |
I checked a few examples, and they seem to be hard-coding the "python3" bit. If you have an older version of gedit, they must expect you to use an older version of the plugin. |
I run Gedit 3.10.4, within Gnome 3 shell. Trying to enable EditorConfig Gedit plugin after installation, I still get the same error:
Plugin version is 0.5.1
|
This is an odd bug. If I change Example:
I have an inadequate understanding of the difference in the import style between the various versions of Python. I may be able to look into this issue this next week. If someone gets to it sooner, feel free to start a pull request or comment on this issue. |
How did you install the plugin? There are actually three versions of the plugin in the same repo, and the install script is responsible for selecting the correct one. In the case of gedit 3.8+, the install script actually edits python3 support into the source files using a sed script. So, I can easily see how you would have problems if you used the wrong install procedure. |
Hi @swansontec,
You also mentioned:
In fact, I don't see this happening in install.sh script, the only sed invocation is to grab currently installed Gedit version. Modifying |
Aha! That tarball contains a really old version which doesn't contain any of my python3 fixes (getting it to work with python3 took a lot of effort). So, you need to use the latest git version for now. Trey, maybe we should think of making a new release tarball with my fixes? |
@swansontec you're right. I was wondering how I never noticed this problem before. We need to roll a new release. @sergiy-kozak in the meantime you can download the ZIP from the master branch directly and it should work: https://github.com/editorconfig/editorconfig-gedit/archive/master.zip |
I can't do a release, so I'll leave that in your hands. |
The new release has been tagged, and the readme updated. |
@swansontec thanks! |
@swansontec, thanks for making a release with the recent changes. I had a moment to test this latest release v 0.5.3 of the plugin. Installation using install.sh script finished successfully, with the message
The issues still don't seem to be gone... P.S. just to remind versions:
|
Ah, it looks like you haven't installed editorconfig-core-py. You have to cd into that directory and run setup.py. |
I think checkout the submodule should be enough. You can choose to install it, for sure. |
Thanks for pointing to that, @swansontec, just installed editorconfig-core-py, no errors, finished OK. Started Gedit and tried to enable plugin again. Unfortunately same import error. What could it be, it looks now totally strange because I can see in python interactive console:
so everything for editorconfig is right there, ready to use. Any ideas how to fix that import errors? |
Are you running python 2 or python 3? It sometimes gets confusing with both versions installed on the system. @xuhdev No, you definitely need to install the core separately from the plugin. |
A couple of commands to see the version information:
So python currently used is 2.7.5, but could it be that Gedit messes things up by selecting not system-wide configured python, meaning python 3.3? |
Ah, so, when you ran that setup script, it installed the editorconfig-core for python2, not python3. Since the plugin is python3, from his perspective, editorconfig-core is not installed. Therefore, you somehow need to install the core for python3. |
@swansontec actually you should not need to install the EditorConfig module globally for this plugin to work. That's why the core library is included in the repository. See the top of the |
@treyhunner That's a nice theory, but that's not how it's coded. The install script only copies over the plugin files, not the core. Things have been this way since a while now; they were certainly this way when I did the python3 fixes. If this is not how they are supposed to be, then that's a bug that needs to be fixed. Since I don't have time to fix the install script right now, installing the core globally is the only way to make the plugin work. |
hacked a fix for latex plugin using |
I tried installing the editorconfig gedit plugin on my Arch Linux box, only to see the following error:
After some deep research, it turns out that the latest version of gedit no longer contains python2 plugin support. Therefore, our options are to either port the plugin to python3 or re-write it in C.
The text was updated successfully, but these errors were encountered: