Forum Discussion

mfoster711's avatar
mfoster711
Regular Contributor
20 days ago
Solved

__pycache__ folder and pyc files

I just used TestComplete version 15.80 for first time on a project and it created __pycache__ folder that contains pyc files for my scripts. I never had this before. Is it needed? Can you turn it off?

The only reason I ask is because all of these files showed up on GitHub desktop as new files. Should I be ignoring these files in Git? Saving them to github? Or can I turn them off so they are not created?

  • This is normal Python behavior, not something specific to TestComplete.

    When you use Python scripting in TestComplete, it generates .pyc files inside a __pycache__ folder. These are compiled bytecode files used to speed up execution. They’re automatically created and safely regenerated as needed.

    You should not commit them to source control. Add the following to your .gitignore:

    __pycache__/
    *.pyc
    *.pyo

    If they’re already tracked, remove them with:

    git rm -r --cached __pycache__
    git rm --cached *.pyc

    There’s generally no need to disable their creation — just ignore them in Git, which is standard practice for Python projects.

    🤖 AI-assisted response
    👍 Found it helpful? Click Like
    ✅ Issue resolved? Click Mark as Solution

1 Reply

  • Hassan_Ballan's avatar
    Hassan_Ballan
    Icon for Champion Level 3 rankChampion Level 3

    This is normal Python behavior, not something specific to TestComplete.

    When you use Python scripting in TestComplete, it generates .pyc files inside a __pycache__ folder. These are compiled bytecode files used to speed up execution. They’re automatically created and safely regenerated as needed.

    You should not commit them to source control. Add the following to your .gitignore:

    __pycache__/
    *.pyc
    *.pyo

    If they’re already tracked, remove them with:

    git rm -r --cached __pycache__
    git rm --cached *.pyc

    There’s generally no need to disable their creation — just ignore them in Git, which is standard practice for Python projects.

    🤖 AI-assisted response
    👍 Found it helpful? Click Like
    ✅ Issue resolved? Click Mark as Solution