Sublime Forum

Problem with WinSCP integration

#1

Hello,

I’m giving a try to Sublime, and I am really impressed with it. One of the main reasons to use it for me is the possibility of accessing remote files. I have installed AAALoadFirstExtensions and the WinSCP plugin. Nevertheless, I am not able to browse my ftp site after the connection happens without problems. This is my console log:

Traceback (most recent call last):
File “.\scheduler.py”, line 86, in threaded
for a in gen: pass
File “.\WinSCP.py”, line 247, in connect
File “.\WinSCP.py”, line 184, in populate_bookmarks
File “.\WinSCP.py”, line 110, in _enumValues
File “.\contextlib.py”, line 15, in enter
File “.\WinSCP.py”, line 69, in OpenKey
WindowsError: [Error 2] The system cannot find the file specified

I’m using Windows 7. Can anybody help me?

Thank you very much.

0 Likes

#2

As a quick temporary fix you can comment out this line:
self.populate_bookmarks()

Are you using an INI file to store winscp’s settings?

0 Likes

#3

No, I used the normal installation method, not the portable one.

0 Likes

#4

Ok I think I fixed the bug, just update WinSCP to the latest revision (default branch)

0 Likes

#5

Thank you very much, but I can’t test your modifications. Nothing happens when I press f12 button now. I’ve seen the code lines you’ve changed in the repository, and if I remove them, everything works (except for the bookmarks issue). Nothing happens in the console neither. Do you have any idea of what is happening?

0 Likes

#6

I commited my changes too fast and I didn’t check the indentation.

Please update and try again, it should work now

0 Likes

#7

Yes, it works now! Thank you very much again. I have no idea about Python, so I didn’t realise about the indentation problem.

Cheers!

0 Likes

#8

I hope somone can help… this is a killer feature for me and the one thing stopping me from moving to Sublime.

Downloaded the latest versuins if everything today… using version 20091212 of sublime text. The following is the console output rendered when F12 is pressed: -

Traceback (most recent call last):
File “.\sublimeplugin.py”, line 104, in execWindowCommand
File “C:\Users\neotoxic\AppData\Roaming\SUBLIM~1\Packages\AAALOA~1\scheduler.py”, line 189, in run
next()
File “C:\Users\neotoxic\AppData\Roaming\SUBLIM~1\Packages\AAALOA~1\scheduler.py”, line 188, in next
next()
File “C:\Users\neotoxic\AppData\Roaming\SUBLIM~1\Packages\AAALOA~1\scheduler.py”, line 153, in next
next(send=e, throwing=1)
File “C:\Users\neotoxic\AppData\Roaming\SUBLIM~1\Packages\AAALOA~1\scheduler.py”, line 155, in next
raise Exception(’\n\n’.join(reversed(exceptions)))
Exception: Traceback (most recent call last):
File “.\scheduler.py”, line 130, in next
ret = routines-1].throw(send)
File “.\BrowseFTP.py”, line 88, in run
WindowsError: [Error 2] The system cannot find the file specified

Traceback (most recent call last):
File “.\scheduler.py”, line 133, in next
ret = yielded[0] = routines-1].next()
File “.\BrowseFTP.py”, line 159, in set_session
File “.\WinSCP.py”, line 159, in get_stored_sessions
File “.\WinSCP.py”, line 104, in _enumKeys
File “.\contextlib.py”, line 15, in enter
File “.\WinSCP.py”, line 69, in OpenKey
WindowsError: [Error 2] The system cannot find the file specified

0 Likes

#9

Sorry I was in vacations.

Are you storing your settings in the registry (default behavior) or in an INI file?

0 Likes

#10

Sorry for bothering you again. Suddenly, I can connect anymore. I have no problem using WinSCP directly.

The console log is the following. Any idea?

Thank you very much,
jfcg

