﻿<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=Dev%3ADoc%2FTools%2FDebugging%2FPython_Trace</id>
	<title>Dev:Doc/Tools/Debugging/Python Trace - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=Dev%3ADoc%2FTools%2FDebugging%2FPython_Trace"/>
	<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:Doc/Tools/Debugging/Python_Trace&amp;action=history"/>
	<updated>2026-07-04T03:20:44Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=Dev:Doc/Tools/Debugging/Python_Trace&amp;diff=150327&amp;oldid=prev</id>
		<title>Yamyam: 1版 をインポートしました</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:Doc/Tools/Debugging/Python_Trace&amp;diff=150327&amp;oldid=prev"/>
		<updated>2018-06-28T21:15:07Z</updated>

		<summary type="html">&lt;p&gt;1版 をインポートしました&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;2018年6月28日 (木) 21:15時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ja&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(相違点なし)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Yamyam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=Dev:Doc/Tools/Debugging/Python_Trace&amp;diff=150326&amp;oldid=prev</id>
		<title>wiki&gt;Ideasman42: /* Tracing Python Code */</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:Doc/Tools/Debugging/Python_Trace&amp;diff=150326&amp;oldid=prev"/>
		<updated>2015-11-15T23:51:25Z</updated>

		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Tracing Python Code&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Tracing Python Code =&lt;br /&gt;
