File: autokey-shell

package info (click to toggle)
autokey 0.95.10-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 2,092 kB
  • sloc: python: 9,372; xml: 2,741; javascript: 249; sh: 24; makefile: 4
file content (35 lines) | stat: -rwxr-xr-x 1,040 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#! /usr/bin/env python3

# -*- coding: utf-8 -*-
# -*- mode: python -*-
import distutils.spawn
import subprocess
import sys

start_script = '''
import autokey.iomediator
import autokey.configmanager
import autokey.scripting
import autokey.scripting_highlevel as hl
system = autokey.scripting.System()
print("""
AutoKey functions from “autokey.scripting_highlevel” (under name “hl”)
and “autokey.scripting.System()” (under name “system”) are imported.
You can try the functions on the interpreter. For example:
help(hl.click_on_pat)
print(system.exec_command('ls'))
""")
'''

ipython3_cmd = distutils.spawn.find_executable('ipython3')
if ipython3_cmd is not None:
    retcode = subprocess.call([ipython3_cmd, '-ic', start_script])
    raise SystemExit(retcode)

python3_path = distutils.spawn.find_executable('python3')
if python3_path is not None:
    retcode = subprocess.call([python3_path, '-ic', start_script])
    raise SystemExit(retcode)

print('\033[91m' + 'Error! No Python 3 shell found.' + '\033[0m')
sys.exit(1)