예제 #1
0
    def __init__(self):

        from __main__ import __dict__ as __dict
        self.__log = ''
        if '__version__' in __dict.keys():
            self.__script_vers = __dict['__version__']
        else:
            self.__script_vers = 'Unknown'

        self.__script_name = os.path.basename(__dict['__file__']).split('.')[0]

        #self.__script_name = os.path.basename(nm).split('.')[0]
        self.filename = '{0}.log'.format(self.__script_name)
예제 #2
0
    def __init__(self):
        """Create the object Logger itself and set a pair of variables.

        These variables are about the python file wich invokes this module:

        __script_vers = The version of python file which invokes this module
        __script_name = The name of the python file which invokes this module

        """
        from __main__ import __dict__ as __dict
        self.__log = ''
        if '__version__' in __dict.keys():
            self.__script_vers = __dict['__version__']
        else:
            self.__script_vers = 'Unknown'
        self.__script_name = os.path.basename(__dict['__file__']).split('.')[0]
예제 #3
0
    def __init__(self):
        """Create the object Logger itself and set various attributes.

        These attributes are about the python file wich invokes this module:

        __script_vers = The version of python file which invokes this module
        __script_name = The name of the python file which invokes this module
        filename = the log file's name

        """
        from __main__ import __dict__ as __dict
        self.__log = ''
        if '__version__' in __dict.keys():
            self.__script_vers = __dict['__version__']
        else:
            self.__script_vers = 'Unknown'
        self.__script_name = os.path.basename(__dict['__file__']).split('.')[0]
        self.filename = '{0}.log'.format(self.__script_name)
예제 #4
0
 def loadglobals(self):
     """Load globals() from filename"""
     glbs = self.mglobals()
     from spyderlib.utils.iofuncs import iofunctions
     filename = read_packet(self.i_request)
     ext = read_packet(self.i_request)
     load_func = iofunctions.load_funcs[ext]
     data, error_message = load_func(filename)
     if error_message:
         return error_message
     for key in data.keys():
         new_key = fix_reference_name(key, blacklist=glbs.keys())
         if new_key != key:
             data[new_key] = data.pop(key)
     try:
         glbs.update(data)
     except Exception, error:
         return str(error)
예제 #5
0
 def loadglobals(self):
     """Load globals() from filename"""
     glbs = self.mglobals()
     from SMlib.utils.iofuncs import iofunctions
     filename = read_packet(self.i_request)
     ext = read_packet(self.i_request)
     load_func = iofunctions.load_funcs[ext]
     data, error_message = load_func(filename)
     if error_message:
         return error_message
     for key in data.keys():
         new_key = fix_reference_name(key, blacklist=glbs.keys())
         if new_key != key:
             data[new_key] = data.pop(key)
     try:
         glbs.update(data)
     except Exception, error:
         return str(error)