Sublime Forum

Prevent auto execution of plugins?

#1

Is it possible to prevent a plugin from automatically loading?

I converted my library, partially, into a package. The issue is, the code is executing starting at the init.py file. The problem with this, is it is executing from WITHIN the package… And despite using things such as from . import blah… it doesn’t recognize . as the current dir. Even if I try changing the import to import blah; it doesn’t work and gives a lot of errors.

If I import AcecoolLib from outside of it, it works ( and this is if I just run normal Python - although since some of the nested packages rely on other nested package information, I do import … information which ends up unable to go above the current so it must be imported from the TOP top… )…

So is there any way to prevent this, or do I need to put it in a nested folder?

AcecoolLib/AcecoolLib… then import AcecoolLib.AcecoolLib as AcecoolLib to get rid of that excess…?

Here: https://bitbucket.org/Acecool/acecoollib/src/master/

If you see any issues that jump out at you, please let me know.

I test using:

##
## Acecool's Python Library - AcecoolLib Conclusive Includer - Josh 'Acecool' Moser
##
## Note:
##
## ----------------------------------------------------------------------------------------------------------------------------------------------------------------- ##
##
##
##
##
## ----------------------------------------------------------------------------------------------------------------------------------------------------------------- ##
##


##
## Task List -
##
## Task:
## Task:
## Task:
## Task:
## Task:
##


##
## Task List -
##
## Task:
## Task:
## Task:
## Task:
## Task:
##


##
## Imports
##

##
print( 'AcecoolLibTest - started...' );

##
from AcecoolLib.__global__ import *;
import AcecoolLib;


AcecoolLib.Examples( );

## print( AcecoolLib.python.GetMagicFunctionNames( ) );

## AcecoolLib.debug.EnableTrace( );


## from inspect import getmembers, isfunction;
## import types;

## print( str( types.FunctionType ) );

## def testing( ):
## 	pass

## print( str( AcecoolLib.__global__.ismodule( testing ) ) )
## print( str( testing is testing ) )
## print( str( isfunction( testing ) ) )
## print( str( globals( ) ) )
## print( str( locals( ) ) )
## print( str( [ o for o in getmembers( globals( ) ) if isfunction( o[ 1 ] ) ] ) )
## print( str( [ o for o in getmembers( locals( ) ) if isfunction( o[ 1 ] ) ] ) )

## class Testing123( object ):
## 	def de( ):
## 		pass

## print( type( AcecoolLib ) )
## print( type( Testing123 ) )

## print( str( [ o for o in getmembers( AcecoolLib ) if isclass( o[ 1 ] ) or isfunction( o[ 1 ] ) and o[ 0 ] == '__example__' ] ) )
## functions_list = [ o for o in getmembers( AcecoolLib ) if isfunction( o[ 1 ] ) and ( o[ 1 ] ) ]
## functions_list = [ getattr(AcecoolLib, a) for a in dir( AcecoolLib ) if isinstance( getattr( AcecoolLib, a ), types.CallableType ) ]


## print( str( functions_list ) )

## print( AcecoolLib.example.GetAll( locals( )[ 'AcecoolLib' ] ) );
## print( AcecoolLib.example.GetAll( globals( )[ 'AcecoolLib' ] ) );
## print( AcecoolLib.example.GetAll( locals( ) ) );
## print( AcecoolLib.example.GetAll( globals( ) ) );

## print( str( locals( )[ 'AcecoolLib' ] ) )
## print( str( locals( ) ) )
## print( str( globals( ) ) )
## print( str( globals( )[ 'AcecoolLib' ] ) )
## ## print( AcecoolLib.example.GetAll( getattr( globals( ), 'AcecoolLib' ) ) );
## ## print( AcecoolLib.example.GetAll( getattr( locals( ), 'AcecoolLib' ) ) );

as one example from a dir above it. And it works. But I want to get the examples, etc… systems working but from within it doesn’t.

