Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8818213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:03:29+00:00 2026-06-14T05:03:29+00:00

I have a .pyw script that works when I double click it etc and

  • 0

I have a .pyw script that works when I double click it etc and it stays open till I close it but I’ve added it to the registry to run at startup. It does run on startup but it doesn’t stay open like its set to. It flashes the gui and then just closes.

Any ideas why this is happening or how to fix it?

P.S I don’t want to create a shortcut in the startup folder linking to the .pyw file.

I added the my python script to the registry with another python script :p

import _winreg
aReg    = _winreg.ConnectRegistry(None,_winreg.HKEY_LOCAL_MACHINE)
aKey    = _winreg.OpenKey(aReg, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", 0, _winreg.KEY_WRITE)
_winreg.SetValueEx(aKey,"MyScript",0, _winreg.REG_SZ, myScript_path) 

And when I browse that path in the registry:
HKEY_LOCAL_MACHINE > SOFTWARE > Microsoft > Windows > CurrentVersion > Run it is there with the correct path in data and type REG_SZ

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T05:03:31+00:00Added an answer on June 14, 2026 at 5:03 am

    There was a very strange error that only happened at startup since one of the processes the script seemed to use hadn’t been started yet. Running as a .py with python.exe didn’t produce the error, it only happened when the script was run as a .pyw so I wrote the sys.stdout to a file to log its progress and errors.

    Before I had used the logging module but it didn’t seem to give as much detail as just outputting straight to file.

    After checking the file I was able to fix the code so essentially it was a code problem but quite a sneaky one.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made a .pyw python script that I want to have running in the
I have created a script in python and saved it as .pyw file so
I have a simple script that has a dependency on dnspython for parsing zone
I have written a logging application in Python that is meant to start at
I have quite a 'heavy' python program that I would like compiled to an
Have a network location that shows paths in the 8.3 short format. I need
Have data that has this kind of structure. Will be in ascending order by
Have data that has this kind of structure: $input = [ { animal: 'cat',
Have searched for the answer but no joy, so here goes... I'm working on
Im trying to start a wxPython app that (I have converted to an exe

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.