Code Monkey home page Code Monkey logo

Comments (7)

thilp avatar thilp commented on June 26, 2024

Hi @mjohnson767, thank you for reporting the problem!

This might be related to running on Windows, as I can't seem to be able to reproduce the problem on Linux:

$ curl -LO https://github.com/zalando-incubator/transformer/files/4372250/ppmi_v2.zip
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   576  100   576    0     0   3490      0 --:--:-- --:--:-- --:--:--  3490
100 2155k  100 2155k    0     0   840k      0  0:00:02  0:00:02 --:--:-- 1113k

$ unzip ppmi_v2.zip
Archive:  ppmi_v2.zip
  inflating: ppmi_v2.har

$ pipx run --spec har-transformer transformer --version
1.2.6

$ pipx run --spec har-transformer transformer ppmi_v2.har >test.py
2020-03-24 14:08:27,804 INFO    No ppmi_v2.weight provided for ppmi_v2.har: assigning default weight 1 ([Errno 2] No such file or directory: 'ppmi_v2.weight')

$ head test.py
# File automatically generated by Transformer v1.2.6:
# https://github.com/zalando-incubator/Transformer
import re
from locust import HttpLocust
from locust import TaskSequence
from locust import TaskSet
from locust import seq_task
from locust import task
class ppmi_v2_har_829294038(TaskSequence):
    @seq_task(1)

Here is the full test.py that was produced: test.py.zip.

I'll try again on Windows as soon as I can, but I don't have a development environment there, so that might take some time. If you have any more clues, I'll gladly hear about them!

Have a nice day!

from transformer.

mchapko avatar mchapko commented on June 26, 2024

hi, Same here, har file was stored on windows with google chrome.
With running "transformer file.har > file.py" i see an error with decoding.
Traceback (most recent call last):
File "[MASKED]\lib\site-packages\transformer\scenario.py", line 316, in from_har_file
har = json.load(file)
File "[MASKED]\python39\lib\json_init_.py", line 293, in load
return loads(fp.read(),
File "[MASKED]\python39\lib\encodings\cp1250.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 251566: character maps to

from transformer.

mchapko avatar mchapko commented on June 26, 2024

as workaround i have modified locally:
In:
@classmethod
def from_har_file
...
try:
with path.open(encoding="utf8") as file:

And file was generated properly

from transformer.

mjohnson767 avatar mjohnson767 commented on June 26, 2024

I've installed har-transformer via pip; is the change needed in the actual har-transformer.har file?
Can you provide the steps to fix?
Great find.

from transformer.

mchapko avatar mchapko commented on June 26, 2024

Hi @mjohnson767, actually you need to do modification in your package installed in python directory.
[your python directory] \lib\site-packages\transformer\scenario.py
Find mentioned file and modify the file line as mentioned above. Nothing more is needed.
Then try to run transformer.
This is workaround only to point where is the issue.
Fix is needed from transformer team as requires some more coding to be bulletproof :)

from transformer.

thilp avatar thilp commented on June 26, 2024

I believe this should be addressed by #79, i.e. v2.0.0. Please let me know if that is not the case. 🙂

from transformer.

parohanoid avatar parohanoid commented on June 26, 2024

Hi @thilp

Getting this error for fiddler generated .har files:
WARNING while searching for HAR files, skipping {file_name}: Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0)

Thanks to the comments I was able to fix it locally by changing
encoding="utf-8" to encoding="utf-8-sig"

inside

def from_har_file
...
try:
with path.open(encoding="utf-8-sig") as file:

This is just an FYI in case others want to fix it

Awesome tool btw!

from transformer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.