File: ptpython-in-other-thread.py

package info (click to toggle)
ptpython 3.0.32-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 840 kB
  • sloc: python: 4,509; makefile: 5
file content (25 lines) | stat: -rw-r--r-- 402 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/env python
"""
Example of running ptpython in another thread.

(For testing whether it's working fine if it's not embedded in the main
thread.)
"""

import threading

from ptpython.repl import embed


def in_thread():
    embed(globals(), locals(), vi_mode=False)


def main():
    th = threading.Thread(target=in_thread)
    th.start()
    th.join()


if __name__ == "__main__":
    main()