IE: The AcecoolLib.Examples( ) returns this:

AcecoolLibTest - started...

AcecoolLib - Importing...

	> AcecoolLib.__global__

	- AcecoolLib.Acecool

	> AcecoolLib.ai
	- AcecoolLib.debug
	- AcecoolLib.string
	- AcecoolLib.dict
	- AcecoolLib.table
	- AcecoolLib.list
	- AcecoolLib.text
		- AcecoolLib.ai.neuron

	> AcecoolLib.example
	- AcecoolLib.file
	- AcecoolLib.folder
	- AcecoolLib.function
	- AcecoolLib.logic
	- AcecoolLib.math
		- AcecoolLib.math.easing
	- AcecoolLib.python
	- AcecoolLib.system
	- AcecoolLib.tuple
	- AcecoolLib.version

	> AcecoolLib.util
		- AcecoolLib.util.accessor

	> AcecoolLib.database
		- Importing AcecoolLib.database.sqlite

	> AcecoolLib.datatypes
		- Importing AcecoolLib.datatypes.queue
		- Importing AcecoolLib.datatypes.stack

	> AcecoolLib.examples

	> AcecoolLib.objects
		- AcecoolLib.objects.angle
		- AcecoolLib.datatypes.pos2d
		- AcecoolLib.objects.pos
		- AcecoolLib.datatypes.vector

	> AcecoolLib.settings

	> AcecoolLib.steam
		- AcecoolLib.steam.SteamException

	> AcecoolLib.time
		- AcecoolLib.time.cooldown
		- AcecoolLib.time.timekeeper

AcecoolLib - Imported

None
##
## AcecoolLib.Acecool: Examples
##
---------------------------------------------------------------------------

------- Uses AccessorFuncDB? -------
None
##
## AcecoolLib.debug: Examples
##
---------------------------------------------------------------------------

	Table of Contents:

		## Create a 3 line piped text which looks something like this:	X	Text Appears Here	X ---- Redirects to AcecoolLib.text.PipedHeader( ... );		AcecoolLib.debug.PipedHeader( _text, _pipes = 'X', _buffer = 4, _buffer_chars = ' ' );

		## Simple Text-Based Header... Will be moved to Text / String package soon...
		AcecoolLib.debug.Header( _header = '', _prefix = '', _suffix = '', _depth = 0 );

		## Simple Text-Based Footer... Will be moved to Text / String package soon...
		AcecoolLib.debug.Footer( _prefix = '', _suffix = '\n\n', _depth = 1 );

		## Text Replacers used in _text.format( **AcecoolLib.Acecool.Replacers( _depth_prefix ) );
		AcecoolLib.debug.Replacers( _depth_prefix = '' );

		## This function - used to list all functions, and give a brief demonstration, or information as to their usage and / or purpose...
		AcecoolLib.debug.__example__( _depth = 1 );





------- Uses AccessorFuncDB? -------
None
##
## AcecoolLib.dict: Examples
##
---------------------------------------------------------------------------

	Table of Contents: AcecoolLib.dict

	##
	## Dict.(  ) - ...
	##
	---------------------------------------------------------------------------
		
		
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



------- Uses AccessorFuncDB? -------
None
##
## AcecoolLib.example: Examples
##
---------------------------------------------------------------------------

------- Uses AccessorFuncDB? -------
None
##
## AcecoolLib.file: Examples
##
---------------------------------------------------------------------------

	Table of Contents:

	##
	## File.(  ) - ...
	##
	---------------------------------------------------------------------------
		
		
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



------- Uses AccessorFuncDB? -------
None
##
## AcecoolLib.folder: Examples
##
---------------------------------------------------------------------------

	Table of Contents:

	##
	## Folder.(  ) - ...
	##
	---------------------------------------------------------------------------
		
		
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