Traceback (most recent call last):
File “.\BrowseFTP.py”, line 48, in
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xa2 in position 17: ordinal not in range(128)
Reading remote folder…Traceback (most recent call last):
File “.\BrowseFTP.py”, line 48, in
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xa2 in position 4: ordinal not in range(128)
Traceback (most recent call last):
File “.\BrowseFTP.py”, line 48, in
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xa2 in position 4: ordinal not in range(128)
Error: Can’t connect to ftp
Traceback (most recent call last):
File “C:\Users\pedro\AppData\Roaming\SUBLIM~1\Packages\AAALOA~1\scheduler.py”, line 168, in callback
next(send=value, throwing=1)
File “C:\Users\pedro\AppData\Roaming\SUBLIM~1\Packages\AAALOA~1\scheduler.py”, line 153, in next
next(send=e, throwing=1)
File “C:\Users\pedro\AppData\Roaming\SUBLIM~1\Packages\AAALOA~1\scheduler.py”, line 155, in next
raise Exception(’\n\n’.join(reversed(exceptions)))
Exception: Traceback (most recent call last):
File “.\scheduler.py”, line 130, in next
ret = routines-1].throw(send)
File “.\BrowseFTP.py”, line 82, in run
IOError: Can’t connect to ftp

0 Likes

#11

Looks like an encoding issue. I think you’re either encountering a non-english character or an extended ASCII char (in that case, the “cent” sign)

Can you try changing the line 48 in BrowseFTP.py from this: sublime.setTimeout(lambda: sublime.statusMessage(l), 0) to this: sublime.setTimeout(lambda: sublime.statusMessage(repr(l)), 0)

There’s probably a prettier way to deal with the encoding, but this should work.

0 Likes

#12

Thanks for your answer!

Now I have the following console output:

Error: Can’t connect to ftp
Traceback (most recent call last):
File “C:\Users\pedro\AppData\Roaming\SUBLIM~1\Packages\AAALOA~1\scheduler.py”, line 168, in callback
next(send=value, throwing=1)
File “C:\Users\pedro\AppData\Roaming\SUBLIM~1\Packages\AAALOA~1\scheduler.py”, line 153, in next
next(send=e, throwing=1)
File “C:\Users\pedro\AppData\Roaming\SUBLIM~1\Packages\AAALOA~1\scheduler.py”, line 155, in next
raise Exception(’\n\n’.join(reversed(exceptions)))
Exception: Traceback (most recent call last):
File “.\scheduler.py”, line 130, in next
ret = routines-1].throw(send)
File “.\BrowseFTP.py”, line 89, in run
IOError: Can’t connect to ftp

Traceback (most recent call last):
File “.\scheduler.py”, line 130, in next
ret = routines-1].throw(send)
File “.\BrowseFTP.py”, line 219, in connect
IOError: Can’t connect to ftp

Traceback (most recent call last):
File “.\scheduler.py”, line 86, in threaded
for a in gen: pass
File “.\WinSCP.py”, line 263, in connect
IOError: Can’t connect to ftp

0 Likes

#13

Can you send me the rest of the console output?
“Connecting to ftp” etc.

0 Likes

#14

I changed the WinSCP interface language in order to send you the console log in English, and I have found that was the problem. The package doesn’t work with the WinSCP Spanish interface. There are several special characters in the connection log, such as “Sesión iniciada”, and I think they were causing the issue. I have no problem with the English interface. If you want to test it against the Spanish interface, maybe others could be grateful to you.

Thank you very much for your support,
jfcg

0 Likes

#15

By the way :smile:

Is it easy to change the default temp folder of the script to “My documents” for example?

Thank you!

0 Likes

#16

You’re right, it currently only works if WinSCP sends back English messages. Making it work in other languages is a simple task but I don’t have the time to do it at the moment.

To change the temporary directory, look for the variable “temp_dir” which is populated in WinSCP.py’s “connect” method.
BE VERY CAREFUL though, when disconnecting, it’ll delete files in the temp_dir, so don’t set it to “My Documents” directly! Rather, create an empty directory under My Documents, and assign it to temp_dir.

If you’re comfortable with Python and the plugin, you can checkout the “projectSupport” branch. It has basic support for projects, including a temp dir specific to the project.
It’s working but not finished yet - I’ll continue working on this when I’m less busy.

0 Likes

#17

Thank you very much gpfsmurf.

I am very comfortable with the plugin, but I have no background in Python (although I know Java, C++ and other programming languages). For example, how could I start a new project in that branch?

0 Likes

#18

For more info about the project integration check this bitbucket thread:
http://bitbucket.org/gpfsmurf/winscp/issue/2/project-features-recursive-browsing-of-one-given-remote

0 Likes

#19

Ok! Thank you very much!

Best,
jfcg

0 Likes