10 examples of 'python get script name' in Python

Every line of 'python get script name' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
84def get_script_name():
85 """Return the name of the top-level script."""
86 return os.path.splitext(scriptinfo()["name"])[0]
114def script_name(entry):
115 return os.path.basename(entry['name'])
83def getScriptName(self):
84 return "install-cmake.py"
26def _get_script_path():
27 """Get directory path of current script"""
28 script_filename = inspect.getframeinfo(inspect.currentframe()).filename
29 script_path = os.path.dirname(os.path.abspath(script_filename))
30
31 return script_path
6def get_script():
7 """
8 Returns the base cloud-init provisioning script for Nginx
9
10 """
11 tmpl = base.get_script()
12 tmpl += """
13install_core_packages
14install_puppet
15cd $MODULE_DIR
16puppet apply -e "include nginx" --modulepath modules
17
18"""
19 return tmpl
6def get_script():
7 """
8 Returns the base cloud-init provisioning script for Memcached
9
10 """
11 tmpl = base.get_script()
12 tmpl += """
13install_core_packages
14install_puppet
15cd $MODULE_DIR
16puppet apply -e "class { 'memcached': listen_host => '0.0.0.0', }" --modulepath modules
17
18"""
19 return tmpl
28def script_path(*args):
29 global script_dir
30 if not script_dir:
31 script_dir = os.path.join(os.path.dirname(__file__), '..', 'Scripts')
32 return os.path.join(*(script_dir,) + args)
197def get_script_name(environ):
198 """
199 Returns the equivalent of the HTTP request's SCRIPT_NAME environment
200 variable. If Apache mod_rewrite has been used, returns what would have been
201 the script name prior to any rewriting (so it's the script name as seen
202 from the client's perspective), unless DJANGO_USE_POST_REWRITE is set (to
203 anything).
204 """
205 from google.appengine._internal.django.conf import settings
206 if settings.FORCE_SCRIPT_NAME is not None:
207 return force_unicode(settings.FORCE_SCRIPT_NAME)
208
209 # If Apache's mod_rewrite had a whack at the URL, Apache set either
210 # SCRIPT_URL or REDIRECT_URL to the full resource URL before applying any
211 # rewrites. Unfortunately not every Web server (lighttpd!) passes this
212 # information through all the time, so FORCE_SCRIPT_NAME, above, is still
213 # needed.
214 script_url = environ.get('SCRIPT_URL', '')
215 if not script_url:
216 script_url = environ.get('REDIRECT_URL', '')
217 if script_url:
218 return force_unicode(script_url[:-len(environ.get('PATH_INFO', ''))])
219 return force_unicode(environ.get('SCRIPT_NAME', ''))
153def command_from_module_name(module_name):
154 """Converts a module name to a command name string.
155
156 Maps command module names to their command line equivilants, e.g.
157 'taucmdr.cli.commands.target.create' => 'tau target create'
158
159 Args:
160 module_name (str): Name of a module.
161
162 Returns:
163 str: A string that identifies the command.
164 """
165 if module_name == '__main__':
166 return os.path.basename(TAUCMDR_SCRIPT)
167 return ' '.join(_command_as_list(module_name))
67def pythoncommand():
68 if iswin():
69 return 'py'
70 else:
71 return 'python3'

Related snippets