You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running l2t_scaffolder.py to create the setup for a new timesketch analyzer the tool crashes because it cannot find the .style.ts.yap style file.
It looks like installing l2tscaffolder via pip3 install l2tscaffolder does not place the .style.ts.yap file in the expected place ~/.local/lib/python3.9/site-packages/l2tscaffolder/.style.ts.yapf. After copying the file there manually from github, it works without issues.
To Reproduce
Steps to reproduce the behavior:
Make a fresh install via pip3 install l2tscaffolder
Run via l2t_scaffolder.py
Select [1] timesketch, provide . as path, select [1] sketch_analyzer
Error output:
$ cd ~/timesketch
$ l2t_scaffolder.py
== Starting the scaffolder ==
Gathering required information.
Available definitions:
[0] plaso
[1] timesketch
[2] turbinia
Definition choice: 1
timesketch chosen.
Path to the project root: .
Path [.] set as the project path.
Name of the module to be generated. This can be something like "foobar sqlite" or "event analytics".
This will be used for class name generation and file name prefixes.
Module Name: screenshot_test
About to create a new feature branch to store newly generated code.
Switching to feature branch screenshot_test
Available scaffolders for timesketch:
[0] index_analyzer
[1] sketch_analyzer
Scaffolder choice: 1
Ready to generate files? [Y/n]:
Traceback (most recent call last):
File "~/.local/bin/l2t_scaffolder.py", line 26, in <module>
StartCLI() # pylint: disable=no-value-for-parameter
File "~/.local/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "~/.local/lib/python3.9/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "~/.local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "~/.local/lib/python3.9/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "~/.local/bin/l2t_scaffolder.py", line 22, in StartCLI
cli.Start(definition)
File "~/.local/lib/python3.9/site-packages/l2tscaffolder/frontend/frontend.py", line 375, in Start
for file_path in scaffolder_engine.GenerateFiles():
File "~/.local/lib/python3.9/site-packages/l2tscaffolder/lib/engine.py", line 74, in GenerateFiles
for file_path, content in self._scaffolder.GenerateFiles():
File "~/.local/lib/python3.9/site-packages/l2tscaffolder/scaffolders/timesketch.py", line 103, in GenerateFiles
plugin_content = self._GeneratePlugin()
File "~/.local/lib/python3.9/site-packages/l2tscaffolder/scaffolders/timesketch.py", line 54, in _GeneratePlugin
return self._mapping_helper.RenderTemplate(
File "~/.local/lib/python3.9/site-packages/l2tscaffolder/lib/mapping_helper.py", line 124, in RenderTemplate
formatted = self.formatter.Format(template)[0]
File "~/.local/lib/python3.9/site-packages/l2tscaffolder/lib/code_formatter.py", line 28, in Format
return yapf_api.FormatCode(code, style_config=self.yapf_path)
File "~/.local/lib/python3.9/site-packages/yapf/yapflib/yapf_api.py", line 124, in FormatCode
style.SetGlobalStyle(style.CreateStyleFromConfig(style_config))
File "~/.local/lib/python3.9/site-packages/yapf/yapflib/style.py", line 498, in CreateStyleFromConfig
config = _CreateConfigParserFromConfigFile(style_config)
File "~/.local/lib/python3.9/site-packages/yapf/yapflib/style.py", line 527, in _CreateConfigParserFromConfigFile
raise StyleConfigError(
yapf.yapflib.style.StyleConfigError: "~/.local/lib/python3.9/site-packages/l2tscaffolder/.style.ts.yapf" is not a valid style or file path
Expected behavior
Instead of crashing I would expect l2tscaffolder to create the required files. Expected output:
[...]
Ready to generate files? [Y/n]:
File: ./timesketch/lib/analyzers/screenshot_test_2.py written to disk.
File: ./timesketch/lib/analyzers/screenshot_test_2_test.py written to disk.
File: ./timesketch/lib/analyzers/__init__.py written to disk.
Desktop (please complete the following information):
OS: Debian
Version 5.17.6-1rodete1 (2022-05-12)
l2tscaffolder Version
$ pip3 list | grep l2tscaffolder
l2tscaffolder 20200511
The text was updated successfully, but these errors were encountered:
@studiawan you can try one of the following workarounds that worked for me to get l2tscaffolder running:
Just download and copy the missing file .style.ts.yapf into the location from the error message. E.g. ~/.local/lib/python3.9/site-packages/l2tscaffolder/.style.ts.yapf
Install l2tscaffolder from source as documented here.
Hi @jkppr, I have successfully installed l2tscaffolder from source. However, we do not need to add the missing .yapf file as it has been already provided in the repository.
Describe the bug
When running
l2t_scaffolder.py
to create the setup for a new timesketch analyzer the tool crashes because it cannot find the.style.ts.yap
style file.It looks like installing l2tscaffolder via
pip3 install l2tscaffolder
does not place the.style.ts.yap
file in the expected place~/.local/lib/python3.9/site-packages/l2tscaffolder/.style.ts.yapf
. After copying the file there manually from github, it works without issues.To Reproduce
Steps to reproduce the behavior:
pip3 install l2tscaffolder
l2t_scaffolder.py
[1] timesketch
, provide.
as path, select[1] sketch_analyzer
Expected behavior
Instead of crashing I would expect
l2tscaffolder
to create the required files. Expected output:Desktop (please complete the following information):
l2tscaffolder Version
The text was updated successfully, but these errors were encountered: