NoxArt / SublimeText2-FTPSync

Simple and free FTP(S) syncing (SFTP not available)
MIT License
342 stars 65 forks source link

Rename feature #136

Open winfried-van-loon opened 10 years ago

winfried-van-loon commented 10 years ago

When renaming a file, via the FTPSync 'rename' feature, the file does not get renamed at the server. The following errors are generated. The first error is the 'file not found at the server' error, while the last one is the rename issue error.

plugins loaded
FTPSync > plugin async loaded
SublimeLinter: debug mode: off 
found 25 files for base name Main.sublime-menu
reloading Packages/User/Side Bar.sublime-settings
Package Control: No updated packages
b'FTPSync [default] > Connected to: host:21 (timeout: 30) (key: 2d9c4583cbe5b27e8e3edcf8fdf8d622)'
b'FTPSync [default] > Logged in as: webwinkel (using password: YES)'
b'FTPSync [default] > Getting metadata failed: {folder\\testfile.php} [Exception: ]'
FTPSync > Exception in user code:

Traceback (most recent call last):
  File "ftpsyncwrapper in C:\Users\Stagiair\AppData\Roaming\Sublime Text 3\Installed Packages\FTPSync.sublime-package", line 698, in action
  File "lib3.ftplib in C:\Users\Stagiair\AppData\Roaming\Sublime Text 3\Installed Packages\FTPSync.sublime-package", line 458, in retrlines
  File "lib3.ftplib in C:\Users\Stagiair\AppData\Roaming\Sublime Text 3\Installed Packages\FTPSync.sublime-package", line 238, in voidresp
  File "lib3.ftplib in C:\Users\Stagiair\AppData\Roaming\Sublime Text 3\Installed Packages\FTPSync.sublime-package", line 231, in getresp
FTPSync.lib3.ftplib.error_temp: 450 /public_html/folder/testfile.php: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "FTPSync in C:\Users\Stagiair\AppData\Roaming\Sublime Text 3\Installed Packages\FTPSync.sublime-package", line 1817, in execute
  File "ftpsyncwrapper in C:\Users\Stagiair\AppData\Roaming\Sublime Text 3\Installed Packages\FTPSync.sublime-package", line 739, in list
  File "ftpsyncwrapper in C:\Users\Stagiair\AppData\Roaming\Sublime Text 3\Installed Packages\FTPSync.sublime-package", line 861, in __execute
  File "ftpsyncwrapper in C:\Users\Stagiair\AppData\Roaming\Sublime Text 3\Installed Packages\FTPSync.sublime-package", line 703, in action
FTPSync.ftpsyncexceptions.FileNotFoundException

b'FTPSync > Closing connection'
Writing file /C/Apache24/htdocs/folder/folder/testfile.php with encoding UTF-8 (atomic)
b'FTPSync > Loading config: cache hit (key: C:\\Apache24\\htdocs\\folder\\folder\\testfile.php)'
b'FTPSync [default] > Connected to: host:21 (timeout: 30) (key: 2d9c4583cbe5b27e8e3edcf8fdf8d622)'
b'FTPSync [default] > Logged in as: webwinkel (using password: YES)'
b'FTPSync [default] > Uploaded {folder\\testfile.php}'
b'FTPSync > Closing connection'
b'FTPSync > Loading config: cache hit (key: C:\\Apache24\\htdocs\\folder\\folder\\testfile.php)'
b'FTPSync > Loading config: cache hit (key: C:\\Apache24\\htdocs\\folder\\folder\\testfile.php)'
b'FTPSync > No connection applies'
b'FTPSync > Loading config: cache hit (key: C:\\Apache24\\htdocs\\folder\\folder\\testfile.php)'
Traceback (most recent call last):
  File "FTPSync in C:\Users\Stagiair\AppData\Roaming\Sublime Text 3\Installed Packages\FTPSync.sublime-package", line 3026, in <lambda>
  File "C:\Program Files\Sublime Text 3\sublime.py", line 352, in show_quick_panel
    flat_items.append(items[i][j])
IndexError: list index out of range
NoxArt commented 10 years ago

Hi, I'll look into it. Does everything else work and and the required files are actually both present in proper locations? Since you mentioned case-sensitivity in other thread, are the filenames the same case-sensitively? Thank you for info

winfried-van-loon commented 10 years ago

Hi. Yes, the file was created locally within SublimeText (version 3, windows 7 64bit). Then uploaded with FTPSync (thus the error 'file not found'). After uploading, both files (local and remote) had the same name, including the letter casing. These were PHP files, 'testfile.php'. When rightclicking the file in Sublime's sidebar, then choosing FTPSync, rename, the little bar appeared in which I changed the filename. The little bar with the filename dissapears, leaving the error behind in the console.

