0

I have made some application with PyQt4, which contains os.system() start function in it as a button, which basically opens a csv file.

import sqlite3
import sys
import os
.......
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        ####
        .............
        ####
        # "CSV" button
        self.pushButton_4 = QtGui.QPushButton(self.centralwidget)
        self.pushButton_4.setObjectName(_fromUtf8("pushButton_4"))
        self.horizontalLayout_2.addWidget(self.pushButton_4)
        self.pushButton_4.clicked.connect(self.csv_button)
        #### 
    def csv_button(self):
        import csv
        conn = sqlite3.connect('FamilyFinance_test.db')
        c=conn.cursor()
        myrow_in = c.execute("select * from Income_test order by date desc")
        with open('Income_test.csv', 'wb') as csvfile_in:
            s_in = csv.writer(csvfile_in, delimiter=' ')
            s_in.writerow(['Date']+['Income'])
            for i in myrow_in:
                s_in.writerow([str(i[0])]+[str(i[1])])
        myrow_out = c.execute("select * from Outcome_test order by date desc")
        with open('Outcome_test.csv', 'wb') as csvfile_out:
            s_out = csv.writer(csvfile_out, delimiter=' ')
            s_out.writerow(['Date']+['ATM']+['Spent']+['Reason']+['Category'])
            for j in myrow_out:
                s_out.writerow([str(j[0])]+[str(j[1])]+[str(j[2])]+[str(j[3])]+[str(j[4])])
        os.system("start "+'Income_test.csv')
        os.system("start "+'Outcome_test.csv')

Within python itself this function works fine, as well as with .exe created with py2exe. However, after successful creation of installer by InnoSetup and installing the application, i find that the very same button does not work.

Can someone give direction for resolving this problem?
Is there something to be done additionally with InnoSetup compiler?

KurzedMetal
  • 12,540
  • 6
  • 39
  • 65
  • Please edit your Q and post your code for us. Thanks – xlm Jul 28 '14 at 01:51
  • Try to find and post the error or traceback you get. – KurzedMetal Jul 28 '14 at 02:52
  • No error when run in python shell and from exe created with py2exe. The following error message pops up when i close the application (the .exe made with InnoSetup): "The logfile 'path_to_log_file.exe.log' could not be opened: [Errno 13] Permission denied: 'path_to_log_file.exe.log'" – user3882774 Jul 28 '14 at 03:03

1 Answers1

1

perhaps your InnoSetup install your program into C:\Program Files (x86) which requires UAC elevation to write into the folder.

So, maybe either change your installation folder to some User folders or package your application with UAC option in py2exe which is explained here https://stackoverflow.com/a/1445547/566035.

Community
  • 1
  • 1
otterb
  • 2,660
  • 2
  • 29
  • 48