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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:26:45+00:00 2026-06-09T22:26:45+00:00

FIXED This issue has been fixed by moving QApplication out of main(). Hi I’m

  • 0

FIXED This issue has been fixed by moving QApplication out of main().

Hi I’m trying to implement a web service that executes the JavaScript code of a given URL and gives back the final HTML. I’m using PyQt4 for JS processing and Django 1.4 web framework.
The problem is: the script always works in the command invite but when I integrate it to Django it works only the first time, after running the Django local server, then during the following executions it warns:

WARNING: QApplication was not created in the main() thread
QObject::startTimer: QTimer can only be used with threads started with QThread

and I got wrong results.
The problem is that I’m not using any thread…
Here is the script I’m using on Django (urlconf leads to this main fonction with the url given):

#!/usr/bin/env python

import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *
from time import time, sleep

app = QApplication(sys.argv)

def wait(app, secs=1):
    deadline = time() + secs
    while time() < deadline:
        sleep(0)
        app.processEvents()

def main(url):
 #   app = QApplication(sys.argv)

    web = QWebView()
    web.load(QUrl(url))

    wait(app, 15)

    return web.page().mainFrame().toHtml().toUtf8()

Have you seen this before or tried to do something similar? Please help me with any information thank you

P.S. This is my first post here I hope everything is clear 🙂

EDIT The warnings are gone thanks to Rostyslav but I still have the sale issue.

  • 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-09T22:26:46+00:00Added an answer on June 9, 2026 at 10:26 pm

    Actually you use threads.

    Django developments server uses threading by default. You can pass optional --nothreading parameter to runserver command which is intended to disable using threads by server:

    python ./manage.py runserver --nothreading ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

UPDATE: This issue has been fixed as of Xcode 4.6! This technique now works
Edit: FYI for future readers, this issue has been fixed as of version 2.3.606.0
EDIT : This issue has been fixed by google in gtest 1.4.0; see the
I've been trying to debug this issue for hours upon hours but with no
Edited The issue (#347688) has been fixed in Sitecore CMS 6.5.0 rev. 120427 (6.5.0
I know this issue was posted before, and i fixed my code according to
Edit: closing anchor fixed. This issue exists when testing on the following browsers: Google
This is probably a dum error that can be fixed in seconds but have
Just noticed this and wanted to mention it. If anyone has seen this issue
Sorry If something like this has already been asked, but I can't find exactly

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.