mailr11860 - /1.3/prompt/interpreter.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on December 17, 2010 - 13:00:
Author: bugman
Date: Fri Dec 17 13:00:51 2010
New Revision: 11860

URL: http://svn.gna.org/viewcvs/relax?rev=11860&view=rev
Log:
Fix for running scripts - the '.' character is now disallowed as module 
import cannot work.


Modified:
    1.3/prompt/interpreter.py

Modified: 1.3/prompt/interpreter.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/prompt/interpreter.py?rev=11860&r1=11859&r2=11860&view=diff
==============================================================================
--- 1.3/prompt/interpreter.py (original)
+++ 1.3/prompt/interpreter.py Fri Dec 17 13:00:51 2010
@@ -35,7 +35,6 @@
 if dep_check.readline_module:
     import readline
 import runpy
-from string import split
 import sys
 
 # Python modules accessible on the command prompt.
@@ -345,10 +344,6 @@
 def exec_script(name, globals):
     """Execute the script."""
 
-    # Check if the script name is ok.
-    if not search('\.py$', name):
-        raise RelaxError("The relax script must end in '*.py'.")
-
     # Execution lock.
     status = Status()
     status.exec_lock.acquire('script UI')
@@ -359,7 +354,11 @@
     sys.path.append(script_path)
 
     # The module name.
-    module, extension = split(tail, '.')
+    module, ext = path.splitext(tail)
+
+    # Check if the script name is ok.
+    if search('\.', module):
+        raise RelaxError("The relax script must not contain the '.' 
character (except before the extension '*.py').")
 
     # Execute the module.
     runpy.run_module(module, globals)




Related Messages


Powered by MHonArc, Updated Fri Dec 17 13:20:02 2010