2

This is the error/traceback I'm actually getting:

Traceback (most recent call last):
  File "/home/apache/tactic/src/tactic/ui/panel/custom_layout_wdg.py", line 619, in process_mako
    html = template.render(server=my.server, search=Search, sobject=sobject, sobjects=my.sobject_dicts, data=my.data, plugin=plugin, kwargs=my.kwargs)
  File "/home/apache/tactic/src/mako/template.py", line 189, in render
    return runtime._render(self, self.callable_, args, data)
  File "/home/apache/tactic/src/mako/runtime.py", line 403, in _render
    _render_context(template, callable_, context, *args, **_kwargs_for_callable(callable_, data))
  File "/home/apache/tactic/src/mako/runtime.py", line 434, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/home/apache/tactic/src/mako/runtime.py", line 457, in _exec_template
    callable_(context, *args, **kwargs)
  File "memory:0x7f2ea8589810", line 19, in render_body
    ${gl.get_gantt('vfx')}
  File "/home/apache/gantt_logic.py", line 34, in get_gantt
    prepend.add_style("width: %spx" %(total_width/days * (start_date - process[1]["start"]).days))
ZeroDivisionError: integer division or modulo by zero

I'm not asking how to fix the ZeroDivisionError error. That's trivial.

What I'm curious to know is that how can I read through files that are in Python memory? In this case memory:0x7f2ea8589810.

Bleeding Fingers
  • 6,993
  • 7
  • 46
  • 74

1 Answers1

1

I do not now of your case but import linecache is the module you would ask if you need lines of a file.

I also think traceback uses linecache for this line:

${gl.get_gantt('vfx')}

So I think developers that want their generated code to be read should create linecache support.

try:

import linecache
print(linecache.getlines("memory:0x7f2ea8589810"))

or something like this.

User
  • 14,131
  • 2
  • 40
  • 59