&lt;br /&gt;
Tracing code is a handy way to check what the code is doing, where stepping over line by line is impractical.&lt;br /&gt;
&lt;br /&gt;
If a certain operation isn't behaving properly you can trace the execution of the working &amp;amp; failing state, then view their differences to see at which point the code-path diverges.&lt;br /&gt;
&lt;br /&gt;
== The 'trace' module ==&lt;br /&gt;
&lt;br /&gt;
This example shows how to use the [https://docs.python.org/3.5/library/trace.html &amp;lt;tt&amp;gt;trace&amp;lt;/tt&amp;gt;] Python module to trace script execution.&lt;br /&gt;
&lt;br /&gt;
https://developer.blender.org/diffusion/B/browse/master/release/scripts/modules/bpy/__init__.py;711e3564b808ab802c503409e7740b0ca9b6ef65$68&lt;br /&gt;
&lt;br /&gt;
The function call shows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
# Initializes Python classes.&lt;br /&gt;
# (good place to run a profiler or trace).&lt;br /&gt;
utils.load_scripts()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example shows how a the function call can be traced.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
import trace&lt;br /&gt;
tracer = trace.Trace(&lt;br /&gt;
        ignoredirs=[sys.prefix, sys.exec_prefix],&lt;br /&gt;
        trace=1,&lt;br /&gt;
        count=1,&lt;br /&gt;
        )&lt;br /&gt;
tracer.runctx('utils.load_scripts()', globals=globals(), locals=locals())&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This traces all script execution on startup (addon registration, module imports... etc).&lt;br /&gt;
&lt;br /&gt;
Heres an example of what the output may look like.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=text&amp;gt;&lt;br /&gt;
 --- modulename: __init__, funcname: &amp;lt;module&amp;gt;&lt;br /&gt;
&amp;lt;string&amp;gt;(1):  --- modulename: __init__, funcname: load_scripts&lt;br /&gt;
__init__.py(145):     use_time = _bpy.app.debug_python&lt;br /&gt;
__init__.py(147):     if use_time:&lt;br /&gt;
__init__.py(151):     loaded_modules = set()&lt;br /&gt;
__init__.py(153):     if refresh_scripts:&lt;br /&gt;
__init__.py(156):     if reload_scripts:&lt;br /&gt;
__init__.py(166):     def register_module_call(mod):&lt;br /&gt;
__init__.py(179):     def unregister_module_call(mod):&lt;br /&gt;
__init__.py(188):     def test_reload(mod):&lt;br /&gt;
__init__.py(202):     def test_register(mod):&lt;br /&gt;
__init__.py(215):     if reload_scripts:&lt;br /&gt;
__init__.py(231):     from bpy_restrict_state import RestrictBlend&lt;br /&gt;
 --- modulename: bpy_restrict_state, funcname: &amp;lt;module&amp;gt;&lt;br /&gt;
bpy_restrict_state.py(23): &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
bpy_restrict_state.py(26):     &amp;quot;RestrictBlend&amp;quot;,&lt;br /&gt;
bpy_restrict_state.py(29): import bpy as _bpy&lt;br /&gt;
bpy_restrict_state.py(32): class _RestrictContext:&lt;br /&gt;
 --- modulename: bpy_restrict_state, funcname: _RestrictContext&lt;br /&gt;
bpy_restrict_state.py(32): class _RestrictContext:&lt;br /&gt;
bpy_restrict_state.py(33):     __slots__ = ()&lt;br /&gt;
bpy_restrict_state.py(34):     _real_data = _bpy.data&lt;br /&gt;
bpy_restrict_state.py(36):     _real_pref = _bpy.context.user_preferences&lt;br /&gt;
bpy_restrict_state.py(38):     @property&lt;br /&gt;
bpy_restrict_state.py(42):     @property&lt;br /&gt;
bpy_restrict_state.py(47): class _RestrictData:&lt;br /&gt;
 --- modulename: bpy_restrict_state, funcname: _RestrictData&lt;br /&gt;
bpy_restrict_state.py(47): class _RestrictData:&lt;br /&gt;
bpy_restrict_state.py(48):     __slots__ = ()&lt;br /&gt;
bpy_restrict_state.py(51): _context_restrict = _RestrictContext()&lt;br /&gt;
bpy_restrict_state.py(52): _data_restrict = _RestrictData()&lt;br /&gt;
bpy_restrict_state.py(55): class RestrictBlend:&lt;br /&gt;
 --- modulename: bpy_restrict_state, funcname: RestrictBlend&lt;br /&gt;
bpy_restrict_state.py(55): class RestrictBlend:&lt;br /&gt;
bpy_restrict_state.py(56):     __slots__ = (&amp;quot;context&amp;quot;, &amp;quot;data&amp;quot;)&lt;br /&gt;
bpy_restrict_state.py(58):     def __enter__(self):&lt;br /&gt;
bpy_restrict_state.py(64):     def __exit__(self, type, value, traceback):&lt;br /&gt;
__init__.py(233):     with RestrictBlend():&lt;br /&gt;
 --- modulename: bpy_restrict_state, funcname: __enter__&lt;br /&gt;
bpy_restrict_state.py(59):         self.data = _bpy.data&lt;br /&gt;
bpy_restrict_state.py(60):         self.context = _bpy.context&lt;br /&gt;
bpy_restrict_state.py(61):         _bpy.data = _data_restrict&lt;br /&gt;
bpy_restrict_state.py(62):         _bpy.context = _context_restrict&lt;br /&gt;
__init__.py(234):         for base_path in script_paths():&lt;br /&gt;
 --- modulename: __init__, funcname: script_paths&lt;br /&gt;
__init__.py(306):     scripts = list(_scripts)&lt;br /&gt;
__init__.py(308):     if check_all:&lt;br /&gt;
__init__.py(314):         base_paths = _bpy_script_paths()&lt;br /&gt;
__init__.py(316):     for path in base_paths + (script_path_user(), script_path_pref()):&lt;br /&gt;
 --- modulename: __init__, funcname: script_path_user&lt;br /&gt;
__init__.py(282):     path = _user_resource('SCRIPTS')&lt;br /&gt;
__init__.py(283):     return _os.path.normpath(path) if path else None&lt;br /&gt;
 --- modulename: __init__, funcname: script_path_pref&lt;br /&gt;
__init__.py(288):     path = _user_preferences.filepaths.script_directory&lt;br /&gt;
__init__.py(289):     return _os.path.normpath(path) if path else None&lt;br /&gt;
__init__.py(317):         if path:&lt;br /&gt;
__init__.py(318):             path = _os.path.normpath(path)&lt;br /&gt;
__init__.py(319):             if path not in scripts and _os.path.isdir(path):&lt;br /&gt;
__init__.py(320):                 scripts.append(path)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
-- snip (around 40k lines) --&lt;/div&gt;</summary>
		<author><name>wiki&gt;Ideasman42</name></author>
		
	</entry>
</feed>