------- Uses AccessorFuncDB? -------
None
##
## AcecoolLib.function: Examples
##
---------------------------------------------------------------------------

	Table of Contents:

	##
	## Function.(  ) - ...
	##
	---------------------------------------------------------------------------
		
		
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



------- Uses AccessorFuncDB? -------
None
##
## AcecoolLib.list: Examples
##
---------------------------------------------------------------------------

	Table of Contents:

	##
	## List.(  ) - ...
	##
	---------------------------------------------------------------------------
		
		
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



------- Uses AccessorFuncDB? -------
None
##
## AcecoolLib.logic: Examples
##
---------------------------------------------------------------------------

	Table of Contents:

	##
	## Logic.(  ) - ...
	##
	---------------------------------------------------------------------------
		
		
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



------- Uses AccessorFuncDB? -------
None
##
## AcecoolLib.math: Examples
##
---------------------------------------------------------------------------

------- Uses AccessorFuncDB? -------
None
##
## AcecoolLib.python: Examples
##
---------------------------------------------------------------------------

------- Uses AccessorFuncDB? -------
None
##
## AcecoolLib.string: Examples
##
---------------------------------------------------------------------------

	Table of Contents:

	##
	## Index for Examples
	##
	---------------------------------------------------------------------------
		## String.FormatColumn( [ _width, _text ]+ ... )
		## String.FormatSimpleColumn( _width, [ _text ] ... ) 
		## String.FormatColumnEx( _blank_chars, [ _width, _text ]+ ... ) 
		## String.Truncate( _text, _max_len, _suffix = "..", _absolute_max_len = True )
		## DATA_TYPE Output
		## String.reverse( _text )
		## String.repeat( _text, _count = 1 )
		## String.ToString( [ _text ]+ )
		## String.ToStringKeyedVarArgs( [ _text ]+ )
		## String.Safe( _text =  )
		## String.IndexOf( _needle, _haystack )
		## String.IndexOfExists( _needle, _haystack, _case_sensitive )
		## String.SubStr( _text, _start, _end )
		## String.SubStrEx( _text, _start, _end )
		## String.SubStrNextChars( _text = , _start = 0, _chars = 1 )
		## String.Strip( _text, _index, _len )
		## String.StripAll( _needle, _haystack, _case_sensitive = True )
		## String.FindAll( _needle, _haystack )
		## String.StripQuotes( _text )
		## String.GetQuotesType( _text )
		## String.HasQuotes( _text )
		## String.StartChars( _text, _count )
		## String.EndChars( _text, _count )
		## String.NotEndChars( _text, _count )
		## String.StartsWith( _needle, _haystack )
		## String.EndsWith( _needle, _haystack )
		## String.FormatColumnStripR( _width = 25, _text =, *_varargs )
		## String.FormatSimpleColumnStripR( _width = 25, *_varargs )
		## String.GetFileName( _file =  )
		## String.GetFileExt( _file =  )
		## String.String.__example__( )


	##
	## Note: All, or most, of the examples below are formatted into columns using:
	##
	---------------------------------------------------------------------------
		## Please Also Note that I alternate blank character patterns to show the text is truncated if it reaches the max size... 
		## I am considering adding in a border option, so there ccan always be 1 char space, or you decide, between areas ( meaning subtracting from the allotted length, OR adding an extra char...
		## I am also going to work on a Layout System so those old Dos Characters ( which made up the nice looking tables in the BIOS, etc... ) can be used as a buffer / organizer with header...
		## Note: The blank char in the Ex format column function can be used to make interesting patterns as you can use 1 to many chars... Experiment to find what looks best to you for your debugging needs!
		## 
		String.FormatColumn( [ _width, _text ] ... )
		
		ie: String.FormatColumn( 10,	"Test 10 Width",		20,	"Test 20 Width",		30,	"Test 30 Width" )
		
		10  10  10__|><|__|><|__|><|__T  h  i  r  t yT  h  i  r  t y
		Test 10 WiTest 20 Width       Test 30 Width                 <Whitespace OR Substitute Chars Fill Space>
		10  10  10__|><|__|><|__|><|__T  h  i  r  t yT  h  i  r  t y
		
		String.FormatSimpleColumn( _width, [ _text ] ... )
		
		ie: String.FormatSimpleColumn( 10, "Test 10", "Test 20", "Test 30" )
		
		10  10  10__|><|__|>T  h  i  r
		Test 10 WiTest 20 WiTest 30 Wi<Whitespace OR Substitute Chars Fill Space>
		10  10  10__|><|__|>T  h  i  r
		
		String.FormatColumnEx( _blank_chars, [ _width, _text ] ... )
		
		ie: String.FormatColumnEx( "-",		60,	"" )
		ie: String.FormatColumnEx( " ",		10,	"Test 10 Width",		20,	"Test 20 Width",		30, "Test 30 Width" )
		ie: String.FormatColumnEx( "-",		10,	"Test 10 Width",		20,	"Test 20 Width",		30, "Test 30 Width" )
		ie: String.FormatColumnEx( " -",		10,	"Test 10 Width",		20,	"Test 20 Width",		30, "Test 30 Width" )
		ie: String.FormatColumnEx( "- ",		10,	"Test 10 Width",		20,	"Test 20 Width",		30, "Test 30 Width" )
		ie: String.FormatColumnEx( " - ",		10,	"Test 10 Width",		20,	"Test 20 Width",		30, "Test 30 Width" )
		
		------------------------------------------------------------
		----------....................------------------------------
		Test 10 WiTest 20 Width       Test 30 Width                 <Whitespace OR Substitute Chars Fill Space>
		Test 10 WiTest 20 Width-------Test 30 Width-----------------<Whitespace OR Substitute Chars Fill Space>
		Test 10 WiTest 20 Width - - - Test 30 Width - - - - - - - - <Whitespace OR Substitute Chars Fill Space>
		Test 10 WiTest 20 Width- - - -Test 30 Width- - - - - - - - -<Whitespace OR Substitute Chars Fill Space>
		Test 10 WiTest 20 Width -  -  Test 30 Width -  -  -  -  -  -<Whitespace OR Substitute Chars Fill Space>
		----------....................------------------------------
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


	##
	## String.Truncate( <str> _text, <int> _max_len, <str> || <False> _suffix = "..", <bool> _absolute_max_len = True )
	##
	--------------------------------------------------------------------------- 8
		Testing             ==        Testing                                           
		Testing             ==        Testing                                           
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 7		Testing             ==        Testing                                           
		Testing             ==        Testing                                           
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6		Testin              ==        Testin                                            
		Test..              ==        Test..                                            
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5		Testi               ==        Testi                                             
		Tes..               ==        Tes..                                             
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4		Test                ==        Test                                              
		Te..                ==        Te..                                              
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3		Tes                 ==        Tes                                               
		T..                 ==        T..                                               
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2		Te                  ==        Te                                                
		..                  ==        Te                                                
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1		T                   ==        T                                                 
		.                   ==        T                                                 
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 0		                    ==                                                          
		                    ==                                                          
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ Finished


	##
	## String.reverse( <str> _text )
	##
	---------------------------------------------------------------------------
		gnitseT             ==        gnitseT                                           
		Testing             ==        Testing                                           
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


	##
	## String.repeat( <str> _text, <int> _count = 1 )
	##
	---------------------------------------------------------------------------
		Testing             ==        Testing                                           
		TestingTesting      ==        TestingTesting                                    
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


	##
	## String.FormatColumn( 20, 'TYPE_*', 50, str( TYPE_* ) ) - Used to display TYPE_ output...
	##
	---------------------------------------------------------------------------
		TYPE_ANY            ==        None                                              
		TYPE_INTEGER        ==        <class 'int'>                                     
		TYPE_ENUM           ==        <class 'int'>                                     
		TYPE_COMPLEX        ==        <class 'complex'>                                 
		TYPE_FLOAT          ==        <class 'float'>                                   
		TYPE_BOOLEAN        ==        <class 'bool'>                                    
		TYPE_STRING         ==        <class 'str'>                                     
		TYPE_TYPE           ==        <class 'type'>                                    
		TYPE_TUPLE          ==        <class 'tuple'>                                   
		TYPE_LIST           ==        <class 'list'>                                    
		TYPE_SET            ==        <class 'set'>                                     
		TYPE_DICT           ==        <class 'dict'>                                    
		TYPE_FUNCTION       ==        <class 'function'>                                
		TYPE_METHOD         ==        <class 'function'>                                
		TYPE_OBJECT         ==        <class 'object'>                                  
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


	##
	## String.ToString( _text, [ _text ]* ) - This is used to quickly convert a wide range of elements to string without calling str( ) on all of them..
	##
	---------------------------------------------------------------------------
		20, Testing, 50, Testing
		20, TestingTesting, 50, TestingTesting
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


	##
	## String.ToStringKeyedVarArgs( _text, [ _text ]* ) - This is used to create copy / paste code for Dicts, etc.. Or to organize debugging data of a list...
	##
	---------------------------------------------------------------------------
		"20" = Testing, "50" = Testing
		"20" = TestingTesting, "50" = TestingTesting
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


	##
	## Dict.SetupQuickLookupTable[ Ex ]( _table [ , _default_value, _use_key_instead_of_value ]* ) - This is used to create an O( 1 ) map!
	## Note: Non Ex will automatically use the appropriate _use_key_instead_of_value option for _dicts vs _tuples and _lists
	##
	---------------------------------------------------------------------------
		{'one': 1, 'two': 2, 'three': 3, 'four': 4}
		
		
		{'one': True, 'two': True, 'three': True, 'four': True}
		
		
		{'one': True, 'two': True, 'three': True, 'four': True}
		{'one': None, 'two': None, 'three': None, 'four': None}
		{'one': False, 'two': False, 'three': False, 'four': False}
		
		
		Dict.FromValues - Setting each value to be True - First uses Value, second uses Key as identifier... Note: Keys are one / two / three / four -- Values are 1 / 2 / 3 / 4
		1: KEY = True                                     {'one': True, 'two': True, 'three': True, 'four': True}                                                                                               
		

		2: VALUE = True                                   {'1': True, '2': True, '3': True, '4': True}                                                                                                          
		

		3: VALUE = KEY                                    {'1': 'one', '2': 'two', '3': 'three', '4': 'four'}                                                                                                   
		4: VALUE = VALUE                                  {'1': 1, '2': 2, '3': 3, '4': 4}                                                                                                                      
		

		5: KEY = KEY                                      {'one': 'one', 'two': 'two', 'three': 'three', 'four': 'four'}                                                                                        
		6: KEY = VALUE                                    {'one': 1, 'two': 2, 'three': 3, 'four': 4}                                                                                                           
		
		Dict.SetupQuickLookupTable - 1: Default = Value = type( Value ) ... 2: Returns _key for value ... 3: Returns _value for value
		1.1: KEY = str( type( KEY ) )                     Dict.SetupQuickLookupTable( _dict )                                                                 {'one': "<class 'str'>", 'two': "<class 'str'>", 'three': "<class 'str'>", 'four': "<class 'str'>"}                                                   
		1.2: VALUE = True                                 Dict.SetupQuickLookupTableEx( _dict )                                                               {'one': True, 'two': True, 'three': True, 'four': True}                                                                                               
		1.3: VALUE = str( type( VALUE ) )                 Dict.SetupQuickLookupTable( _tuple )                                                                {'one': "<class 'int'>", 'two': "<class 'int'>", 'three': "<class 'int'>", 'four': "<class 'int'>"}                                                   
		1.4: KEY = str( type( KEY ) )                     Dict.SetupQuickLookupTable( _list )                                                                 {'one': "<class 'int'>", 'two': "<class 'int'>", 'three': "<class 'int'>", 'four': "<class 'int'>"}                                                   
		1.5: KEY = True )                                 Dict.SetupQuickLookupTableEx( _tuple, True, True )                                                  {'0': True, '1': True, '2': True, '3': True}                                                                                                          
		1.6: KEY = True )                                 Dict.SetupQuickLookupTableEx( _list, True, True )                                                   {'0': True, '1': True, '2': True, '3': True}                                                                                                          
		1.7: VALUE = True )                               Dict.SetupQuickLookupTableEx( _tuple, True, False )                                                 {'one': True, 'two': True, 'three': True, 'four': True}                                                                                               
		1.8: VALUE = True )                               Dict.SetupQuickLookupTableEx( _list, True, False )                                                  {'one': True, 'two': True, 'three': True, 'four': True}                                                                                               
		
		2.1: KEY = None                                   Dict.SetupQuickLookupTableEx( _dict, None, True )                                                   {'one': None, 'two': None, 'three': None, 'four': None}                                                                                               
		2.2: KEY = KEY                                    Dict.SetupQuickLookupTableEx( _dict, ( lambda _dict, _key, _value: _key ), True )                   {'one': 'one', 'two': 'two', 'three': 'three', 'four': 'four'}                                                                                        
		2.3: KEY = type( KEY )                            Dict.SetupQuickLookupTableEx( _dict, ( lambda _dict, _key, _value: type( _key ) ), True )           {'one': <class 'str'>, 'two': <class 'str'>, 'three': <class 'str'>, 'four': <class 'str'>}                                                           
		2.4: KEY = str( type( KEY ) )                     Dict.SetupQuickLookupTableEx( _dict, ( lambda _dict, _key, _value: str( type( _key ) ) ), True )    {'one': "<class 'str'>", 'two': "<class 'str'>", 'three': "<class 'str'>", 'four': "<class 'str'>"}                                                   
		2.5: KEY = VALUE                                  Dict.SetupQuickLookupTableEx( _dict, ( lambda _dict, _key, _value: _value ), True )                 {'one': 1, 'two': 2, 'three': 3, 'four': 4}                                                                                                           
		2.6: KEY = type( VALUE )                          Dict.SetupQuickLookupTableEx( _dict, ( lambda _dict, _key, _value: type( _value ) ), True )         {'one': <class 'int'>, 'two': <class 'int'>, 'three': <class 'int'>, 'four': <class 'int'>}                                                           
		2.7: KEY = str( type( VALUE ) )                   Dict.SetupQuickLookupTableEx( _dict, ( lambda _dict, _key, _value: str( type( _value ) ) ), True )  {'one': "<class 'int'>", 'two': "<class 'int'>", 'three': "<class 'int'>", 'four': "<class 'int'>"}                                                   
		
		3.1: VALUE = None                                 Dict.SetupQuickLookupTableEx( _dict, None, False )                                                  {'1': None, '2': None, '3': None, '4': None}                                                                                                          
		3.2: VALUE = KEY                                  Dict.SetupQuickLookupTableEx( _dict, ( lambda _dict, _key, _value: _key ) )                         {'one': 'one', 'two': 'two', 'three': 'three', 'four': 'four'}                                                                                        
		3.3: VALUE = type( KEY )                          Dict.SetupQuickLookupTableEx( _dict, ( lambda _dict, _key, _value: type( _key ) ) )                 {'one': <class 'str'>, 'two': <class 'str'>, 'three': <class 'str'>, 'four': <class 'str'>}                                                           
		3.4: VALUE = str( type( KEY ) )                   Dict.SetupQuickLookupTableEx( _dict, ( lambda _dict, _key, _value: str( type( _key ) ) ) )          {'one': "<class 'str'>", 'two': "<class 'str'>", 'three': "<class 'str'>", 'four': "<class 'str'>"}                                                   
		3.5: VALUE = VALUE                                Dict.SetupQuickLookupTableEx( _dict, ( lambda _dict, _key, _value: _value ) )                       {'one': 1, 'two': 2, 'three': 3, 'four': 4}                                                                                                           
		3.6: VALUE = type( VALUE )                        Dict.SetupQuickLookupTableEx( _dict, ( lambda _dict, _key, _value: type( _value ) ) )               {'one': <class 'int'>, 'two': <class 'int'>, 'three': <class 'int'>, 'four': <class 'int'>}                                                           
		3.7: VALUE = str( type( VALUE ) )                 Dict.SetupQuickLookupTableEx( _dict, ( lambda _dict, _key, _value: str( type( _value ) ) ) )        {'one': "<class 'int'>", 'two': "<class 'int'>", 'three': "<class 'int'>", 'four': "<class 'int'>"}                                                   
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



------- Uses AccessorFuncDB? -------
None
##
## AcecoolLib.system: Examples
##
---------------------------------------------------------------------------

------- Uses AccessorFuncDB? -------
None
##
## AcecoolLib.table: Examples
##
---------------------------------------------------------------------------

	Table of Contents:

	##
	## Table.(  ) - ...
	##
	---------------------------------------------------------------------------
		
		
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



------- Uses AccessorFuncDB? -------
None
##
## AcecoolLib.text: Examples
##
---------------------------------------------------------------------------

	Table of Contents:
#                          #
#    Table of Contents:    #
#                          #

		## Simple Text-Based Header... Will be moved to Text / string package soon...
		AcecoolLib.text.PipedHeader( _header = '', _prefix = '', _suffix = '', _depth = 0 );

		## Simple Text-Based Footer... Will be moved to Text / string package soon...
		AcecoolLib.text.DebugFooter( _prefix = '', _suffix = '\n\n', _depth = 1 );

		## Text Replacers used in _text.format( **AcecoolLib.Acecool.Replacers( _depth_prefix ) );
		AcecoolLib.text.DebugReplacers( _depth_prefix = '' );

		## This function - used to list all functions, and give a brief demonstration, or information as to their usage and / or purpose...
		AcecoolLib.text.__example__( _depth = 1 );