Other features of FTPSync work great. Except for the multiselect of folders, then upload, which I mentioned another thread (RuntimeError: maximum recursion depth exceeded #133).

I've noticed that the rename feature does work at some other webservers, like the webserver at home. I'm not quite sure why that is.

Both my sublimetext 3, which I've been using for a while with a bunch of plugins and costum settings, and the sublimetext 3 of the colleague's pc, which is a clean install with FTPSync, have the same problem. We are using the same remote server to upload to, though.

It could be a server-issue. That some setting prevents us from renaming files. In the other hand, the error in the console appears to be somewhere in the plug-in.

If you need more information on the matter, I'll try to answer them.

NoxArt commented 10 years ago

Thank you for detailed response! Yes, the case seems clear then. That sublime-package thing is not cool for debugging (all in one file, so lines are likely off), but I'll try to reproduce it. So the FileNotFound happens when you try to upload a new file? That would be rather weird

winfried-van-loon commented 10 years ago

Yes, the error test, as partly seen below (more in the original post above) makes me think that the uploading is an issue related to the file not being there, on the server, while trying to upload it from local. The file is created at the remote host, however the exception is still thrown.

"FTPSync.lib3.ftplib.error_temp: 450 /public_html/folder/testfile.php: No such file or directory" "During handling of the above exception, another exception occurred:" "FTPSync.ftpsyncexceptions.FileNotFoundException"

This isn't really the issue for me, as it's not a problem. It might confuse others, though.

Thank you.

NoxArt commented 10 years ago

Do you see this always or is there some pattern? If I upload a new file I just get

FTPSync [default] > Connected to: host:21 (timeout: 30) (key: ...)
FTPSync [default] > Authentication processed
FTPSync [default] > Logged in as: nox-art_cz (using password: YES)
FTPSync [default] > Uploaded {newfile.txt}
FTPSync > Closing connection

in both ST2 and 3 ... weird. Getting metadata ... that would suggest here: https://github.com/NoxArt/SublimeText2-FTPSync/blob/master/FTPSync.py#L2456 but that should be caught (just return after catching makes sense in that place)

winfried-van-loon commented 10 years ago

Hi, both the issues (the FileNotFoundException and IndexError) are always visible when renaming or creating a new file.

When uploading a new file, the FileNotFoundException is shown, while the file does get created at the server.

When renaming a file, via the file rightclick menu > FTPSync > Rename feature, the error is shown and the file is never renamed. Not locally, nor remotely.

If I can help reproducting the error, or testing stuff to resolve the issue, please let me know. Thanks!

NoxArt commented 10 years ago

I've just asked on forums how can I get a position of the error, as you have your files packed inside .sublime-package, so I'm not sure how it addresses stuff inside.

Anyway, I've pushed a small fix that should address IndexError: list index out of range error

NoxArt commented 10 years ago

Found another one

winfried-van-loon commented 10 years ago

Hi, I've found the package below, it's able to extract a .sublime-package file. https://sublime.wbond.net/packages/Extract%20Sublime%20Package

I hope this is helpful.

NoxArt commented 10 years ago

Thank you. Actually extracting .sublime-package is not a problem, as it's just a .zip with renamed extension. But when an error says FTPSync.sublime-package", line 3026 ...

Someone posted an answer on forums and it seems I totally overlooked it in your console dump:

File "FTPSync in C:\Users\Stagiair\AppData\Roaming\Sublime Text 3\Installed Packages\FTPSync.sublime-package", line 3026

So it should be FTPSync.py

He also suggested this plugin https://github.com/skuroda/PackageResourceViewer Anyway, have these changes made it better? Guess it's not completely fixed, still

winfried-van-loon commented 10 years ago

Hi, when trying to rename a file now, I'm actually getting a new error. It's noted below.

b'FTPSync > Loading config: cache hit (key: C:\\Apache24\\htdocs\\project\\index.php)'
b'FTPSync [default] > Connected to: host:21 (timeout: 30) (key: 8aa687db53e6f6f0feed0750facba798)'
b'FTPSync [default] > Logged in as: user@domain (using password: YES)'
Exception in thread Thread-4:
Traceback (most recent call last):
  File "ftpsyncwrapper in C:\Users\user\AppData\Roaming\Sublime Text 3\Installed Packages\FTPSync.sublime-package", line 698, in action
  File "lib3.ftplib in C:\Users\user\AppData\Roaming\Sublime Text 3\Installed Packages\FTPSync.sublime-package", line 458, in retrlines
  File "lib3.ftplib in C:\Users\user\AppData\Roaming\Sublime Text 3\Installed Packages\FTPSync.sublime-package", line 238, in voidresp
  File "lib3.ftplib in C:\Users\user\AppData\Roaming\Sublime Text 3\Installed Packages\FTPSync.sublime-package", line 231, in getresp
FTPSync.lib3.ftplib.error_temp: 450 /public_html/project/index_test.php: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "X/threading.py", line 639, in _bootstrap_inner
  File "FTPSync in C:\Users\user\AppData\Roaming\Sublime Text 3\Installed Packages\FTPSync.sublime-package", line 2753, in run
  File "FTPSync in C:\Users\user\AppData\Roaming\Sublime Text 3\Installed Packages\FTPSync.sublime-package", line 1652, in execute
  File "ftpsyncwrapper in C:\Users\user\AppData\Roaming\Sublime Text 3\Installed Packages\FTPSync.sublime-package", line 739, in list
  File "ftpsyncwrapper in C:\Users\user\AppData\Roaming\Sublime Text 3\Installed Packages\FTPSync.sublime-package", line 861, in __execute
  File "ftpsyncwrapper in C:\Users\user\AppData\Roaming\Sublime Text 3\Installed Packages\FTPSync.sublime-package", line 703, in action
FTPSync.ftpsyncexceptions.FileNotFoundException

b'FTPSync > Closing connection'

I tried renaming index.php to index_test.php.

NoxArt commented 10 years ago

Hi, I guess your serves behaves differently in that mine on missing target file of LIST just outputs empty result and yours returns error ... I probably misunderstand something about Python's exception handling as both these errors should be caught and the code to proceed normally, but if I manually add a throw of exception I do get the same result as you ... and now I don't :) oh my... what the...

I'll keep studying and hopefully be able to fix it

Just pushed a little fix now a3187927fb . After it I can't get the error anymore, but it could not have been it...

winfried-van-loon commented 10 years ago

Sorry, I thought 'close' would close the 'reply' textarea. Good luck with studying, I don't rename that often, so it isn't really an issue that often. When there's something to test, regarding the ftp renaming issue, please let me know. :+1: