Skip to content
This repository has been archived by the owner on Mar 16, 2020. It is now read-only.

Getting a traceback error when running in Sublime Text 2 #3

Open
jeffself opened this issue Mar 14, 2013 · 2 comments
Open

Getting a traceback error when running in Sublime Text 2 #3

jeffself opened this issue Mar 14, 2013 · 2 comments

Comments

@jeffself
Copy link

Installed the 2pdf plugin. When I have a file open and click Selection->2pdf, I get the following traceback dialog:

Traceback (most recent call last): File "./2pdf.py", line 126, in run File "./2pdf.py", line 168, in _run AttributeError: 'module' object has no attribute 'startfile'

Any suggestions?

@jaman
Copy link
Contributor

jaman commented Apr 3, 2013

I just ran into the same problem myself. Found a quick fix.

on line 168: change:

        os.startfile(outfile)

to:

        if sys.platform.startswith('darwin'):
            subprocess.call(('open', outfile))
        elif os.name == 'nt':
            os.startfile(outfile)
        elif os.name == 'posix':
            subprocess.call(('xdg-open', outfile))

startfile is a windows only feature. You'll also need to add in a require for subprocess as it is not there.

There are a number of ways to fix this issue. I've just chosen the one that should fix it for all platforms. For a discussion:
http://stackoverflow.com/questions/434597/open-document-with-default-application-in-python

fraoustin added a commit that referenced this issue Apr 3, 2013
Addressing issue #3 - getting this to work on OSX and Linux.
@datone
Copy link

datone commented Jun 16, 2013

Have to say it's a great plugin for me, but i found an issue(or my issue) when printing Chinese, all i get are messy code in PDF doc. Would you please help how to resolve it. Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants