When I try to run the following python script from Qt I get this error. ImportError: No module named imapclient
Python scripts will run just fine without the import statements. Does anyone know how to fix this? Thank you in advance for all your help. Qt doesn't seem to be using the same version of Python that is used by default on my terminal.
Qt Code (widget.cpp)
#include "widget.h"
#include "ui_widget.h"
#include "QDebug"
#include <QTimer>
#include <QProcess>
#include <QDir>
#include <QTime>
Widget::Widget(QWidget *parent) :
QWidget(parent),
ui(new Ui::Widget)
{
ui->setupUi(this);
QTimer *timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(checkTexts()));
timer->start(5000);
}
Widget::~Widget()
{
delete ui;
}
void Widget::checkTexts(){
QProcess *process = new QProcess(this);
QStringList arguments { QCoreApplication::applicationDirPath() + "/../../../../../Monika/Qt Desktop Application/Monika/CheckText.py"};
process->startDetached("python", arguments);
process->waitForFinished(-1);
QString output = process->readAllStandardOutput();
qDebug() << output;
process->close();
}
Python Code (CheckText.py)
import imapclient
import imaplib
def getTexts():
imaplib._MAXLINE = 10000000 #increases the byte limit of how much python can remember
imapObj = imapclient.IMAPClient('imap.gmail.com', ssl=True)
print ("done")
getTexts()