Home Download Buy Blog Forum Support

Printing from sublime

Re: Printing from sublime

Postby bbarrill on Tue Nov 20, 2012 12:17 am

I added the print line (keeping the indentation same as the subprocess line) and changed lp to lpr in line 132, but no change in the error message. Just for clarity, that section now looks like this:

elif PLATFORM == "osx":
# lp -d <queue name> <name of document>
# lp <name of document> will send to default printer(?)
if QUEUE is not False:
print(vw_filename)
subprocess.call("lp -d " + QUEUE + " " + vw_filename)
else:
subprocess.call("lpr " + vw_filename)


and the error when I try to print still looks like this:

Traceback (most recent call last):
File "./sublime_plugin.py", line 339, in run_
File "./QuickPrint.py", line 134, in run
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 470, in call
return Popen(*popenargs, **kwargs).wait()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 623, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 1141, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
bbarrill
 
Posts: 9
Joined: Mon Nov 19, 2012 10:29 pm

Re: Printing from sublime

Postby agibsonsw on Tue Nov 20, 2012 12:20 am

Sorry, perhaps I gave the wrong line number; the print statement should be in the second section:

Code: Select all
            elif PLATFORM == "osx":
                # lp -d <queue name> <name of document>
                # lp <name of document> will send to default printer(?)
                if QUEUE is not False:
                    subprocess.call("lp -d " + QUEUE + " " + vw_filename)
                else:
                    print(vw_filename)
                    subprocess.call("lp " + vw_filename)
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: Printing from sublime

Postby bbarrill on Tue Nov 20, 2012 12:39 am

Ok, now it puts the filename:

/var/folders/rv/khlfpt5d15q40578f1sjz3f00000gp/T/results.txt
Traceback (most recent call last):
File "./sublime_plugin.py", line 339, in run_
File "./QuickPrint.py", line 134, in run
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 470, in call
return Popen(*popenargs, **kwargs).wait()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 623, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 1141, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory


results.txt is the name of the file I am trying to print.
bbarrill
 
Posts: 9
Joined: Mon Nov 19, 2012 10:29 pm

Re: Printing from sublime

Postby agibsonsw on Tue Nov 20, 2012 12:47 am

It looks okay?! Is

/var/folders/rv/khlfpt5d15q40578f1sjz3f00000gp/T/results.txt

a valid osx path? Can you check if this file exists - I assume it should!

Otherwise, you could try adding the setting:

"queue": "yourprintername",

to the QuickPrint.sublime-settings file, so that it tries to print to the named printer (rather than a default printer).

Thanks again for persisting with me..
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: Printing from sublime

Postby bbarrill on Tue Nov 20, 2012 1:06 am

Yes, the file exists at that path (and I opened it and verified that it's my file). I tried adding that line to the settings file, no change. Now I really need to go start the experiment I meant to start a few hours ago. :) I'll check back later if you have more suggestions.
bbarrill
 
Posts: 9
Joined: Mon Nov 19, 2012 10:29 pm

Re: Printing from sublime

Postby agibsonsw on Tue Nov 20, 2012 1:17 am

bbarrill wrote:Yes, the file exists at that path (and I opened it and verified that it's my file). I tried adding that line to the settings file, no change. Now I really need to go start the experiment I meant to start a few hours ago. :) I'll check back later if you have more suggestions.


This is also an experiment ;)

No worries, and thanks again. For some time later:

Did your printer name contain spaces? This may be another issue.
I've updated my GitHub to use the folder /tmp/ for osx. If this doesn't work then I assume that lp (or lpr) are not configured to the default printer by default, or perhaps there is some security setting(s) preventing access to the temp folder.

I'm hoping some osx-legend might contribute to our endeavours :D

Added: The printer settings may need to be adjusted to accept TEXT input.
Finally: If/when you get a chance can you type lp pathtosometextfile.txt in Terminal to see if it prints.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: Printing from sublime

Postby bbarrill on Tue Nov 20, 2012 6:56 am

I do enjoy a good puzzle. :mrgreen:

My printer name does not contain spaces. I've re-downloaded the updated zip from github a few minutes ago and put it on my laptop at home (OSX 10.8.2), in case there was something weird about my work computer/printer setup, but the same "No such file or directory" error also occurs on my laptop.

I'm not sure what this means: "The printer settings may need to be adjusted to accept TEXT input." I don't see any options like that in my printer settings.

I am able to successfully print the file stuff.txt by typing "lp stuff.txt" in Terminal.
bbarrill
 
Posts: 9
Joined: Mon Nov 19, 2012 10:29 pm

Re: Printing from sublime

Postby agibsonsw on Tue Nov 20, 2012 1:51 pm

I am at a loss..

Perhaps I will include an email client: it will post the file to me in an email, I'll print it out and post it to you :D. It means, though, there will be a slight delay between each print.

Hopefully someone else might offer suggestions ;)

thanks again, Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: Printing from sublime

Postby agibsonsw on Tue Nov 20, 2012 3:36 pm

Could try one last time ;) . The current version saves the text file in the current location, just adding a .txt extension. This will at least eliminate the location of the file as the cause of the problem. Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: Printing from sublime

Postby bbarrill on Tue Nov 20, 2012 7:31 pm

Well, now it makes a different error, so that's fun... I tried it first with an unsaved file, then saved the file as stuff.txt and tried again.

Traceback (most recent call last):
File "./sublime_plugin.py", line 339, in run_
File "./QuickPrint.py", line 85, in run
IOError: [Errno 13] Permission denied: 'quickprinttemp.txt.txt'
Writing file /Users/bbarrill/Desktop/stuff.txt with encoding UTF-8
Traceback (most recent call last):
File "./sublime_plugin.py", line 339, in run_
File "./QuickPrint.py", line 85, in run
IOError: [Errno 13] Permission denied: u'stuff.txt.txt'


I'll just use the Print to Html package instead. Opening a browser to print DNA sequences seems like overkill, but it works okay. Thanks for the good times; it's nice to do some "experiments" that don't involve pipetting clear liquids between various tiny tubes hundreds of times.
bbarrill
 
Posts: 9
Joined: Mon Nov 19, 2012 10:29 pm

PreviousNext

Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], fitfot, Google [Bot] and 29 guests