question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Didn't aware of string.join and os.path.join

See original GitHub issue

$ python3 examples/build_cfg.py /home/user/code-coba-home/manual-compile/staticfg/foo.py /home/user/code-coba-home/manual-compile/staticfg/
Traceback (most recent call last):
  File "examples/build_cfg.py", line 15, in <module>
    cfg = CFGBuilder().build_from_file(cfg_name, args.input_file)
  File "/home/user/.virtualenvs/global_py3/lib/python3.5/site-packages/staticfg/builder.py", line 124, in build_from_file
    return self.build_from_src(name, src)
  File "/home/user/.virtualenvs/global_py3/lib/python3.5/site-packages/staticfg/builder.py", line 108, in build_from_src
    return self.build(name, tree)
  File "/home/user/.virtualenvs/global_py3/lib/python3.5/site-packages/staticfg/builder.py", line 92, in build
    self.visit(tree)
  File "/usr/lib/python3.5/ast.py", line 245, in visit
    return visitor(node)
  File "/usr/lib/python3.5/ast.py", line 253, in generic_visit
    self.visit(item)
  File "/usr/lib/python3.5/ast.py", line 245, in visit
    return visitor(node)
  File "/home/user/.virtualenvs/global_py3/lib/python3.5/site-packages/staticfg/builder.py", line 384, in visit_FunctionDef
    self.new_functionCFG(node, asynchr=False)
  File "/home/user/.virtualenvs/global_py3/lib/python3.5/site-packages/staticfg/builder.py", line 201, in new_functionCFG
    self.current_id)
  File "/home/user/.virtualenvs/global_py3/lib/python3.5/site-packages/staticfg/builder.py", line 92, in build
    self.visit(tree)
  File "/usr/lib/python3.5/ast.py", line 245, in visit
    return visitor(node)
  File "/usr/lib/python3.5/ast.py", line 253, in generic_visit
    self.visit(item)
  File "/usr/lib/python3.5/ast.py", line 245, in visit
    return visitor(node)
  File "/home/user/.virtualenvs/global_py3/lib/python3.5/site-packages/staticfg/builder.py", line 310, in visit_If
    self.visit(child)
  File "/usr/lib/python3.5/ast.py", line 245, in visit
    return visitor(node)
  File "/home/user/.virtualenvs/global_py3/lib/python3.5/site-packages/staticfg/builder.py", line 264, in visit_Assign
    self.generic_visit(node)
  File "/usr/lib/python3.5/ast.py", line 255, in generic_visit
    self.visit(value)
  File "/usr/lib/python3.5/ast.py", line 245, in visit
    return visitor(node)
  File "/home/user/.virtualenvs/global_py3/lib/python3.5/site-packages/staticfg/builder.py", line 259, in visit_Call
    func_name = visit_func(func)
  File "/home/user/.virtualenvs/global_py3/lib/python3.5/site-packages/staticfg/builder.py", line 255, in visit_func
    func_name += "." + node.attr
TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
JJK96commented, Jun 19, 2019

Thanks @azzamsa I found the origin of my problem, I reported in #8

1reaction
azzamsacommented, Jun 19, 2019

@azzamsa I have a similar issue but I don’t use join, how did you debug this?

@JJK96 Since I just have a small code. I tried to compile them incrementally, till I find the error. (not effective for a big chunk of code)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why doesn't os.path.join() work in this case? - Stack Overflow
On Windows, the drive letter is not reset when an absolute path component (e.g., r'\foo' ) is encountered. If a component contains a...
Read more >
os.path — Common pathname manipulations — Python 3.11 ...
In all cases, join(head, tail) returns a path to the same location as path (but the strings may differ). Also see the functions...
Read more >
Python 3's pathlib Module: Taming the File System
For instance, instead of joining two paths with + like regular strings, you should use os.path.join() , which joins paths using the correct...
Read more >
Python Files and os.path - 2021 - BogoToBogo
The os.path.join() function constructs a pathname out of one or more partial pathnames. In this case, it simply concatenates strings.
Read more >
I am looking for a library of built in functions for ... - Codecademy
I can't find .join function on http://docs.python.org/ ... what you wanted was str.join, not string.join.. wasn't even aware they both existed until now...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found