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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2005 Lateef Alabi-Oki
#
# This file is part of Scribes.
#
# Scribes is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Scribes is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Scribes; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""
This module initializes the text editor's server.
@author: Lateef Alabi-Oki
@organiation: The Scribes Project
@copyright: Copyright © 2005 Lateef Alabi-Oki
@license: GNU GPLv2 or Later
@contact: mystilleef@gmail.com
"""
# The Python library path is generated at build time.
from dl import RTLD_LAZY, RTLD_GLOBAL
from sys import argv, path, setdlopenflags, settrace
setdlopenflags(RTLD_LAZY|RTLD_GLOBAL)
python_path = "/usr/lib/python2.5/site-packages"
path.insert(0, python_path)
from SCRIBES.Main import main
def traceit(frame, event, arg):
from operator import eq
if eq(event, "line"):
try:
lineno = frame.f_lineno
filename = frame.f_globals["__file__"]
if (filename.endswith(".pyc") or
filename.endswith(".pyo")):
filename = filename[:-1]
name = frame.f_globals["__name__"]
from linecache import getline
line = getline(filename, lineno)
print "%s:%s: %s" % (name, lineno, line.rstrip())
except KeyError:
print "Keyerror"
return traceit
if __name__ == "__main__":
#settrace(traceit)
main(argv[1:])
|