23maverick23/sublime-jekyll

The recent Sublime Text release totally screws this package...

Merovex opened this issue ยท 12 comments

I got the update on this package recently, and really like the new features. However, Sublime build 3103 breaks this package.

  • cmd + shift + p
  • Jekyll: New post from template
  • select template
  • type a name for this new post
  • Oops! ๐Ÿ™ˆ

i 2016-02-13 at 09 59 37

  • "Right Click > Insert Upload Tag" Yields Unexpected Jekyll Error.

I earlier had problems with accessing templates, but that problem has magically disappeared.

@Merovex @demidovakatya

Thanks for using sublime-jekyll. I'm running 3103 on OSX and everything seems to work fine, so I'd like some help debugging with you.

Can you both try enabling debug mode in your settings file ("jekyll_debug": true)? Then restart ST, try to replicate the error, and send me the relevant Sublime console output (you can open the console with Ctrl+`). All of my debug calls should be prefixed with Jekyll to make it easier.

I don't imagine these bugs are related, so we'll see if the console has any helpful info. Thx.

Traceback (most recent call last):
  File "jekyll in /Users/mac/Library/Application Support/Sublime Text 3/Installed Packages/Jekyll.sublime-package", line 118, in _fn
  File "jekyll in /Users/mac/Library/Application Support/Sublime Text 3/Installed Packages/Jekyll.sublime-package", line 490, in create_and_open_file
  File "jekyll in /Users/mac/Library/Application Support/Sublime Text 3/Installed Packages/Jekyll.sublime-package", line 248, in create_file
FileNotFoundError: [Errno 2] No such file or directory: '_drafts/hellomd.markdown'
error: Jekyll: Unexpected error (please, report a bug!)

@demidovakatya Thanks for posting. I believe you're seeing this error because you are attempting to use a relative directory path for your Jekyll site instead of an absolute path. I haven't gotten around to fully implementing relative directory paths for _posts, _drafts and uploads.

For now, you have 2 options that should correct this:

  1. Define an absolute path for both _posts and _drafts in your user/project settings file (this is explained here - RTFD)
  2. Enable the setting jekyll_auto_find_paths which will attempt to resolve a full path for your _posts, _drafts and uploads directories (this is explained here - RTFD)

As an aside, I should probably add some checks to all paths using os.path.exists so that this is easier to spot and debug moving forward. Let me know if this doesn't resolve the issue you're seeing.

On the "Insert Upload" item, the error is reported. The folder "Jekyll" is not in /Users/<REDACTED> /Library/Application Support/Sublime Text 3/Packages/Jekyll/

Traceback (most recent call last):
  File "jekyll in /Users/<REDACTED>/Library/Application Support/Sublime Text 3/Installed Packages/Jekyll.sublime-package", line 118, in _fn
  File "jekyll in /Users/<REDACTED>/Library/Application Support/Sublime Text 3/Installed Packages/Jekyll.sublime-package", line 281, in uploads_path_string
  File "jekyll in /Users/<REDACTED>/Library/Application Support/Sublime Text 3/Installed Packages/Jekyll.sublime-package", line 132, in _fn
  File "./shutil.py", line 227, in copy
  File "./shutil.py", line 109, in copyfile
FileNotFoundError: [Errno 2] No such file or directory: '/Users/<REDACTED>/Library/Application Support/Sublime Text 3/Packages/Jekyll/Jekyll.sublime-settings'
error: Jekyll: Unexpected error (please, report a bug!)
Traceback (most recent call last):
  File "jekyll in /Users/<REDACTED>/Library/Application Support/Sublime Text 3/Installed Packages/Jekyll.sublime-package", line 118, in _fn
  File "jekyll in /Users/<REDACTED>/Library/Application Support/Sublime Text 3/Installed Packages/Jekyll.sublime-package", line 429, in list_files
  File "./genericpath.py", line 18, in exists
TypeError: can't specify None for path argument

@Merovex Thanks for posting the console details.

  1. Can you share your Jekyll.sublime-settings file, or are you using project-specific settings?
  2. Can you confirm if your jekyll_uploads_path setting is set correctly as an absolute path?

The FileNotFoundError is definitely a bug that I will fix (ST2 vs. ST3 compatibility).

I am using a project-specific file. I have not set jekyll_uploads_path.

On Sun, Feb 14, 2016 at 11:36 PM, Ryan Morrissey notifications@github.com
wrote:

@Merovex https://github.com/Merovex Thanks for posting the console
details.

  1. Can you share your Jekyll.sublime-settings file, or are you using
    project-specific settings?
  2. Can you confirm if your jekyll_uploads_path setting is set
    correctly as an absolute path?

The FileNotFoundError is definitely a bug that I will fix (ST2 vs. ST3
compatibility).

โ€”
Reply to this email directly or view it on GitHub
#60 (comment)
.

Ambuletis Digne,
Ben Wilson

We complain because we forget.

@Merovex In order to use any of the upload commands, you'll need to tell sublime-jekyll where your uploads directory is located using the jekyll_uploads_path settings key (or - you can enable jekyll_auto_find_paths in your project settings if your uploads directory is exactly named uploads).

That should solve both errors you are seeing. I will still push an update to resolve the FileNotFoundError as that is a bug.

Fine, but from one developer to another, appropriate behavior is either a
default value when not set by the user, and a descriptive error message. A
generic "you've got a problem" error is not the right answer.

Thanks for pushing the update. :-)

On Mon, Feb 15, 2016 at 9:45 PM, Ryan Morrissey notifications@github.com
wrote:

@Merovex https://github.com/Merovex In order to use any of the upload
commands, you'll need to tell sublime-jekyll where your uploads directory
is located using the jekyll_uploads_path settings key (or - you can
enable jekyll_auto_find_paths in your project settings if your uploads
directory is exactly named uploads).

That should solve both errors you are seeing. I will still push an update
to resolve the FileNotFoundError as that is a bug.

โ€”
Reply to this email directly or view it on GitHub
#60 (comment)
.

Ambuletis Digne,
Ben Wilson

We complain because we forget.

Thanks @Merovex

Just to confirm - the generic error you received was indirectly related to your lack of an uploads path in your project settings file. Currently - if the package detects a missing path, it attempts to copy the default package settings into your user directory (good UX and programming behavior ๐Ÿ˜‰). That process is actually what failed, causing the generic error to be thrown.

Originally when I created the package for ST2, all add-on packages were stored in sublime.packages_path(), and were simply directories you could access. With ST3, packages are typically installed in sublime.installed_packages_path() and are stored as zip archives with a .sublime-package extension. I neglected to update this small snippet of code with the 3.0 release, and when you didn't have an uploads path, the system tried to find the Jekyll package in your user packages directory, which doesn't exist for ST3, which...you get the idea.

Hope that helps explain why I was confused by your error message! I'll look to push an update today or tomorrow to address this ST2/3 incompatibility. Thanks again for using the package!

thanks @23maverick23 ๐Ÿ˜„