4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the Revised BSD License.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 Revised BSD License for more details.
12 Copyright 2018-2024 Cool Dude 2k - http://idb.berlios.de/
13 Copyright 2018-2024 Game Maker 2k - http://intdb.sourceforge.net/
14 Copyright 2018-2024 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
16 $FileInfo: pyshell-old.py - Last Update: 5/3/2024 Ver. 0.10.0 RC 1 - Author: cooldude2k $
19 from __future__
import print_function
20 import sys
, traceback
, code
, re
, readline
, pycatfile
;
22 from pycatfile
import *;
27 ps1
="PyShell "+str(sys
.version_info
[0])+"."+str(sys
.version_info
[1])+"."+str(sys
.version_info
[2])+"> ";
29 print("PyShell "+sys
.version
+" on "+sys
.platform
+"\nLoaded Python module PyCatFile "+pycatfile
.__version
__+"\n");
32 cmdinput
= code
.InteractiveConsole().raw_input(ps1
);
33 except KeyboardInterrupt:
34 print("\nKeyboardInterrupt");
39 traceback
.print_exc();
40 ## exec(str(cmdinput));
42 exec(code
.compile_command(str(cmdinput
)));
44 traceback
.print_exc();
47 if(sys
.argv
[1]=="sh" or sys
.argv
[1]=="shell" or sys
.argv
[1]=="pysh" or sys
.argv
[1]=="pyshell" or sys
.argv
[1]=="python"):
49 ps1
="PyShell "+str(sys
.version_info
[0])+"."+str(sys
.version_info
[1])+"."+str(sys
.version_info
[2])+"> ";
51 print("PyShell "+sys
.version
+" on "+sys
.platform
+"\nLoaded Python module PyCatFile "+pycatfile
.__version
__+"\n");
54 cmdinput
= code
.InteractiveConsole().raw_input(ps1
);
55 except KeyboardInterrupt:
56 print("\nKeyboardInterrupt");
61 traceback
.print_exc();
62 ## exec(str(cmdinput));
64 exec(code
.compile_command(str(cmdinput
)));
66 traceback
.print_exc();
69 if(sys
.argv
[1]=="shebang" or sys
.argv
[1]=="shabang" or sys
.argv
[1]=="hashbang" or sys
.argv
[1]=="poundbang" or sys
.argv
[1]=="hashexclam" or sys
.argv
[1]=="hashpling"):
72 print(str("command: "+sys
.argv
[0]+"\narguments: "+sys
.argv
[1]+"\nerror: syntax error missing arguments"));
74 shebang
= "".join(open(sys
.argv
[2], "r").readlines());
75 exec(compile(str(shebang
), "", "exec"));
78 if(sys
.argv
[1]=="exec" or sys
.argv
[1]=="run" or sys
.argv
[1]=="execute"):
80 argcmd
= list(sys
.argv
);
82 argcmd
= list(argcmd
);
84 argcmd
= list(argcmd
);
85 argcmd
= " ".join(argcmd
);
89 print(str("command: "+sys
.argv
[0]+"\narguments: "+sys
.argv
[1]+"\nerror: syntax error missing arguments"));