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

Mysterious TypeError: TypeError('cannot use a string pattern on a bytes-like object') #61

Closed
eoyilmaz opened this issue Mar 22, 2022 · 3 comments · Fixed by #330
Closed
Assignees

Comments

@eoyilmaz
Copy link
Owner

We have mysterious TypeError messages without a traceback output.

TypeError: TypeError('cannot use a string pattern on a bytes-like object')
TypeError: TypeError('cannot use a string pattern on a bytes-like object')
TypeError: TypeError('cannot use a string pattern on a bytes-like object')
TypeError: TypeError('cannot use a string pattern on a bytes-like object')
TypeError: TypeError('cannot use a string pattern on a bytes-like object')

It is obviously thrown by the re module. But I can't seem to be able to find the source. Throughout the code there are a ton of places a regular expression is written, and some of them doesn't have the r"" notation, so it is very hard to find them.

One option is to wrap the displaycal around a try..except block and use traceback.print_exc().

@eoyilmaz
Copy link
Owner Author

eoyilmaz commented May 28, 2022

I still get them, right after a successful profiling session and before installing the profile, around where the profile information is displayed.

@eoyilmaz
Copy link
Owner Author

Finally we busted this issue...

@eoyilmaz eoyilmaz linked a pull request Mar 19, 2024 that will close this issue
eoyilmaz added a commit that referenced this issue Mar 19, 2024
…orcannot-use-a-string-pattern-on-a-bytes-like-object

- Fix for #61
@ethanbrookins
Copy link

Nice work, @eoyilmaz! I just ran a couple tests and confirmed that the 5x mysterious TypeErrors are gone. However, I got this new one after a local display profile. Not sure if this is a new issue or just visible now that you turned on traceback.

Found display device matching model description at index #0
/Users/ethan/Library/Application Support/DisplayCAL/storage/LG UltraFine #1 2024-03-18 17-22 2.2 F-S 1xCurve+MTX 34/LG UltraFine 22MD4KA-B 3.3nm.ccmx matches /Users/ethan/Library/Application Support/ArgyllCMS/LG UltraFine 22MD4KA-B 3.3nm.ccmx - using the latter
Traceback (most recent call last):
  File "/Users/ethan/Desktop/test-develop/displaycal-py3/DisplayCAL/display_cal.py", line 11204, in profile_finish
    gamut_coverage = float(
                     ^^^^^^
TypeError: float() argument must be a string or a real number, not 'NoneType'
Loading calibration curves from file...
/Users/ethan/Library/Application Support/DisplayCAL/storage/LG UltraFine #1 2024-03-18 17-22 2.2 F-S 1xCurve+MTX 34/LG UltraFine #1 2024-03-18 17-22 2.2 F-S 1xCurve+MTX 34.icc
...ok.

It throws this similar one when I click Load Profile Information:

Traceback (most recent call last):
  File "/Users/ethan/Desktop/test-develop/displaycal-py3/DisplayCAL/wxProfileInfo.py", line 1462, in LoadProfile
    gamut_coverage = float(
                     ^^^^^^
TypeError: float() argument must be a string or a real number, not 'NoneType'

I did not get either of these with a Resolve profile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants