Script module.py raises ValueError in line 178

Open
#94 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
cli

Research direction

Reproduce the failure with sherlock --output output.xml ., then read sherlock/core.py and sherlock/model.py, especially Tree.from_directory and set_dict at line 178. Check how the Robot Framework repository is traversed and how values containing = are handled; done means the command completes without this ValueError and processes the repository output.

Written by the indexing model from the issue text.

Description

Typing command sherlock --output output.xml . in my local repository causes occurance of such a fault:
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 193, in run_module_as_main
"main", mod_spec)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users\suchanek\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts\sherlock.e
xe_main
.py", line 7, in
File "C:\Users\suchanek\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sher
lock_init
.py", line 19, in run_cli
raise err
File "C:\Users\suchanek\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sher
lock_init_.py", line 9, in run_cli
runner.run()
File "C:\Users\suchanek\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sher
lock\core.py", line 31, in run
tree = self.map_resources_for_path(root)
File "C:\Users\suchanek\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sher
lock\core.py", line 58, in map_resources_for_path
tree = Tree.from_directory(path=root, gitignore=self.config.default_gitignore)
File "C:\Users\suchanek\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sher
lock\model.py", line 346, in from_directory
child_tree = cls.from_directory(path=child, gitignore=gitignore)
File "C:\Users\suchanek\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sher
lock\model.py", line 346, in from_directory
child_tree = cls.from_directory(path=child, gitignore=gitignore)
File "C:\Users\suchanek\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sher
lock\model.py", line 346, in from_directory
child_tree = cls.from_directory(path=child, gitignore=gitignore)
[Previous line repeated 5 more times]
File "C:\Users\suchanek\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sher
lock\model.py", line 359, in from_directory
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\ast.py", line 279, in generic_visit
self.visit(item)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\ast.py", line 271, in visit
return visitor(node)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\ast.py", line 279, in generic_visit
self.visit(item)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\ast.py", line 271, in visit
return visitor(node)
File "C:\Users\suchanek\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sher
lock\model.py", line 172, in visit_Variable
self.variables[node.name] = self.set_dict(node.value)
File "C:\Users\suchanek\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sher
lock\model.py", line 178, in set_dict
key, val = value.split("=") if "=" in value else (value, "")
ValueError: too many values to unpack (expected 2)

My output.xml file has been loaded properly and sherlock gave me two logs:
Sherlock analysis of Robot Framework code:

Using C:\Users\suchanek\robotlte as source repository
Loaded C:\Users\suchanek\robotlte\output.xml output file

My output.xml file looks like that:

Dominant language
Python
Stars
14
Forks
1
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from MarketSquare/robotframework-sherlock

All issues in MarketSquare/robotframework-sherlock

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.