﻿<?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_Eclipse</id>
	<title>Dev:Doc/Tools/Debugging/Python Eclipse - 版の履歴</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_Eclipse"/>
	<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:Doc/Tools/Debugging/Python_Eclipse&amp;action=history"/>
	<updated>2026-08-05T02:15:36Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=Dev:Doc/Tools/Debugging/Python_Eclipse&amp;diff=143803&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_Eclipse&amp;diff=143803&amp;oldid=prev"/>
		<updated>2018-06-28T21:04:30Z</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:04時点における版&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_Eclipse&amp;diff=143802&amp;oldid=prev</id>
		<title>wiki&gt;Ideasman42: /* Initial Test */</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=Dev:Doc/Tools/Debugging/Python_Eclipse&amp;diff=143802&amp;oldid=prev"/>
		<updated>2016-03-05T06:09:32Z</updated>

		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Initial Test&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Debugging Blender from Eclipse =&lt;br /&gt;
This is a quick-start tutorial to get you up and running with Eclipse as a debugging tool for Blender, and assumes that you are either familiar with Eclipse and PyDev as well as Blender Python scripting, or that you are prepared to do some research.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
* Eclipse&lt;br /&gt;
* PyDev (Eclipse Python integration)&lt;br /&gt;
&lt;br /&gt;
== Initial Test ==&lt;br /&gt;
Follow this list in order, to minimize any potential snags.&lt;br /&gt;
'&lt;br /&gt;
*If you're starting Eclipse for the first time, create a new PyDev project:&amp;lt;br&amp;gt;'''File -&amp;gt; New -&amp;gt; Other''',&amp;lt;br&amp;gt;then select one of the '''PyDev''' project types from the list.&lt;br /&gt;
*Activate the &amp;quot;Debug&amp;quot; perspective:&amp;lt;br&amp;gt;'''Window -&amp;gt; Perspectives -&amp;gt; Open Perspective -&amp;gt; Other''',&amp;lt;br&amp;gt;then select '''Debug -&amp;gt; Debug''' perspective from the list.&lt;br /&gt;
*Start the PyDev debug server:&amp;lt;br&amp;gt;'''PyDev -&amp;gt; Start Debug Server'''&lt;br /&gt;
*Create a new text block in Blender&lt;br /&gt;
*Paste this (suitably edited) at the beginning of the script:&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
PYDEV_SOURCE_DIR = &amp;quot;/usr/lib/eclipse/dropins/pydev/eclipse/plugins/org.python.pydev_4.5.4.201601292234/pysrc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
import sys&lt;br /&gt;
&lt;br /&gt;
if PYDEV_SOURCE_DIR not in sys.path:&lt;br /&gt;
   sys.path.append(PYDEV_SOURCE_DIR)&lt;br /&gt;
&lt;br /&gt;
import pydevd&lt;br /&gt;
&lt;br /&gt;
pydevd.settrace()&lt;br /&gt;
&lt;br /&gt;
bling = &amp;quot;the parrot has ceased to be&amp;quot;&lt;br /&gt;
print(bling)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Run the script in Blender - at this point Blender will hang (stop responding to input).&lt;br /&gt;
*Switch to Eclipse.&lt;br /&gt;
*The file you are debugging should be open, with the line it has stopped at highlighted&lt;br /&gt;
&lt;br /&gt;
== How it Works ==&lt;br /&gt;
&lt;br /&gt;
So how does all this magic work?&lt;br /&gt;
&lt;br /&gt;
When the Debug Server is started in Eclipse, it sits and listen on port 5678 on the loopback interface for Blender to start sending it messages via the network stack. When this happens, Eclipse grabs then and does all the debugging by communicating back and forth with Blender.&lt;br /&gt;
&lt;br /&gt;
The script actually runs in Blender, but the debugging takes place in Eclipse, with Eclipse getting all the necessary information to do this by sending and receiving messages from Blender.&lt;br /&gt;
&lt;br /&gt;
So, Eclipse if fully equipped to do the debugging at its end. Blender, on the other hand, needs a little help. First it needs to know where all the PyDev debugging stuff lives, because this will tell Blender how to communicate with Eclipse. You can find this path using the Python Console in eclipse:&lt;br /&gt;
&lt;br /&gt;
First start a Python console in Eclipse:&lt;br /&gt;
&lt;br /&gt;
* '''Window -&amp;gt; Show View -&amp;gt; Console'''&lt;br /&gt;
* There is a new console icon in the console header with the tool-tip '''Open Console'''&amp;lt;br&amp;gt;Click on this and select '''PyDev Console -&amp;gt; Python Console''' in the dialog box.&lt;br /&gt;
* Type in &amp;lt;source lang=bash&amp;gt;sys.path&amp;lt;/source&amp;gt; and press Return. A list of paths will be printed, the first one will be the pysrc path which Blender needs to know.&lt;br /&gt;
&lt;br /&gt;
An example of the output:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; sys.path&lt;br /&gt;
Out[2]: &lt;br /&gt;
['/usr/lib/eclipse/dropins/pydev/eclipse/plugins/org.python.pydev_4.5.4.201601292234/pysrc',&lt;br /&gt;
 '/usr/lib/python3.5/site-packages/mathutils-2.76-py3.5-linux-x86_64.egg',&lt;br /&gt;
 '/usr/lib/python3.5',&lt;br /&gt;
 '/usr/lib/python3.5/site-packages',&lt;br /&gt;
 '/usr/lib/python3.5/site-packages/IPython/extensions']&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now it’s a matter of adding this path to Pythons system path:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
PYDEV_SOURCE_DIR = &amp;quot;/usr/lib/eclipse/dropins/pydev/eclipse/plugins/org.python.pydev_4.5.4.201601292234/pysrc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
import sys&lt;br /&gt;
&lt;br /&gt;
if PYDEV_SOURCE_DIR not in sys.path:&lt;br /&gt;
   sys.path.append(PYDEV_SOURCE_DIR)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the system knows what to do when it gets this request:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
import pydevd&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will scan &amp;lt;tt&amp;gt;sys.path&amp;lt;/tt&amp;gt; for &amp;lt;tt&amp;gt;pydevd&amp;lt;/tt&amp;gt; in the &amp;lt;tt&amp;gt;PYDEV_SOURCE_DIR&amp;lt;/tt&amp;gt; and then import it.&lt;br /&gt;
&lt;br /&gt;
Now when the script calls:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
pydevd.settrace()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it will use &amp;lt;tt&amp;gt;pydevd&amp;lt;/tt&amp;gt; to use the magic of the loopback interface and send and receive the messages to and from Eclipse to do its magic.&lt;br /&gt;
&lt;br /&gt;
Thanks to sc3sc3 on [http://blenderartists.org/forum/showthread.php?308260-Eclipse-for-debugging-python-in-Blender&amp;amp;highlight= this thread] at Blenderartists for his assistance.&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
*To break for the first time, you will need to call &amp;lt;tt&amp;gt;pydevd.settrace()&amp;lt;/tt&amp;gt;, after this you can set breakpoints inside Eclipse,&amp;lt;br&amp;gt;however on each execution from Blender, &amp;lt;tt&amp;gt;pydevd.settrace()&amp;lt;/tt&amp;gt; is needed as an entry point to connect to the debugger.&lt;br /&gt;
*Make sure the PyDev remote debugger is started before firing up Blender&lt;br /&gt;
*Automatic updates of PyDev creates a new folder for the PyDev python code among other things, so you will have to update your &amp;lt;tt&amp;gt;PYDEV_SOURCE_DIR&amp;lt;/tt&amp;gt; path in your script&lt;br /&gt;
&lt;br /&gt;
For more advanced debugging techniques and in-depth information on the Blender/Python/Eclipse trinity read Witold Jaworski’s [http://www.blendernation.com/2011/08/24/free-e-book-programming-add-ons-for-blender-2-5/ excellent and free e-book].&lt;/div&gt;</summary>
		<author><name>wiki&gt;Ideasman42</name></author>
		
	</entry>
</feed>