How to Fix ‘CX_Freeze Python Error in Main Script’?

Some Windows users report that they are seeing the ‘CX_Freeze Python Error in Main Script’ startup error during every system startup. In most cases, the problem is reported to occur after the uninstallation of a 3rd-party program. As it turns out, the problem is not OS specific since it’s encountered on Windows 7, Windows 8.1 and Windows 10.

CX_Freeze Python Error in Main Script Error on Windows

In the vast majority of cases where this problem is reported, it ends up being caused by a poorly written Phyton application (most likely Raptr or PlayTV). If this scenario is applicable, you should be able to fix the issue by uninstalling the problematic app – You can either do it conventionally (via Programs and Features) or by using a powerful 3rd party uninstaller.

However, if you’re encountering this issue with a game (launched from Steam), you might be dealing with a glitch triggered by a series of temporary files in the AppData folder. In this case, clearing the contents of the AppData folder and reinstalling the game should fix the issue.

In case you’re seeing the error when trying to run a Phyton project that you’ve built locally, it’s likely that the issue occur due to a missing patch in the cx_freeze installation. In this case, you can get the issue resolved by uninstalling the entire cx_freeze package from a CMD window and then reinstalling the latest version.

If all else fails, your final hope at getting the issue resolved without resetting every Windows component is to run a couple of utilities (DISM and SFC) equipped to fix most instances of system file corruption.

Uninstalling Raptr or PlayTV

As it turns out, one of the most common instances that will end up spawning the ‘CX_Freeze Python Error in Main Script’ startup error is a software product that was written inconsistency using Python – In most cases, affected users have confirmed that the problem was either caused by Raptr or PlayTV.

If this scenario is applicable, you should be able to fix the issue by force uninstalling the program that you suspect might be responsible for the startup error.

When it comes to doing this, you can either go the traditional route (using the Programs & Features screen to do the uninstallation) or you can use a powerful 3rd party uninstaller to get the job down. Start with the conventional approach and only proceed to the second guide in case the first one fails.

Uninstalling from Programs & Features

  1. Press Windows key + R to open up a Run dialog box. Next, type ‘appwiz.cpl’ inside the text box and press Enter to open up the Programs and Features menu.
    Type appwiz.cpl and Press Enter to Open Installed Programs List
  2. Once you’re inside the Programs & features menu, scroll down through the list of installed applications and locate PlayTV, Raptr or whatever program you suspect might be triggering the ‘CX_Freeze Python Error in Main Script’ startup error.
  3. After you locate the problematic application, right-click on it and choose Uninstall from the newly appeared context menu.
    Uninstalling Raptr or PlayTV
  4. Inside the uninstallation prompt, follow the on-screen prompts to complete the uninstallation, then restart your computer and see if the issue is resolved at the next system startup.

In case the same problem is still occurring, move down below and get started with the 3rd party uninstaller.

Using an uninstaller Software

  1. Open your default browser and access this link (here) to download and install the latest free version of Revo Uninstaller. Once you get there, click the Download button to initiate the process.
    Downloading the latest version of Revo Uninstaller

    Note: Stay away from the portable version of Revo since it’s not nearly as effective as the InstallShield version.

  2. Once the installation executable is fully downloaded, double-click on it and follow the instructions on the screen to complete the installation.
    Installing the Revo Uninstaller

    Note: If you are prompted by the UAC (User Account Control) window, click Yes to grant admin access.

  3. Once you find your way inside the Revo Uninstaller app, go ahead and select the Uninstaller tab from the vertical menu at the top, then scroll down through the list of installed applications until you locate the entry associated with PlayTV or Raptr (or both).
  4. Right-click on the PlayTV or Raptr entry and choose Uninstall from the newly appeared context menu.
    Uninstalling Raptr or PlayTV

    Note: If you have both applications installed, follow this step and the ones below with both.

  5. At the next window, wait until the restore point is created, then click on Advanced from Scanning modes and click on Scan to remove any leftover files.
    Uninstalling PlayTV or Raptr with Revo Uninstaller
  6. Follow the on-screen prompts to complete the uninstallation, then restart your computer if you’re not prompted to do so automatically.
  7. Pay attention for the startup error at the next startup sequence to see if the ‘CX_Freeze Python Error in Main Script’ startup error has been resolved.

In case the same issue is still occurring, move down to the next potential fix below.

Reinstalling the cx_Freeze scripts (if applicable)

In case you’re encountering the ‘CX_Freeze Python Error in Main Script’ startup error while trying to run the executable file of your Python project that’s build using cx_freeze, chances are the problem is occurring due to a missing patch in the cx_freeze installation that you are using.

If this scenario is applicable, you will be able to fix the issue by uninstalling the entire cx_freeze package from a CMD window and reinstalling the latest version through the official channels.

