vishr / local-history

A Sublime Text 2/3 plugin for maintaining local history of files. [backup | open | compare | incremental diff]
http://vishr.com/local-history
MIT License
228 stars 21 forks source link

get_file_dir (browse, open, compare) #44

Closed brettbatie closed 10 years ago

brettbatie commented 10 years ago

Using Sublime Text 3 on Debian Linux. I get the following error when I try to use any of the local history menu options (browse, open, compare, etc).

Traceback (most recent call last): File "/opt/sublime_text/sublimeplugin.py", line 549, in run return self.run(edit) File "history in /home/brett/.config/sublime-text-3/Installed Packages/Local History.sublime-package", line 107, in run File "history in /home/brett/.config/sublime-text-3/Installed Packages/Local History.sublime-package", line 40, in get_file_dir File "X/posixpath.py", line 83, in join TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'

vishr commented 10 years ago

I just test on Ubuntu 13.10 it is working for me. I am not sure if it specific to linux version. Can you try to reinstall the plugin and restart ST3.

brettbatie commented 10 years ago

Yeah, reinstalling it didn't change anything. I did notice a different error that is happening when the plugin first loads though. Maybe this gets us closer to the actual cause?

reloading plugin FileDiffs.file_diffs reloading plugin Local History.history Traceback (most recent call last): File "/opt/sublime_text/sublime_plugin.py", line 96, in reload_plugin obj = t() File "history in /home/brett/.config/sublime-text-3/Installed Packages/Local History.sublime-package", line 48, in init TypeError: unsupported operand type(s) for *=: 'NoneType' and 'int' reloading plugin Markdown Preview.MarkdownPreview

vishr commented 10 years ago

@brettbatie I have done a few changes, can you check now?

brettbatie commented 10 years ago

I no longer receive an error when first loading the plugin. However, I still receive the following error when selecting browse/open/compare and nothing happens after the error message.

Traceback (most recent call last):
  File "/opt/sublime_text/sublime_plugin.py", line 549, in run_
    return self.run(edit)
  File "history in /home/brett/.config/sublime-text-3/Installed Packages/Local History.sublime-package", line 107, in run
  File "history in /home/brett/.config/sublime-text-3/Installed Packages/Local History.sublime-package", line 43, in get_file_dir
  File "X/posixpath.py", line 83, in join
TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'
vishr commented 10 years ago

Can you manually run this python code and let me know the output?

import os os.path.join(os.path.abspath(os.path.expanduser('~')), '.sublime', 'history')

brettbatie commented 10 years ago
$ python
Python 2.7.3 (default, Mar 13 2014, 11:03:55) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.path.join(os.path.abspath(os.path.expanduser('~')), '.sublime', 'history')
'/home/brett/.sublime/history'
>>> 
$ ls -ald /home/brett/.sublime/history/
drwxr-xr-x 5 brett brett 4096 Feb 27 09:51 /home/brett/.sublime/history/
jeffjrare commented 10 years ago

I'm on Ubuntu 12.10 with ST3 and I have the same error on clicking "Local History > Browse":

(Note if it can help: Package installation through the package manager hasn't worked so I git cloned it.)

Traceback (most recent call last): File "/opt/sublime_text/sublimeplugin.py", line 549, in run return self.run(edit) File "/home/jgirard/.config/sublime-text-3/Packages/Local History/history.py", line 107, in run subprocess.call(['xdg-open', get_file_dir(self.view.file_name())]) File "/home/jgirard/.config/sublime-text-3/Packages/Local History/history.py", line 43, in get_file_dir return os.path.join(history_path, file_dir) File "X/posixpath.py", line 83, in join TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'

import os os.path.join(os.path.abspath(os.path.expanduser('~')), '.sublime', 'history') '/home/jgirard/.sublime/history'

vishr commented 10 years ago

Should work now! please verify.

jeffjrare commented 10 years ago

Yes your fix has worked - Sorry for the delay, and thanks a lot!

brettbatie commented 10 years ago

Thanks Vishal, that fixed it for me as well!