pythonic-emacs / anaconda-mode

Code navigation, documentation lookup and completion for Python.
GNU General Public License v3.0
708 stars 87 forks source link

Problematic path with TRAMP on Windows #292

Closed yolcu closed 4 years ago

yolcu commented 6 years ago

I am using Emacs 25.3 with the latest install of anaconda-mode. When I am editing a remote file via C-x C-f /plink:lake:~/test.py (lake is the ssh alias for the server that I am connecting to), I get the error in the minibuffer: Server error: OSError(22, 'Invalid argument').

*anaconda-mode* buffer displays the below traceback:

127.0.0.1 - - [26/May/2018 20:07:40] ================================================================================
Traceback (most recent call last):
  File "c:\Users\Emre\.emacs.d\anaconda-mode\0.1.11\service_factory-0.1.5-py3.6.egg\service_factory\service.py", line 101, in apply
    result = method(**params)
  File "c:\Users\Emre\.emacs.d\anaconda-mode\0.1.11\anaconda_mode-0.1.11-py3.6.egg\anaconda_mode.py", line 33, in wrapper
    return f(Script(source, line, column, path, environment=script_env))
  File "c:\Users\Emre\.emacs.d\anaconda-mode\0.1.11\jedi-0.12.0-py3.6.egg\jedi\api\__init__.py", line 104, in __init__
    os.path.dirname(self.path)if path else os.getcwd()
  File "c:\Users\Emre\.emacs.d\anaconda-mode\0.1.11\jedi-0.12.0-py3.6.egg\jedi\api\project.py", line 174, in get_default_project
    return Project.load(dir)
  File "c:\Users\Emre\.emacs.d\anaconda-mode\0.1.11\jedi-0.12.0-py3.6.egg\jedi\api\project.py", line 46, in load
    with open(cls._get_json_path(path)) as f:
OSError: [Errno 22] Invalid argument: 'c:\\plink:lake:\\home\\emre\\.jedi\\project.json'

Note that I am not trying to use the remote Python executable in any way. I would like to rely on the local Python for anaconda. Also, I know that anaconda does not work with hostname aliases, but the issue seems to be due to something else with the path since I get a similar error even when I do not use the alias.

I should also add that with everything set up in the exact same way, and using ssh instead of plink, on Mac OS X everything works correctly, so I guess this is a problem with Windows paths?

proofit404 commented 6 years ago

Hi. I'm not familiar with Python on Windows. Probably this issues related to easy_install and eggs on windows.

proofit404 commented 6 years ago

Please, Retry with 0.1.12. Installation logic was reimplemented.

yolcu commented 6 years ago

Having the same issue with 0.1.12. I don't think this has to do with easy_install and eggs on Windows, but rather jedi looking for a configuration file within the root directory, and this directory is a remote one (like c:\\plink:<remotehost>:\\<projectpath>\\.jedi\\project.json) and the path functions in Python raise an error when this is passed as argument. Somehow, on OS X everything works fine (where we also have ssh instead of plink).

Edit: As a workaround, how about ignoring project-specific jedi configuration when the project directory is a remote one connected via TRAMP?

proofit404 commented 6 years ago

Recent anaconda-mode does not compare connection against ssh method.

Do you use Vagrant or Docker? Can you try the recent package from master?

yolcu commented 6 years ago

I am not using Vagrant or Docker. I can try the package from master, however I cannot get the installation to complete successfully. What I did is:

Yet this does not create the directory anaconda-mode in my .emacs.d as the installation from MELPA does. Any idea what I am doing wrong?

CeleritasCelery commented 5 years ago

@yolcu are you still having an issue?