Here are some step by step guides that will walk you through the whole process:

  1.  Press Windows key + R to open up a Run dialog box. Inside the text box, type ‘cmd’ and press Enter to open up a Command Prompt terminal.
    Running Command Prompt
  2. Inside the Command Prompt terminal, type the following command and press Enter to effectively uninstall the entire cx_freeze package:
    pip uninstall cx_freeze
  3. After the package gets ready to be uninstalled, you will be asked to confirm your choice. Do so by pressing the Y key and then Enter again to complete the uninstallation of the cx_freeze package.
    Uninstalling the CX_freeze package
  4. Next, open your default browser and use it to access this link (here). Once inside, you should see a list of Unofficial Windows Binaries for Python Extension Packages.
  5. Scroll down through the list of binaries to the cx_Freeze and look for the version associated with the Python version that you’re using. Once you manage to locate it, click on the compatible version and wait for the download to complete.
    Downloading the appropriate cx_Freeze
  6. Once the download is complete, navigate to the location of the download, right-click on the executable and click on Run as Administrator from the newly appeared context menu.
    Run As Administrator
  7. Inside the installation screen, select your Python version and proceed with the on-screen instructions to complete the installation.
    Installing Python
  8. Once the installation is complete and the new version of cx_freeze is installed, rebuild your Python project again and see if the issue is now resolved.

In case the same problem is still occurring or this method wasn’t applicable, move down to the next potential fix below.

Uninstalling the game’s AppData folder

In case you’re seeing the ‘CX_Freeze Python Error in Main Script‘ while trying to launch a game that’s built with Python, you might be dealing with some type of corrupted temporary data present in the AppData folder.

Several affected users that were also encountering this issue have confirmed that they were finally able to eliminate the error and play the game normally after they accessed the AppData folder of the game, clearing the temporary files of the game and then reinstalling the game.

If this scenario is applicable, follow the instructions below to fix the ‘CX_Freeze Python Error in Main Script’ error when trying to launch a game:

  1. Press Windows key + R to open up a Run dialog box. Next, type ‘%appdata%’ and press Enter to open up the AppData folder (that’s hidden by default).
    Typing in %AppData% and pressing Enter9
  2. Once you’re inside the AppData folder, back-track by clicking on the back arrow and click on Local.

    Accessing the Local folder of AppData

    Note: By default, the %appdata% command will automatically open the Roaming folder within Appdata.

  3. Inside the Local folder, look for an entry that holds information about the game that’s failing with the ‘CX_Freeze Python Error in Main Script’ error. Once you see it, open it, select everything inside, then right-click and choose Delete from the context menu.
    Deleting the Game’s App Data contents
  4. Open a Run dialog box again by pressing Windows key + R. Next, type ‘appwiz.cpl’ and press Enter to open up the Programs and Features screen.
    Typing in “appwiz.cpl” in the Run prompt
  5. Inside the Programs and Features menu, scroll down through the list of installed programs and right-click on the entry associated with the game that you’re encountering the issue with and choose Uninstall from the context menu.
    Uninstalling the Game
  6. Once the uninstallation complete, restart your computer and re-install the game using the conventional channels and see if the issue has been resolved.

In case you’re still seeing the ‘CX_Freeze Python Error in Main Script’ is still appearing or this potential fix was not applicable, move down to the next potential fix below.

Running DISM and SFC Scans

In case none of the fixing methods above have allowed you to get the issue resolved, your computer is likely dealing with some type of system file corruption that cannot be resolved conventionally. Most likely, the ‘CX_Freeze Python Error in Main Script’ startup error occurs due to a poorly written program that didn’t uninstall properly (even if the user followed the conventional channels).

If this scenario is applicable, you should be able to get the issue resolved by using a couple of built-in utilities (DISM and SFC) in order to identify and fix the instances of corrupted system files that are causing this problem.

SFC (System File Checker) is an entirely local tool that works by using a locally stored cache to replace corrupted instances with healthy copies. On the other hand, the DISM (Deployment and Image Servicing Deployment) tool requires a stable Internet connection since it relies on a sub-component of Windows Update to fetch healthy files needed to replace corrupted equivalents.

Since these two tools complement each other, we encourage users to run both scans in quick successions in order to maximize your chances of resolving the system file corruption issue that’s causing the ‘CX_Freeze Python Error in Main Script’ problem.

To perform an SFC scan, follow the step by step instructions here. Once the operation is complete, restart your computer and move forward with the DISM scan once the next startup sequence is complete.

After you ran both scans, do a final machine restart and see if the startup error stops appearing.

ABOUT THE AUTHOR

Kevin Arrows


Kevin Arrows is a highly experienced and knowledgeable technology specialist with over a decade of industry experience. He holds a Microsoft Certified Technology Specialist (MCTS) certification and has a deep passion for staying up-to-date on the latest tech developments. Kevin has written extensively on a wide range of tech-related topics, showcasing his expertise and knowledge in areas such as software development, cybersecurity, and cloud computing. His contributions to the tech field have been widely recognized and respected by his peers, and he is highly regarded for his ability to explain complex technical concepts in a clear and concise manner.