Note that there are some explanatory texts on larger screens.

plurals
  1. POPython pdb debugger gets confused when Python method called after a tree_but_open event defined in XML
    primarykey
    data
    text
    <p>I am in the process of debugging something in OpenERP using Python 2.7.3. The debugger seems to get out of sync with the code when stepping through with the Next (n) command. When you type a debugger command such as print variable, it may give a different answer each time you do this. It also appears to skip backwards when stepping through the code. See Code and output below. </p> <p>I believe the problem may be related to the way OpenERP calls my method through a Python exec() statement by reading the code field in the OpenERP XML below. Is possible that calling Python code constructed dynamically and called via exec() is confusing the pdb debugger? When I call the function from a Button rather than a a tree_but_open event the debugger steps through the code fine.</p> <p>If this is the case is there a work around?</p> <p>CODE is called via this OpenERP action below:</p> <pre><code>&lt;record id="action_wash_st_method1" model="ir.actions.server"&gt; &lt;field name="type"&gt;ir.actions.server&lt;/field&gt; &lt;field name="condition"&gt;True&lt;/field&gt; &lt;field name="state"&gt;code&lt;/field&gt; &lt;field name="model_id" ref="model_view_tree_display_address_list"/&gt; &lt;field eval="5" name="sequence"/&gt; &lt;field name="code"&gt; action = self.view_calc_sales_tax(cr, uid, context) &lt;/field&gt; &lt;field name="name"&gt;wash state action request&lt;/field&gt; &lt;/record&gt; &lt;record model="ir.values" id="action_wash_st_tax_trigger_method1" &gt; &lt;field name="key2" eval="'tree_but_open'" /&gt; &lt;field name="model" eval="'view.tree.display.address.list'" /&gt; &lt;field name="name"&gt;Method1 Wash State&lt;/field&gt; &lt;field name="value" eval="'ir.actions.server,%d'%action_wash_st_method1"/&gt; &lt;field name="object" eval="True" /&gt; &lt;/record&gt; </code></pre> <p>PDB/CODE OUTPUT (Notice that I have to type "ids" twice to get it to print the value):</p> <pre><code>-&gt; ctx["local_rate"] = res1["local_rate"] (Pdb) n &gt; /home/glenn2/openerp6.1/addons/6.1/wash_tax2/wash_tax.py(169)view_calc_sales_tax() -&gt; ctx["code"] = res1["code"] (Pdb) n &gt; /home/glenn2/openerp6.1/addons/6.1/wash_tax2/wash_tax.py(172)view_calc_sales_tax() -&gt; ids = [3333,4444,9999] (Pdb) n (Pdb) &gt; /home/glenn2/openerp6.1/addons/6.1/wash_tax2/wash_tax.py(173)view_calc_sales_tax() -&gt; self.pool.get('account.invoice').button_reset_taxes (cr,uid, ids, ctx) ids *** NameError: name 'ids' is not defined (Pdb) ids [3333, 4444, 9999] (Pdb) </code></pre> <p>Additional information:</p> <p>I think it has to do with the debugger having trouble with multiple threads. The problem starts happening after calls to __bootstrap_inner() in Pythons threading library. Does anyone know if it is possible to enable the Python debugger for multiple threads:</p> <pre><code>(Pdb) &gt; /home/glenn2/usr/local/lib/python2.7/threading.py(526)__bootstrap() -&gt; self.__bootstrap_inner() &gt;(Pdb) /home/glenn2/usr/local/lib/python2.7/threading.py(526)__bootstrap()-&gt;None -&gt; self.__bootstrap_inner() self (Pdb) &lt;Thread(Thread-35, initial)&gt; self &lt;Thread(Thread-34, stopped 47994097374976)&gt; (Pdb) self (Pdb) &lt;Thread(Thread-34, stopped 47994097374976)&gt; self (Pdb) &lt;Thread(Thread-35, initial)&gt; self (Pdb) &lt;Thread(Thread-34, stopped 47994097374976)&gt; self (Pdb) &lt;Thread(Thread-35, initial)&gt; self (Pdb) &lt;Thread(Thread-34, stopped 47994097374976)&gt; self &lt;Thread(Thread-35, initial)&gt; (Pdb) self (Pdb) &lt;Thread(Thread-34, stopped 47994097374976)&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload