On 05/14/2017 11:19 PM, boB Stepp wrote:
On Sun, May 14, 2017 at 10:57 PM, Jim <jf_byr...@comcast.net> wrote:
I am running this on Mint 18.
This is the third script I have written to open and position windows in
workspaces. The first two work, but trying to open ebook-viewe r (calibre)
with a specific book produces the following error.
If I run the same command in the terminal it works without an error.


Exception in thread Thread-4:
Traceback (most recent call last):
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "/home/jfb/MyProgs/Scripts/place_windows_OO_WS3.py", line 24, in
open_it
    subprocess.call([self.program])
  File "/usr/lib/python3.5/subprocess.py", line 557, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'ebook-viewer
/home/jfb/Documents/eBooks/Javascript/GOOGLE_SHEETS/googlespreadsheetprogramming.epub'

Code:

# place_windows_OO_WS3.py

import subprocess
from subprocess import Popen,PIPE
import threading
import time

class Place():

    def __init__(self):
        self.programs = ['jedit', 'google-chrome', 'doublecmd',
        'ebook-viewer
/home/jfb/Documents/eBooks/Javascript/GOOGLE_SHEETS/googlespreadsheetprogramming.epub']
        self.classname = {'jedit' : 'sun-awt-X11-XFramePeer',
                            'google-chrome':'google-chrome',
                            'doublecmd':'doublecmd',
                            'calibre-ebook-viewer': 'libprs500'}
        self.open_and_move()

    def open_it(self):
        subprocess.call([self.program])

I'm not very familiar with using the subprocess module yet, but when
the above call to "subprocess.call([self.program])" occurs, isn't
subprocess.call() expecting a list like

['ebook-viewer', '/home/jfb ...']

?

Hope I am not off-track here.

boB

Bob,

I thought you were on to something, especially since Steven suggested about the same thing. See my reply to Steven. It seems to be looking for a str or byte not a list.

Thanks,  Jim


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to