Skip to content

threatq: fix py2-style artifacts resulting in SyntaxError - #45275

Merged
kamalq97 merged 1 commit into
demisto:contrib/Andrej730_fix-threatq-syntax-errorfrom
Andrej730:fix-threatq-syntax-error
Jul 29, 2026
Merged

threatq: fix py2-style artifacts resulting in SyntaxError#45275
kamalq97 merged 1 commit into
demisto:contrib/Andrej730_fix-threatq-syntax-errorfrom
Andrej730:fix-threatq-syntax-error

Conversation

@Andrej730

@Andrej730 Andrej730 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Contributing to Cortex XSOAR Content

Make sure to register your contribution by filling the contribution registration form

The Pull Request will be reviewed only after the contribution registration form is filled.

Status

  • In Progress
  • Ready
  • In Hold - (Reason for hold)

Description

This file is the only syntax error present in the repo, see below.

except Exception, e:
results = {'ContentsFormat': formats['markdown'], 'Type': entryTypes['note'], 'Contents': "No results from ThreatQ"}
return results

except Exception, e:
raise
return_error(e)

uv run --no-project --python 3.10 -m compileall . -q
# ** Error compiling './Packs/ThreatQ/Integrations/ThreatQ/ThreatQ.py'...
#  File "./Packs/ThreatQ/Integrations/ThreatQ/ThreatQ.py", line 106
#    except Exception, e:
#           ^^^^^^^^^^^^
# SyntaxError: multiple exception types must be parenthesized

except Exception, e: looked like either artifact from Python 2 (Python was using this syntax instead of except Exception as e) or just a typo. To fix the issue I've dropped unused e in one case and replaced with as e in another.

Must have

  • Tests
  • Documentation

relates: https://jira-dc.paloaltonetworks.com/browse/CIAC-17494

This file is the only syntax error present on the repo:

```sh
uv run --no-project --python 3.10 -m compileall . -q
# ** Error compiling './Packs/ThreatQ/Integrations/ThreatQ/ThreatQ.py'...
#  File "./Packs/ThreatQ/Integrations/ThreatQ/ThreatQ.py", line 106
#    except Exception, e:
#           ^^^^^^^^^^^^
# SyntaxError: multiple exception types must be parenthesized
```
Copilot AI review requested due to automatic review settings July 29, 2026 11:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes remaining Python 2-style exception syntax in the ThreatQ integration that causes SyntaxError under Python 3, allowing the file to compile cleanly in the Cortex Content repo.

Changes:

  • Replaced except Exception, e: with Python 3-compatible exception handlers.
  • Removed an unused exception binding in one handler and added as e where the exception object is referenced.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Packs/ThreatQ/Integrations/ThreatQ/ThreatQ.py
Comment thread Packs/ThreatQ/Integrations/ThreatQ/ThreatQ.py
@content-bot content-bot added Contribution Thank you! Contributions are always welcome! External PR Xsoar Support Level Indicates that the contribution is for XSOAR supported pack labels Jul 29, 2026
@content-bot
content-bot changed the base branch from master to contrib/Andrej730_fix-threatq-syntax-error July 29, 2026 11:35
@content-bot
content-bot requested a review from kamalq97 July 29, 2026 11:35
@content-bot

Copy link
Copy Markdown
Contributor

Thank you for your contribution. Your generosity and caring are unrivaled! Make sure to register your contribution by filling the Contribution Registration form, so our content wizard @kamalq97 will know the proposed changes are ready to be reviewed.
For your convenience, here is a link to the contributions SLAs document.

@content-bot

Copy link
Copy Markdown
Contributor

Hi @Andrej730, thanks for contributing to the XSOAR marketplace. To receive credit for your generous contribution please follow this link.

@content-bot

Copy link
Copy Markdown
Contributor

🤖 AI-Powered Code Review Available

Hi @kamalq97, you can leverage AI-powered code review to assist with this PR!

Available Commands:

  • @marketplace-ai-reviewer start review - Initiate a full AI code review
  • @marketplace-ai-reviewer re-review - Incremental review for new commits

@kamalq97
kamalq97 merged commit d44391a into demisto:contrib/Andrej730_fix-threatq-syntax-error Jul 29, 2026
101 of 114 checks passed
@github-actions

Copy link
Copy Markdown

Thank you for your contribution. Your external PR has been merged and the changes are now included in one or more internal PRs for further review.

Note

Contributions containing XSIAM content (Modeling Rules, Parsing Rules, Correlation Rules, or Dashboards) are subject to an additional review process and may take longer to be merged to master.

@Andrej730
Andrej730 deleted the fix-threatq-syntax-error branch July 29, 2026 19:00
ntBre pushed a commit to astral-sh/ruff that referenced this pull request Jul 29, 2026
## Summary

Reintroducing `demisto/content` back to `ruff-ecosystem`, it's a huge
repo with 4.5K py file and 2.5M loc, so may have catch some cases for
ecosystem report. It was previously commented out in
#12129 due to the use of removed
`E999`

Issue with the use of removed rules upstream is resolved, though
apparently `E999` was dropped from selection a while ago and new issue
with the use of removed `UP038` occurred, but it's resolved now too -
demisto/content#45227

Syntax error in still present in
https://github.com/demisto/content/blob/master/Packs/ThreatQ/Integrations/ThreatQ/ThreatQ.py,
so keeping `exclude`. Though apparently it doesn't break
`ruff-ecosystem` anymore, but keeping it safe for now. I've submitted a
fix upstream demisto/content#45275, so `exclude`
can be removed later too.


## Test Plan

Tested running `ruff-ecosystem` locally, no issues found.
kamalq97 added a commit that referenced this pull request Jul 30, 2026
* threatq: fix py2-style artifacts resulting in SyntaxError (#45275)

This file is the only syntax error present on the repo:

```sh
uv run --no-project --python 3.10 -m compileall . -q
# ** Error compiling './Packs/ThreatQ/Integrations/ThreatQ/ThreatQ.py'...
#  File "./Packs/ThreatQ/Integrations/ThreatQ/ThreatQ.py", line 106
#    except Exception, e:
#           ^^^^^^^^^^^^
# SyntaxError: multiple exception types must be parenthesized
```

* Update RN

---------

Co-authored-by: Andrej730 <azhilenkov@gmail.com>
Co-authored-by: Kamal Qarain <kqarain@paloaltonetworks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Community Contribution Form Filled Whether contribution form filled or not. Contribution Thank you! Contributions are always welcome! docs-approved External PR python Pull requests that update Python code skip-ai-review Xsoar Support Level Indicates that the contribution is for XSOAR supported pack

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants