Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not convert HAR using library #75

Open
naveenmandepudi opened this issue May 27, 2021 · 1 comment · May be fixed by #77
Open

Could not convert HAR using library #75

naveenmandepudi opened this issue May 27, 2021 · 1 comment · May be fixed by #77
Labels
bug Something isn't working

Comments

@naveenmandepudi
Copy link

Describe the bug

I have placed HAR in examples folder of transformer folder.
Created py file with below:
`import transformer.transform as entry

with open("locustfile.py", "w") as f:
entry.dump(f, "[./examples/1.har]")`
and ran transformer library, below is the exception:
➜ transformer git:(master) ✗ python3.9 NaveenTest.py
Traceback (most recent call last):
File "/Users/nmandepudi/transformer/NaveenTest.py", line 4, in
transformer.dump(f, ["./examples/1.har"])
File "/Users/nmandepudi/transformer/transformer/transform.py", line 91, in dump
file.writelines(
File "/Users/nmandepudi/transformer/transformer/transform.py", line 135, in intersperse
yield next(it)
File "/Users/nmandepudi/transformer/transformer/transform.py", line 106, in _dump_as_lines
scenarios = [
File "/Users/nmandepudi/transformer/transformer/transform.py", line 107, in
Scenario.from_path(
File "/Users/nmandepudi/transformer/transformer/scenario.py", line 155, in from_path
if path.is_dir():
AttributeError: 'str' object has no attribute 'is_dir'

Transformer version
Output of the command transformer --version.
1.3.0
To Reproduce
Steps and input files to reproduce the behavior:

  1. Create the file "..."
    create py file with below:
    import transformer.transform as entry

with open("locustfile.py", "w") as f:
entry.dump(f, "[./examples/1.har]")

  1. Run Transformer with the arguments "..."
    python3.9 <>
  2. See error

Expected behavior
A clear and concise description of what you expected to happen.
HAR should be converted py file.

Screenshots
output on running the above py file:

➜ transformer git:(master) ✗ python3.9 NaveenTest.py
Traceback (most recent call last):
File "/Users/nmandepudi/transformer/NaveenTest.py", line 4, in
transformer.dump(f, ["./examples/1.har"])
File "/Users/nmandepudi/transformer/transformer/transform.py", line 91, in dump
file.writelines(
File "/Users/nmandepudi/transformer/transformer/transform.py", line 135, in intersperse
yield next(it)
File "/Users/nmandepudi/transformer/transformer/transform.py", line 106, in _dump_as_lines
scenarios = [
File "/Users/nmandepudi/transformer/transformer/transform.py", line 107, in
Scenario.from_path(
File "/Users/nmandepudi/transformer/transformer/scenario.py", line 155, in from_path
if path.is_dir():
AttributeError: 'str' object has no attribute 'is_dir'

If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. Fedora, MacOS] MacOS
  • Version: [e.g. 22]

Additional context
Add any other context about the problem here.

@naveenmandepudi naveenmandepudi added the bug Something isn't working label May 27, 2021
@divinp
Copy link

divinp commented Jul 14, 2021

Even I'm facing the same issue, can anyone let us know how to fix this issue?

thilp added a commit that referenced this issue Oct 20, 2021
Top-level functions accept LaxPath instances, which are unions of Path
and str. However, Scenario.from_path expects only a Path (not a str) and
is called by _dump_as_lines (which uses LaxPath) without first
converting potential strings to Path.

Reported in #75.

Signed-off-by: Thibaut Le Page <thilp@thilp.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants