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.

3
  • What is the usecase? I mean what you are trying to achieve here? Commented Jan 30, 2014 at 9:03
  • 1
    Curiosity. Plus it could be beneficial for the community. Commented Jan 30, 2014 at 9:04
  • It's not a file in memory, it's a memory address (whatever there may be). See stackoverflow.com/questions/8250625/… Commented Jan 30, 2014 at 9:04

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.