summaryrefslogtreecommitdiff
path: root/cmd2/cmd2.py
diff options
context:
space:
mode:
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r--cmd2/cmd2.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index f2da5927..a74b6c30 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -3659,7 +3659,7 @@ class Cmd(cmd.Cmd):
# Check if all commands ran
if commands_run < len(history):
warning = "Command {} triggered a stop and ended transcript generation early".format(commands_run)
- self.perror(ansi.style_warning(warning))
+ self.perror(ansi.style_warning(warning), apply_style=False)
# finally, we can write the transcript out to the file
try:
@@ -3748,6 +3748,13 @@ class Cmd(cmd.Cmd):
self.perror("'{}' is not an ASCII or UTF-8 encoded text file".format(expanded_path))
return
+ if expanded_path.endswith('.py') or expanded_path.endswith('.pyc'):
+ self.perror(ansi.style_warning("'{}' appears to be a Python file".format(expanded_path)),
+ apply_style=False)
+ selection = self.select('Yes No', 'Continue to try to run it as a text file script? ')
+ if selection != 'Yes':
+ return
+
try:
# Read all lines of the script
with open(expanded_path, encoding='utf-8') as target: