n1k0 / SublimeHighlight

A humble SublimeText package for exporting highlighted code as RTF or HTML
https://github.com/n1k0/SublimeHighlight
MIT License
788 stars 105 forks source link

[ST3] Works not well ... #31

Closed liuhewei closed 11 years ago

liuhewei commented 11 years ago

My environment is win7-32, st 3 build3047. I cloned the branch "python3" into the package directory, but seems can't work well:

  1. Settings seems useless. I tried to put the global settings to local: settings = sublime.load_settings('SublimeHighlight.sublime-settings') into get_formatter() in SublimeHighlight.py, then the setting options can be obtained.
  2. tmp_file.write(contents.encode(...)) in function write_file() should be changed to tmp_file.write(contents).

After the 2 steps above, the "view as HTML" command works. But, "view as RTF" still can't work, seems the settings is ineffectual. And, "Copy to clipboard" can't work. The error exists in winclip library according to my python console:

Traceback (most recent call last):
  File "D:\Tools\Sublime Text 3\sublime_plugin.py", line 543, in run_
    return self.run(edit, **args)
  File "D:\Tools\Sublime Text 3\Data\Packages\SublimeHighlight\SublimeHighlight.py", line 143, in run
    winclip.Paste(pygmented, output_type, plaintext)
  File "D:\Tools\Sublime Text 3\Data\Packages\SublimeHighlight\HighlightLib\winclip\__init__.py", line 60, in Paste
    Put(data, CF_HTML)
  File "D:\Tools\Sublime Text 3\Data\Packages\SublimeHighlight\HighlightLib\winclip\__init__.py", line 83, in Put
    scd(c_int(format), hCd, 0, False)
ValueError: Procedure probably called with too many arguments (8 bytes in excess)

Seems the winclip doesn't support win7 well? I don't know...

MrOrz commented 11 years ago

I'm in Mac OSX 10.7.5 Lion and also encountered the problem mentioned above.

After changing tmp_file.write(contents.encode(...)) to tmp_file.write(contents) the TypeError is resolved, and "Copy as RTF" works well.

n1k0 commented 11 years ago

For some reason ST3 is unable to store user settings in the appropriate folder. Still investigating this one.

zenoamaro commented 11 years ago

None of the commands are working for me, either. This is the output from the console:

Traceback (most recent call last):
  File "/Applications/Sublime Text 3.app/Contents/MacOS/sublime_plugin.py", line 543, in run_
    return self.run(edit, **args)
  File "/Users/zenojevski/Library/Application Support/Sublime Text 3/Packages/SublimeHighlight/SublimeHighlight.py", line 118, in run
    pygmented = self.highlight(output_type, full)
  File "/Users/zenojevski/Library/Application Support/Sublime Text 3/Packages/SublimeHighlight/SublimeHighlight.py", line 107, in highlight
    self.get_formatter(output_type, full))
  File "/Users/zenojevski/Library/Application Support/Sublime Text 3/Packages/SublimeHighlight/SublimeHighlight.py", line 75, in get_formatter
    fontface=settings.get('fontface', ''))
  File "/Users/zenojevski/Library/Application Support/Sublime Text 3/Packages/SublimeHighlight/HighlightLib/pygments/formatters/__init__.py", line 51, in get_formatter_by_name
    return cls(**options)
  File "/Users/zenojevski/Library/Application Support/Sublime Text 3/Packages/SublimeHighlight/HighlightLib/pygments/formatters/html.py", line 372, in __init__
    Formatter.__init__(self, **options)
  File "/Users/zenojevski/Library/Application Support/Sublime Text 3/Packages/SublimeHighlight/HighlightLib/pygments/formatter.py", line 68, in __init__
    self.full  = get_bool_opt(options, 'full', False)
  File "/Users/zenojevski/Library/Application Support/Sublime Text 3/Packages/SublimeHighlight/HighlightLib/pygments/util.py", line 58, in get_bool_opt
    string, optname))
pygments.util.OptionError: Invalid type None for option full; use 1/0, yes/no, true/false, on/off

I have transitioned my folder to ST3 some time ago, so I'm guessing I may have stale configuration values from before, but I'm can't seem to find anything relevant.

n1k0 commented 11 years ago

SHould be fixed by #37 - Please reopen if that's not true.

vhbsouza commented 10 years ago

I'm with the same error but I'm using ST2. Please help me.