GithubHelp home page GithubHelp logo

Comments (8)

sirredbeard avatar sirredbeard commented on May 25, 2024

My first thought was to encode those party strings at UTF:

name = em.string_get(x, 38, 33).strip().encode('utf-8')
        name = " ".join(name.split()).encode('utf-8')

But that generated this:

Traceback (most recent call last):
  File "main.py", line 7, in <module>
    import get_cases
  File "/mnt/c/Users/Hayden/OneDrive/Documents/GitHub/DAP/get_cases.py", line 110, in <module>
    main()
  File "/mnt/c/Users/Hayden/OneDrive/Documents/GitHub/DAP/get_cases.py", line 107, in main
    get_municipal_court()
  File "/mnt/c/Users/Hayden/OneDrive/Documents/GitHub/DAP/get_cases.py", line 97, in get_municipal_court
    each_court(court_name)
  File "/mnt/c/Users/Hayden/OneDrive/Documents/GitHub/DAP/get_cases.py", line 66, in each_court
    last_successful_case_number)  # scan, giving back last known successfully accessed case number
  File "/mnt/c/Users/Hayden/OneDrive/Documents/GitHub/DAP/get_cases.py", line 36, in scan
    year, judge_name, date_filed, time_filed, plaintiff_name, plaintiff_counsel, defendant_name, defendant_counsel, civil_action, action_description = mainframe_parse_case()  # pull the data from mainframe
  File "/mnt/c/Users/Hayden/OneDrive/Documents/GitHub/DAP/mainframe.py", line 111, in mainframe_parse_case
    name = " ".join(name.split()).encode('utf-8')
TypeError: sequence item 0: expected str instance, bytes found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 12, in <module>
    dap_log_general(LogLevel.CRITICAL, "exception encountered [%i]: %s" % (e.errno, e.strerror))
NameError: name 'LogLevel' is not defined

from dap.

sirredbeard avatar sirredbeard commented on May 25, 2024

MC6939 is the case in question.

from dap.

sirredbeard avatar sirredbeard commented on May 25, 2024

Occurred on MC4941 too:

GENERAL: getting municipal court cases
DATABASE: getting latest case number
GENERAL: scan for cases
MAINFRAME: connecting to mainframe
COMPLIANCE: mainframe connection established
MAINFRAME: selecting mainframe application
MAINFRAME: logging into mainframe
MAINFRAME: sending username
MAINFRAME: sending password
MAINFRAME: checking if user already logged in
MAINFRAME: login successful
MAINFRAME: selecting CATS function
MAINFRAME: opening docket search page
MAINFRAME: searching mainframe for case: MC6941
MAINFRAME: checking to see if case exists
MAINFRAME: case found
MAINFRAME: parsing first page of case file
MAINFRAME: navigating additional pages of case file
MAINFRAME: getting party names
Traceback (most recent call last):
  File "main.py", line 7, in <module>
    import get_cases
  File "/mnt/c/Users/Hayden/OneDrive/Documents/GitHub/DAP/get_cases.py", line 110, in <module>
    main()
  File "/mnt/c/Users/Hayden/OneDrive/Documents/GitHub/DAP/get_cases.py", line 107, in main
    get_municipal_court()
  File "/mnt/c/Users/Hayden/OneDrive/Documents/GitHub/DAP/get_cases.py", line 97, in get_municipal_court
    each_court(court_name)
  File "/mnt/c/Users/Hayden/OneDrive/Documents/GitHub/DAP/get_cases.py", line 66, in each_court
    last_successful_case_number)  # scan, giving back last known successfully accessed case number
  File "/mnt/c/Users/Hayden/OneDrive/Documents/GitHub/DAP/get_cases.py", line 36, in scan
    year, judge_name, date_filed, time_filed, plaintiff_name, plaintiff_counsel, defendant_name, defendant_counsel, civil_action, action_description = mainframe_parse_case()  # pull the data from mainframe
  File "/mnt/c/Users/Hayden/OneDrive/Documents/GitHub/DAP/mainframe.py", line 110, in mainframe_parse_case
    name = em.string_get(x, 38, 33).strip()
  File "/home/hayden/.local/lib/python3.7/site-packages/py3270/__init__.py", line 455, in string_get
    return cmd.data[0].decode("ascii")
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 32: ordinal not in range(128)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 12, in <module>
    dap_log_general(LogLevel.CRITICAL, "exception encountered [%i]: %s" % (e.errno, e.strerror))
NameError: name 'LogLevel' is not defined

from dap.

sirredbeard avatar sirredbeard commented on May 25, 2024

Screenshots of those pages in MC:

Annotation 2019-08-19 160824
Annotation 2019-08-19 160942

from dap.

sirredbeard avatar sirredbeard commented on May 25, 2024
MAINFRAME: searching mainframe for case: MC6941
MAINFRAME: checking to see if case exists
MAINFRAME: case found
MAINFRAME: parsing first page of case file
MAINFRAME: navigating additional pages of case file
MAINFRAME: getting party names
Traceback (most recent call last):
  File "main.py", line 7, in <module>
    import get_cases
  File "/mnt/c/Users/Hayden/OneDrive/Documents/GitHub/DAP/get_cases.py", line 110, in <module>
    main()
  File "/mnt/c/Users/Hayden/OneDrive/Documents/GitHub/DAP/get_cases.py", line 107, in main
    get_municipal_court()
  File "/mnt/c/Users/Hayden/OneDrive/Documents/GitHub/DAP/get_cases.py", line 97, in get_municipal_court
    each_court(court_name)
  File "/mnt/c/Users/Hayden/OneDrive/Documents/GitHub/DAP/get_cases.py", line 66, in each_court
    last_successful_case_number)  # scan, giving back last known successfully accessed case number
  File "/mnt/c/Users/Hayden/OneDrive/Documents/GitHub/DAP/get_cases.py", line 36, in scan
    year, judge_name, date_filed, time_filed, plaintiff_name, plaintiff_counsel, defendant_name, defendant_counsel, civil_action, action_description = mainframe_parse_case()  # pull the data from mainframe
  File "/mnt/c/Users/Hayden/OneDrive/Documents/GitHub/DAP/mainframe.py", line 110, in mainframe_parse_case
    name = em.string_get(x, 38, 33).strip()
  File "/home/hayden/.local/lib/python3.7/site-packages/py3270/__init__.py", line 455, in string_get
    return cmd.data[0].decode("ascii")
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 32: ordinal not in range(128)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 12, in <module>
    dap_log_general(LogLevel.CRITICAL, "exception encountered [%i]: %s" % (e.errno, e.strerror))
NameError: name 'LogLevel' is not defined

from dap.

sirredbeard avatar sirredbeard commented on May 25, 2024

Something about these cases:

MC6939
MC6941
MC6946
MC6949
MC6950

Look at that non-standard character in MC6950 and MC6946 like MC6939:

Annotation 2019-08-20 190813

Annotation 2019-08-20 190931

from dap.

 avatar commented on May 25, 2024

what if we change the order of get_string().strip().encode('utf-8') to get_string().encode('utf-8').strip() ?

from dap.

sirredbeard avatar sirredbeard commented on May 25, 2024

I tried a few things, nothing seemed to work, not sure if I tried this. I wondered at the time if the py3270 library had an issue with non-ascii strings.

from dap.

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.