Skip to content

Conversation

@haroondilshad
Copy link
Contributor

Fix: f-string backslash expression errors in multiple files

Issue Description

Found instances of f-string expressions containing backslashes which causes the error:
❌ An error occurred: f-string expression part cannot include a backslash (delete_cursor_google.py, line 243)

This error occurs because Python's f-strings don't allow backslashes in their expressions, which was causing issues in three files:

  1. delete_cursor_google.py (line 243)
  2. cursor_register_manual.py (line 81)
  3. oauth_auth.py (line 178)

Changes Made

1. In delete_cursor_google.py:

  • Fixed JavaScript template string in f-string by using raw string (r-string)
  • Changed:
    self.browser.run_js(f"""...""")
    to:
    self.browser.run_js(r"""...""")

2. In cursor_register_manual.py:

  • Fixed newline in f-string by splitting string concatenation
  • Changed:
    print(f"...{self.email_address}\n{Style.RESET_ALL}")
    to:
    print(f"...{self.email_address}" + "\n" + f"{Style.RESET_ALL}")

3. In oauth_auth.py:

  • Restructured error message construction to avoid backslashes in f-strings
  • Improved readability by using string concatenation and proper formatting

Testing

  • All modifications maintain the original functionality
  • The error messages and formatting remain identical to the original
  • No changes to the logic or behavior of the code

Impact

These changes:

  • Fix the f-string syntax errors
  • Improve code reliability
  • Maintain compatibility with all Python versions
  • Make the code more maintainable

Additional Notes

  • No dependencies were modified
  • No configuration changes required
  • Fully backward compatible

@yeongpin yeongpin merged commit 1cdb543 into yeongpin:main Apr 14, 2025
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 this pull request may close these issues.

2 participants