------- Uses AccessorFuncDB? -------
None
##
## AcecoolLib.tuple: Examples
##
---------------------------------------------------------------------------

	Table of Contents:

	##
	## Tuple.(  ) - ...
	##
	---------------------------------------------------------------------------
		
		
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Obviously not all populated yet since I haven’t finished moving everything into the new layout and I may still move some stuff around…

But am I doing something wrong because I can’t really execute from within the package, even though it works from outside of it?

Thanks :slight_smile:

0 Likes

#2

Sublime treats any Python file in the root of a package as a Plugin; the only way to stop it from loading a plugin are:

  1. Ignore the package that it’s in (which disables the entire package)
  2. Change the extension so that it’s no longer a Python file
  3. Put it in a subfolder of the package so that it is no longer considered a plugin

All else being equal, #3 is probably what you want here. Note that only files that are considered plugins can contribute commands and event handlers, so if the files you’re trying to stop Sublime from loading contain commands, you need to import the command classes into a plugin file that it’s loading so that it will see them.

1 Like

#3

Well - I converted a massive file of mine into a Python package. I did this to make it easier to bring over all of my logic from other languages and put it into an easy to navigate package.

I can’t disable it, or rename it because I need the functions, libraries, objects, helpers, properties and accessors in my builds.

I want it separate so I can set up smaller plugins for Sublime Text, without including the same library each time, and instead simply setting up a ‘requires x’ in the plugin file so it’ll automatically be downloaded.

I do suppose I could add in logic that prevents it from executing on its own - I’ll have to do some tests for this - but I want it so I can just do import AcecoolLib and be done with it. I don’t want to have to do something like import AcecoolLib.AcecoolLibSubFolder as AcecoolLib;

So all 3 don’t seem usable at the moment although #3 is the least worst but still bad…

The issue is AcecoolLib is a package - and Sublime Text is supposed to support adding them to the packages dir so they can be used for other plugins…

The issue with mine, and I may be doing something wrong - is my imports have errors when auto included.

if I import from an external file, it works fine ( at least it does outside of Sublime text - I’ll have to check within - but it it works fine when I simply import AcecoolLib from 1 folder up, then it should work without ).

The errors I’m getting are things like:


AcecoolLib - Importing...

	> AcecoolLib.__global__

	- AcecoolLib.Acecool

	> AcecoolLib.ai
	- AcecoolLib.debug
	- AcecoolLib.string
Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 125, in reload_plugin
    m = importlib.import_module(modulename)
  File "./python3.3/importlib/__init__.py", line 90, in import_module
  File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper
  File "<frozen importlib._bootstrap>", line 1022, in load_module
  File "<frozen importlib._bootstrap>", line 1003, in load_module
  File "<frozen importlib._bootstrap>", line 560, in module_for_loader_wrapper
  File "<frozen importlib._bootstrap>", line 868, in _load_module
  File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
  File "C:\Users\Acecool\AppData\Roaming\Sublime Text 3\Packages\AcecoolLibText.py", line 45, in <module>
    from AcecoolLib.__global__ import *;
  File "C:\Users\Acecool\AppData\Roaming\Sublime Text 3\Packages\AcecoolLib\__init__.py", line 175, in <module>
    from . import ai;
  File "C:\Users\Acecool\AppData\Roaming\Sublime Text 3\Packages\AcecoolLib\ai\__init__.py", line 48, in <module>
    from .. import debug;
  File "C:\Users\Acecool\AppData\Roaming\Sublime Text 3\Packages\AcecoolLib\debug.py", line 50, in <module>
    from . import string as string;
  File "C:\Users\Acecool\AppData\Roaming\Sublime Text 3\Packages\AcecoolLib\string.py", line 63, in <module>
    from . import debug;
