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

Getting error while running the HAR file using CLI #74

Closed
akshamat opened this issue Mar 8, 2021 · 6 comments · Fixed by #79
Closed

Getting error while running the HAR file using CLI #74

akshamat opened this issue Mar 8, 2021 · 6 comments · Fixed by #79
Labels
bug Something isn't working

Comments

@akshamat
Copy link

akshamat commented Mar 8, 2021

Describe the bug

I am getting below error so code is not able to convert into Locust python file
WARNING while searching for HAR files, skipping C:\HAR_File\demoblaze.com.har: 'charmap' codec can't decode byte 0x8d in position 219193: character maps to
2021-03-08 15:40:33,826 ERROR Please help us fix this error by reporting it! https://github.com/zalando-incubator/Transformer/issues

Transformer version
1.3.0

To Reproduce
Steps and input files to reproduce the behavior:

  1. https://www.demoblaze.com/
  2. Use Google Chrome to capture network traffic
  3. Export the har file
  4. I used following command transformer C:\HAR_File/ >locustfile.py on windows command prompt
  5. image

Expected behavior
It should create locustfile.py successfully without any errors

Screenshots
If applicable, add screenshots to help explain your problem.
image

Desktop (please complete the following information):

  • OS: Windows Command

Additional context
Add any other context about the problem here.

@akshamat akshamat added the bug Something isn't working label Mar 8, 2021
@thilp
Copy link
Member

thilp commented Mar 12, 2021

Hi, this looks like a duplicate of #72 (based on the first line of your error message, only partially visible in your screenshot). Unfortunately, this project currently doesn’t have the resources to support Windows as a first-class platform. Please try running Transformer inside Docker instead!

@thilp thilp closed this as completed Mar 12, 2021
@JustinRoll
Copy link

Hey all,
I had a similar issue, and found that if you just pre-process the file and re-encode it in python, you can get it to run.

_f1Text = open('har/login.har', encoding='utf-8').read()
newText = f1Text.encode('charmap', errors='ignore').decode('charmap')
newOut = open('har/login_new.har', 'w', encoding = 'charmap')
newOut.write(newText)

#now run transformer on your har directory_

It could be nice to just detect if you're on windows and use a different encoding by default though.

@maormagori
Copy link

Hi, this looks like a duplicate of #72 (based on the first line of your error message, only partially visible in your screenshot). Unfortunately, this project currently doesn’t have the resources to support Windows as a first-class platform. Please try running Transformer inside Docker instead!

It wasn't mentioned anywhere that Windows isn't supported.
This should be acknowledged somewhere in the README.

@bascr
Copy link

bascr commented Apr 28, 2022

I had the same issue and like @JustinRoll says the issue has to do with the file encoding. Modifying the line 315 in the scenario.py file like the image below I was able to get the resulting locust file:

image

It would be nice that the method 'dump' from the transformer class could receive the 'enconding' value as a parameter.

thilp added a commit that referenced this issue Apr 28, 2022
Fixes #74 for Windows users, where the platform-specific encoding seems
to be typically wrong.
@thilp
Copy link
Member

thilp commented Apr 28, 2022

Thank you for your help! I have pre-released v1.3.1 with the suggested change, and will make it official (and upload it to pypi) when I have gathered the necessary approval from Zalando.

@thilp
Copy link
Member

thilp commented Apr 29, 2022

I have released v2.0.0 (major version bump because I also renamed the "blacklist" keyword argument) and also uploaded it to PyPI. Please let me know if a similar problem still occurs. 🙂

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.

5 participants