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

  • Home
  • SEARCH
  • 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 926859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:45:25+00:00 2026-05-15T19:45:25+00:00

I am developing an application with PyQT4 which will POST some data to a

  • 0

I am developing an application with PyQT4 which will POST some data to a web service to send SMS. The application works perfectly on Ubuntu 10.04. But when I deploy it on Windows, I get the BadStatusLine Error. I am running Python 2.6.4 on Windows 7.

The Error Message and the source codes follow. I didn’t put the gui.py since it was auto generated by the Qt Designer.

Please help me debug it.

Error Message:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "C:\Python26\lib\threading.py", line 525, in __bootstrap_inner
    self.run()
  File "D:\Temp\gp\library.py", line 14, in run
    f = urllib2.urlopen(urllib2.Request("http://masnun.com/aloashbei/sms/send",u
rllib.urlencode(self.data)))
  File "C:\Python26\lib\urllib2.py", line 124, in urlopen
    return _opener.open(url, data, timeout)
  File "C:\Python26\lib\urllib2.py", line 389, in open
    response = self._open(req, data)
  File "C:\Python26\lib\urllib2.py", line 407, in _open
    '_open', req)
  File "C:\Python26\lib\urllib2.py", line 367, in _call_chain
    result = func(*args)
  File "C:\Python26\lib\urllib2.py", line 1146, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "C:\Python26\lib\urllib2.py", line 1119, in do_open
    r = h.getresponse()
  File "C:\Python26\lib\httplib.py", line 974, in getresponse
    response.begin()
  File "C:\Python26\lib\httplib.py", line 391, in begin
    version, status, reason = self._read_status()
  File "C:\Python26\lib\httplib.py", line 355, in _read_status
    raise BadStatusLine(line)
BadStatusLine

App.Py

    #!/usr/bin/python

import os, sys
from PyQt4 import QtCore, QtGui
import gui, library

app = QtGui.QApplication(sys.argv)
mainWindow = QtGui.QMainWindow()
mainWindow.ui = gui.Ui_MainWindow()
mainWindow.ui.setupUi(mainWindow)

appUi = mainWindow.ui

# Add the application logic
handler = library.Application(mainWindow)
appUi.sendButton.clicked.connect(handler.send)
appUi.actionQuit.triggered.connect(sys.exit)



mainWindow.show()



sys.exit(app.exec_())

library.py

#!/usr/bin/python
from PyQt4 import QtGui
from threading import Thread

class Req(Thread):
    def __init__(self,data,callback):
        self.data = data
        self.callback = callback
        Thread.__init__(self)

    def run(self):

        import urllib, urllib2, json
        f = urllib2.urlopen(urllib2.Request("http://masnun.com/aloashbei/sms/send",urllib.urlencode(self.data)))
        resp = json.loads(f.read())
        status = resp['SendSMSResponse']['status']
        self.callback(status)


#8801711960803
class Application(object):

    def __init__(self,mainWindow):
        self.mainWindow = mainWindow
        self.ui = mainWindow.ui
        self.status = ""

    def quit(self):
        import sys
        sys.exit()


    def send(self):
        data = {}
        data['registrationID'] = self.ui.username.text()
        data['password'] = self.ui.password.text()
        data['sourceMsisdn'] = self.ui.phoneNumber.text()
        data['destinationMsisdn'] = self.ui.toBox.text()
        data['smsPort'] = 7424
        data['msgType'] = 4
        data['charge'] = 0.00 
        data['chargedParty'] = self.ui.phoneNumber.text()
        data['contentArea'] = 'gpgp_psms';
        data['msgContent'] = self.ui.smsText.text();


        req = Req(data,self.getStatus)
        req.start()
        req.join()



        if self.status == 'OK':
            QtGui.QMessageBox.information(None,"SMS Sent","SMS Sent successfully!")
            self.status = ""
        else:
            QtGui.QMessageBox.critical(None, "ERROR!","The SMS could not be sent!",QtGui.QMessageBox.Ok | QtGui.QMessageBox.Default,QtGui.QMessageBox.NoButton)
            self.status = ""

    def getStatus(self,status):
        self.status = status
  • 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-05-15T19:45:26+00:00Added an answer on May 15, 2026 at 7:45 pm

    Well, I just got id of it. You can not mix up Unicode and Strings. I also used urllib instead of urllib2. It worked. But I am not yet sure where the problem came from 🙁

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

Sidebar

Ask A Question

Stats

  • Questions 509k
  • Answers 509k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I think it would be best to do this in… May 16, 2026 at 4:31 pm
  • Editorial Team
    Editorial Team added an answer It's still open. You will need to explicitly dispose/close of… May 16, 2026 at 4:31 pm
  • Editorial Team
    Editorial Team added an answer With the maven compiler plugin and the exclude option: <build>… May 16, 2026 at 4:31 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

i'm developing an application that is listening to tcp to get some xml data
I'm developing an application in PyQt4 that eventually has to open and show PDF
I'm developing application in WPF but some components are written using WinForms. I wan't
Issue:- I am developing a application which needs a new acceleration datum every 5
I'm developing an application to identify incoming messages (SMS) and makes a file (on
I'm developing an application which requires two interfaces - one for mobile phones browsers
I am developing a GPL-licensed application in Python and need to know if the
I’m developing application with JBoss AS 5 with a special configuration according to my
I am developing application application using C++ VS 2008. Now I need to either
I'm developing application with NHibernate EntityMode.Map so I have entities of IDictionary without cs

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.