ImportError: cannot import name debug

I’ll double-check but it just seems strange. I have 3 decades + of programming and design experience; but I have never used Python packages. I never used Python enough; but because I have written so much logic in so many languages – I have decided to port all of it to as many languages as possible so if my last chance surgery option fails - it’ll be available.

edit: Wait a minute - I just noticed for the first time it is being called from the test python file… strange. I thought I removed it - actually I moved it into the main dir because I didn’t think it would auto include it from there if it wasn’t in a folder… grr… lol… I’ll check that and report back.

0 Likes

#4

Seems to still be an issue:

EDIT: Seems to still be an issue.

40k chars…

edit: 6 month timer instead of 60 minutes: https://pastebin.com/muFYGfwb

edit: So the big issue seemed to be using the . notation… or …

If I hard-code AcecoolLib as the package name, I don’t get the errors. But I’d rather not hard-code it in case I decide to name it AcecoolPyLib or something like that.

Any ideas?

If I compile without it going through Sublime Text - either way… no errors.

However if I save a file with the import, I get the errors.

I may still get them on start-up… 1 sec.

0 Likes

#5

I think your main issue may be that what you’re actually trying to create is a dependency but you’re putting it in the packages folder incorrectly. Generally you would create something like Packages/Bob/all/Bob, put your library content in the inner version, and then create the appropriate metadata file and use Install Local Dependency from the command palette to get Package Control to set it up.

That will make PackageControl set things up so that import Bob will pull from the inner folder while at the same time making sure that Sublime doesn’t touch the files.

I’ve never tried it but I wouldn’t be surprised if you can’t use relative imports to pull data from other packages, if that’s what you’re trying to do.

0 Likes