Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def ask_for_stop(use_back):
import pydevd
if use_back:
pydevd.settrace(stop_at_frame=sys._getframe().f_back)
else:
pydevd.settrace()
print('Will stop here if use_back==False.')
debug_config["port"] = int(os.environ["PYTHON_DEBUG_PORT"].strip())
if "PYTHON_DEBUG_HOST" in os.environ:
debug_config["host"] = os.environ["PYTHON_DEBUG_HOST"]
if "PYTHON_DEBUG_ENABLE" in os.environ:
if os.environ["PYTHON_DEBUG_ENABLE"].strip() == "true":
if "host" not in debug_config:
debug_config["host"] = re.findall("([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)+",
subprocess.run(["ip", "route"],
stdout=subprocess.PIPE).stdout.decode().split(
"\n")[0])[0]
if len(debug_config):
import pydevd
print("Starting nginx-proxy in debug mode. Trying to connect to debug server ", str(debug_config))
pydevd.settrace(stdoutToServer=True, stderrToServer=True, **debug_config)
# fix for https://trello.com/c/dMG5lcTZ
try:
client = docker.from_env()
client.version()
except Exception as e:
print(
"There was error connecting with the docker server \nHave you correctly mounted /var/run/docker.sock?\n" + str(
e.args), file=sys.stderr)
sys.exit(1)
def eventLoop():
for event in client.events(decode=True):
try:
eventType = event["Type"]
if ':' not in config.version_id:
# The default server version_id does not contain ':'
import json
import os
import sys
startup = config.python_config.startup_args
if not startup:
raise AssertionError('Expected --python_startup_args to be passed from the pydev debugger.')
setup = json.loads(startup)
pydevd_path = setup['pydevd']
sys.path.append(os.path.dirname(pydevd_path))
import pydevd
pydevd.settrace(setup['client'], port=setup['port'], suspend=False, trace_only_current_thread=False)
import SimpleDownloader as downloader
from modules import create
from modules import dialoge
from modules import fileSys
from modules import guiTools
from modules import urlUtils
from modules import updateAll
import utils
import xbmc, xbmcaddon, xbmcgui, xbmcplugin, xbmcvfs
import service
# Debug option pydevd:
if True:
import pydevd
pydevd.settrace(stdoutToServer=True, stderrToServer=True)
reload(sys)
sys.setdefaultencoding("utf-8")
#from modules import createNFO
addnon_id = 'plugin.video.osmosis'
addon = xbmcaddon.Addon(addnon_id)#
addon_version = addon.getAddonInfo('version')
ADDON_NAME = addon.getAddonInfo('name')
REAL_SETTINGS = xbmcaddon.Addon(id=addnon_id)#
ADDON_SETTINGS = REAL_SETTINGS.getAddonInfo('profile')
MediaList_LOC = xbmc.translatePath(os.path.join(ADDON_SETTINGS,'MediaList.xml'))#
STRM_LOC = xbmc.translatePath(os.path.join(ADDON_SETTINGS,'STRM_LOC'))#
profile = xbmc.translatePath(addon.getAddonInfo('profile').decode('utf-8'))#
home = xbmc.translatePath(addon.getAddonInfo('path').decode('utf-8'))#
favorites = os.path.join(profile, 'favorites')
def settrace(self, debugger_ip, debugger_port):
import pydevd
pydevd.settrace(debugger_ip, port=debugger_port, stdoutToServer=True, stderrToServer=True, suspend=False)
and increase response time.
"""
import sys
REMOTE_DEBUG = False # Switch remote debugging on or off
ADDRESS = 'localhost' # 'localhost' or IP number, ex: '10.0.0.3'
PORT = 5678 # Eclipse standard debug server port.
# ------------------------------------------------------------
if REMOTE_DEBUG:
try:
import pydevd
pydevd.settrace(ADDRESS, port=PORT, suspend=False,
# Redirect stdout and stderr to eclipse console
stdoutToServer=True, stderrToServer=True)
sys.stdout.write(">>> Pydevd remote debugging activated.\r\n")
except ImportError:
sys.stderr.write(
"Err: Failed to import Eclipse debug module, pydevd.\r\n")
except:
sys.stderr.write("Eclipse debug server is not responding.\r\n")
else:
sys.stdout.write(">>> Debugging is off.\r\n")
def execute(self):
import pydevd
pydevd.settrace('localhost', port=5434, stdoutToServer=True, stderrToServer=True)
failed_files = []
for filename in self._filenames:
try:
ws, run, filename = load_utils.load_workspace_from_filename(filename)
except Exception:
failed_files += [filename]
continue
self._loaded_data_store.remove_data(run=run)
self._loaded_data_store.add_data(run=run, workspace=ws, filename=filename)
if failed_files:
message = load_utils.exception_message_for_failed_files(failed_files)
raise ValueError(message)
def halt(self):
''' This is the Break-Point-Function '''
try:
self.updatePath()
import pydevd
pydevd.settrace(self.debugServer, stdoutToServer=True, stderrToServer=True)
except:
pass
def append(self, name, text):
import pydevd
pydevd.settrace('192.168.33.1', 5678)
new_items = self._parse(text, ICAL_TYPES, name)
timezones = list(filter(
lambda x: x.tag == ical.Timezone.tag, new_items.values()))
request = self._getRequestFromUrl(self.path)
for new_item in new_items.values():
if new_item.tag == ical.Timezone.tag:
continue
if new_item.name not in self.items:
self.items[new_item.name] = new_item
text = ical.serialize(self.tag, self.headers, [new_item] + timezones)
cal = vobject.readOne(text)
def gen(debug_port, **args):
if debug_port:
import pydevd
pydevd.settrace('localhost', port=int(debug_port), stdoutToServer=True, stderrToServer=True)
# ensure_logged_in()
pass