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 8879733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:00:59+00:00 2026-06-14T20:00:59+00:00

I am building a fairly complex application using Python and PySide. Finally the day

  • 0

I am building a fairly complex application using Python and PySide. Finally the day of the release is nearing so I want to build this application as an exe.

However, I have a strange problem on my hands. I’ve used PyInstaller (using version 2 by the way) in the past and never had this happened to me.

Basically, when I build the application with the --console flag, it works fine – but it opens the console window. When I build the application with the window flag (-w), it doesn’t work fine. It starts and everything, but there are all these weird glitches. For example, loading a text file often raises the BadFileDescriptor error (which doesn’t happen in console mode), and the application crashes after performing a certain task. What’s worse is that the task is a loop, and it performs fine the first time, but when it starts working again, it crashes.

When I looked at the minidump file there were some errors about memory access violation of QtGui4.dll file. Again, this doesn’t happen in console mode.

Anyone have any ideas?

  • 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-14T20:01:01+00:00Added an answer on June 14, 2026 at 8:01 pm

    The BadFileDescriptor error and the consequently memory access violation are caused by the fact that the stdout of applications in windowed mode is a fixed size buffer.
    So, if you have are writing to stdout, either with print or sys.stdout directly, after some time you’d see those errors.

    You can fix this by:

    1. Removing/commenting out the writings on stdout
    2. Using logging instead of printing to stdout
    3. Redirecting stdout at the beginning of the execution of your application. This is the solution that requires less code to be changed, even though I think moving the debugging statements to logging would be the better choice.

    To redirect stdout you can use this kind of code:

    import sys
    import tempfile
    sys.stdout = tempfile.TemporaryFile()
    sys.stderr = tempfile.TemporaryFile()
    

    Just before executing your program. You can use also some custom object to put the output in “log” files or whatever, the important thing is that the output should not fill the fixed size buffer.

    For example you could do something like this to be able to take advantage of the logging module without changing too much code:

    import sys
    import logging
    
    debug_logger = logging.getLogger('debug')
    debug_logger.write = debug_logger.debug    #consider all prints as debug information
    debug_logger.flush = lambda: None   # this may be called when printing
    #debug_logger.setLevel(logging.DEBUG)      #activate debug logger output
    sys.stdout = debug_logger
    

    The downside of this approach is that print executes more calls to stdout.write for each line:

    >>> print 'test'
    DEBUG:debug:test
    DEBUG:debug:
    

    If you want you can probably avoid this kind of behaviour writing a real write function that calls the_logger.debug only with “full lines”.

    Anyway I think these kind of solution should only be temporary, and be used only before porting the prints to calls to logging.debug.

    (Obviously the loggers should write to a file and not to stdout to avoid the errors.)

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

Sidebar

Related Questions

We are building a fairly complex application that we need to be able to
I'm building a fairly large enterprise application made in python that on its first
I'm building a fairly complex business application on the iPad IOS 4.2: 4 tabs,
I'm building a J2EE application in which I want to allows plugins. I'm fairly
I have a fairly complex algorithm I'm building using both visual c 2008 and
This is fairly simple but I cant work it out. I'm building a wordpress
Hello I have been tasked with creating a fairly complex web application in php,
I am fairly new to unit testing. I am building an ASP.NET MVC3 application
In building a my application, I have a fairly long list of *.Lib files
I have a problem building a fairly simple local CGO project. Consider this very

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.