buildbot version being used is:
$ buildbot --version
Buildbot version: 0.8.3p1
Twisted version: 10.1.0
Checkconfig, gives me errors:
$ buildbot checkconfig
/usr/lib/python2.6/dist-packages/twisted/mail/smtp.py:10: DeprecationWarning: the MimeWriter module is deprecated; use the email package instead
import MimeWriter, tempfile, rfc822
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/buildbot-0.8.3p1-py2.6.egg/buildbot/scripts/runner.py", line 1071, in doCheckConfig
ConfigLoader(configFileName=configFileName)
File "/usr/local/lib/python2.6/dist-packages/buildbot-0.8.3p1-py2.6.egg/buildbot/scripts/checkconfig.py", line 46, in __init__
self.loadConfig(configFile, check_synchronously_only=True)
File "/usr/local/lib/python2.6/dist-packages/buildbot-0.8.3p1-py2.6.egg/buildbot/master.py", line 883, in loadConfig
% (b['name'], n))
ValueError: builder runtests uses undefined slave example-slave
$
Here is one example i looked at :
http://agiletesting.blogspot.com/2006/02/continuous-integration-with-buildbot.html
This pertains to:
Buildbot version: 0.8.8
Twisted version: 13.2.0
I had some serious issues to get it working with a simple hg repo, while the same project worked fine with git and the appropriate functions. So here it is.
There are three places deal with our repo in master.cfg: changesources, schedulers and builders, with only changesources and builders that use mercurial specific functions.
In changesources section:
from buildbot.changes.hgpoller import HgPoller
therepo=HgPoller(repourl="/home/user/test/my_project/",
branch='default',
pollInterval=30,
workdir='myrepo')
c['change_source'] = []
c['change_source'].append(therepo)
Here I use HgPoller, instead of PBChangeSource. The latter is more sophisticated but also requires more configuration steps (provide a port and yet another username and password).
repourl must point to the root of your hg repository. Any URL that could be used for "hg pull" or "hg clone" is acceptable. This example involves a local repository, but it could be on a server, then you would specify http something or else.
The default branch on mercurial is 'default'. pollInterval=30 says every 30 seconds, check for a new commit (this is from a toy example, in reality >30 would be more suitable).
Now the builder, which builds after a commit is detected and passed on by the scheduler(s):
from buildbot.process.factory import BuildFactory
from buildbot.steps.source.mercurial import Mercurial
factory = BuildFactory()
#watch out: this function is Mercurial, NOT Hg
checkout_default = Mercurial(repourl="/home/user/test/my_project/",
defaultBranch='default',
branchType='inrepo',
haltOnFailure = True)
factory.addStep(checkout_default)
# then you add some build instructions and don't forget to import the necessary...
What explains why my thing did not work is that I did not specify defaultBranch and branchType. Those keywords are not the same as with Git(), so beware. This is a little tricky as I did not find them in the user manual online, but it's there if you take a moment within the python interpreter:
import buildbot
help(buildbot.steps.source.mercurial)
Also, note that this is the function Mercurial imported from buildbot.steps.source.mercurial, which is not the same Mercurial function that you would import imported from buildbot.steps.source.Mercurial. The latter is deprecated (or that which you would use on an older version). My thanks to tomprince from the IRC buildbot channel on freenode for pointing that out.
The example you looked at is very old; c['bots'] was renamed to c['slaves'] a while ago, as well as many more changes.
I'd suggest taking a look at the Buildbot manual for configuration:
http://buildbot.net/buildbot/docs/current/Configuration.html#Configuration
And possibly also the installation section, to make sure you did what was required to set up the more recent versions of BuildBot, not just older versions:
http://buildbot.net/buildbot/docs/current/Installation.html#Installation
One example that was offered was the IcedTea buildbot, which builds from Mercurial repos. Configuration is browsable here:
http://icedtea.classpath.org/hg/buildbot/file
You're also welcome to drop by #buildbot on irc.freenode.net for help.
Related
I've got older Debian Jessie server with Mercurial 3.1.2 and Phabricator. Long time Phabricator protest that HG is old and there is secure problems and I decide to make brand new VM with latest HG.
Old:
lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.11 (jessie)
Release: 8.11
Codename: jessie
hg version
Mercurial Distributed SCM (version 3.1.2)
(see http://mercurial.selenic.com for more information)
New:
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
hg version
Mercurial Distributed SCM (version 4.8.2)
(see https://mercurial-scm.org for more information)
Copyright (C) 2005-2018 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Enabled extensions:
largefiles internal
and configured:
hg debuginstall
checking encoding (UTF-8)...
checking Python executable (/usr/bin/python2)
checking Python version (2.7.16)
checking Python lib (/usr/lib/python2.7)...
checking Python security support (sni,tls1.0,tls1.1,tls1.2)
checking Mercurial version (4.8.2)
checking Mercurial custom build ()
checking module policy (c)
checking installed modules (/usr/lib/python2.7/dist-packages/mercurial)...
checking registered compression engines (bz2, bz2truncated, none, zlib, zstd)
checking available compression engines (bz2, bz2truncated, none, zlib, zstd)
checking available compression engines for wire protocol (zstd, zlib, bz2, none)
checking "re2" regexp engine (missing)
checking templates (/usr/share/mercurial/templates)...
checking default template (/usr/share/mercurial/templates/map-cmdline.default)
checking commit editor... (sensible-editor)
checking username (myuser <myuser#gmail.com>)
no problems detected
hg --debug showconfig
starting pager for command 'config'
read config from: /usr/etc/mercurial/hgrc
read config from: /etc/mercurial/hgrc
read config from: /etc/mercurial/hgrc.d/cacerts.rc
read config from: /etc/mercurial/hgrc.d/hgext.rc
read config from: /root/.hgrc
read config from: /root/.config/hg/hgrc
/etc/mercurial/hgrc:9: extensions.largefiles=
/etc/mercurial/hgrc:19: trusted.users=root, topperl, www-data
/etc/mercurial/hgrc:12: ui.username=myuser <myuser#gmail.com>
--verbose: ui.verbose=False
--debug: ui.debug=True
--quiet: ui.quiet=False
pager: ui.formatted=True
pager: ui.interactive=False
/etc/mercurial/hgrc.d/cacerts.rc:4: web.cacerts=/etc/ssl/certs/ca-certificates.crt
Rsynced all the repositories and setup hgweb.wsgi to act like a web server (Apache2 vhost as it's easy for me)
# An example WSGI for use with mod_wsgi, edit as necessary
# See https://mercurial-scm.org/wiki/modwsgi for more information
# Path to repo or hgweb config to serve (see 'hg help hgweb')
config = "/var/www/vhost/hg/cgi-bin/hgweb.config"
# Uncomment and adjust if Mercurial is not installed system-wide
# (consult "installed modules" path from 'hg debuginstall'):
#import sys; sys.path.insert(0, "/path/to/python/lib")
# Uncomment to send python tracebacks to the browser if an error occurs:
import cgitb; cgitb.enable()
# enable demandloading to reduce startup time
from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb.hgwebdir_mod import hgwebdir
import os
os.environ["HGENCODING"] = "UTF-8"
from mercurial.hgweb import hgweb
application = hgweb(config)
Python version is:
Python 2.7.16 (default, Apr 6 2019, 01:42:57)
[GCC 8.3.0] on linux2
When push large files I receive error:
mod_wsgi (pid=3945): Exception occurred processing WSGI script '/var/www/vhost/hg/cgi-bin/hgwebdir.w
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/mercurial/hgweb/hgwebdir_mod.py", line 352, in run_wsgi
for r in self._runwsgi(req, res):
File "/usr/lib/python2.7/dist-packages/mercurial/hgweb/hgweb_mod.py", line 307, in run_wsgi
for r in self._runwsgi(req, res, repo):
File "/usr/lib/python2.7/dist-packages/mercurial/hgweb/hgweb_mod.py", line 333, in _runwsgi
rctx, req, res, self.check_perm)
File "/usr/lib/python2.7/dist-packages/mercurial/wireprotoserver.py", line 221, in handlewsgireque
_callhttp(repo, req, res, proto, cmd)
File "/usr/lib/python2.7/dist-packages/mercurial/wireprotoserver.py", line 436, in _callhttp
rsp = wireprotov1server.dispatch(repo, proto, cmd)
File "/usr/lib/python2.7/dist-packages/mercurial/wireprotov1server.py", line 74, in dispatch
return func(repo, proto, *args)
File "/usr/lib/python2.7/dist-packages/mercurial/wireprotov1server.py", line 196, in batch
result = func(repo, proto, *[data[k] for k in keys])
File "/usr/lib/python2.7/dist-packages/hgext/largefiles/proto.py", line 89, in statlfile
filename = lfutil.findfile(repo, sha)
File "/usr/lib/python2.7/dist-packages/hgext/largefiles/lfutil.py", line 111, in findfile
elif inusercache(repo.ui, hash):
File "/usr/lib/python2.7/dist-packages/hgext/largefiles/lfutil.py", line 100, in inusercache
path = usercachepath(ui, hash)
File "/usr/lib/python2.7/dist-packages/hgext/largefiles/lfutil.py", line 71, in usercachepath
return os.path.join(_usercachedir(ui), hash)
File "/usr/lib/python2.7/dist-packages/hgext/largefiles/lfutil.py", line 97, in _usercachedir
raise error.Abort(_('unknown %s usercache location') % name)
Abort: unknown largefiles usercache location
Tried really hard whole day that and another tweak and advice but no luck :/
Some one with smart advice ?
PS: Also tried to clone old >> push new some repos and not good again
Partial resolve the problem - users cloned repositories can now make hg push repo
Add to /etc/mercurial/hgrc except:
[extensions]
largefiles =
and
[largefiles]
usercache = /path/to/largefiles/storage
Still facing the problem how to migrate all the repost from old to new server.
If I found proper solution will edit the topic.
I've been following the 5 min how to for setting up an htap databse with tidb_tispark and everything works until I get to the section Launch TiSpark. My first issue occurs when executing the line:
docker-compose exec tispark-master /opt/spark-2.1.1-bin-hadoop2.7/bin/spark-shell
But I got around that by modifying the spark version to the version I found inside the container:
docker-compose exec tispark-master /opt/spark-2.3.3-bin-hadoop2.7/bin/spark-shell
My second issue occurs when executing the three line block:
import org.apache.spark.sql.TiContext
val ti = new TiContext(spark)
ti.tidbMapDatabase("TPCH_001")
When I run the last statement I get the following output
scala> ti.tidbMapDatabase("TPCH_001")
2019-07-11 16:14:32 WARN General:96 - Plugin (Bundle) "org.datanucleus" is already registered. Ensure you dont have multiple JAR versions of the same plugin in the classpath. The URL "file:/opt/spark/jars/datanucleus-core-3.2.10.jar" is already registered, and you are trying to register an identical plugin located at URL "file:/opt/spark-2.3.3-bin-hadoop2.7/jars/datanucleus-core-3.2.10.jar."
2019-07-11 16:14:32 WARN General:96 - Plugin (Bundle) "org.datanucleus.api.jdo" is already registered. Ensure you dont have multiple JAR versions of the same plugin in the classpath. The URL "file:/opt/spark/jars/datanucleus-api-jdo-3.2.6.jar" is already registered, and you are trying to register an identical plugin located at URL "file:/opt/spark-2.3.3-bin-hadoop2.7/jars/datanucleus-api-jdo-3.2.6.jar."
2019-07-11 16:14:32 WARN General:96 - Plugin (Bundle) "org.datanucleus.store.rdbms" is already registered. Ensure you dont have multiple JAR versions of the same plugin in the classpath. The URL "file:/opt/spark/jars/datanucleus-rdbms-3.2.9.jar" is already registered, and you are trying to register an identical plugin located at URL "file:/opt/spark-2.3.3-bin-hadoop2.7/jars/datanucleus-rdbms-3.2.9.jar."
2019-07-11 16:14:36 WARN ObjectStore:568 - Failed to get database global_temp, returning NoSuchObjectException
This doesn't prevent me from running the query:
spark.sql("select * from nation").show(30);
But when I follow the further steps of the tutorial to modify the db from MySQL, the changes are not reflected immediately in Spark. Furthermore, at some point in the future (I believe > 5 minutes later), the row that was modified stops showing up in Spark SQL queries.
I'm rather new to this kind of setup and don't really know how to debug this issue. Searches for the warnings I received weren't illuminating.
I don't know if it's helpful but when I connect MySQL this is the server version I get:
Server version: 5.7.25-TiDB-v3.0.0-rc.1-309-g8c20289c7 MySQL Community Server (Apache License 2.0)
I'm one of the main dev of TiSpark. Sorry for your bad experience with it.
Due to my docker problem, I cannot directly reproduce your issue but it seems you hit one of the bug fixed recently.
https://github.com/pingcap/tispark/pull/862/files
The tutorial document is not quite up-to-date and points to an older version. That's why it didn't work with spark 2.1.1 as in tutorial. We will update it ASAP.
Newer version of TiSpark doesn't use tidbMapDatabase anymore but hooks with catalog directly instead. Method tidbMapDatabase remains for backward compatibility. Unfortunately, the tidbMapDatabase had a bug(when we ported it from older version) that it retrieves timestamp for query only once you call the function. That causes TiSpark always uses old timestamp to do snapshot reading and newer data would never be seen by it.
In newer version of TiSpark (TiSpark 2.0+ with Spark 2.3+), databases and tables are directly hooked into catalog services and you can directly call
spark.sql("use TPCH_001").show
spark.sql("select * from nation").show
This should give you fresh data.
So try restart your Spark driver, just try the two lines of code above and see if it works.
Let me know if this fix your problem. On the other hand, we will check our docker image to make sure if it contains the fix already.
If things still get wrong, would you please help to run below code and let us know the version of TiSpark.
spark.sql("select ti_version()").show
Again, sorry for causing you trouble and thanks for trying.
EDIT
To address your comment:
The warning is due to spark itself will try to locate the database in its native catalog first and this will cause a Failed to get warning. But the failover process will delegate the search to tispark and then behave correctly. So this warning can be ignored. It's recommended that add below lines to your log4j.properties in conf folder of your spark.
log4j.logger.org.apache.hadoop.hive.metastore.ObjectStore=ERROR
We will polish the docker tutorial image soon. Thank you so much for trying.
I am trying to install rasqal 0.9.20 library http://librdf.org/rasqal/ onto a windows 7 machine with cygwin.Earlier i have successfully installed the raptor-2.2.0 library http://librdf.org/raptor/ and i can verify this with the rapper tool was created after the installation(./configure , ./make ,/make install)
The error that i am getting from the configuration of rasqal is :
./configure --enable-raptor2
...
checking for raptor... configure: error: Raptor2 is not installed - see http://librdf.org/raptor/ to get a version newer than 1.9.0
I can't find a way to fix it. The code from the cofigure file that handles this flag is the below :
11840 # raptor is REQUIRED despite the checking here
11841 RAPTOR_MIN_VERSION=1.4.19
11842 RAPTOR_MAX_VERSION=1.8.99
11843 RAPTOR2_MIN_VERSION=1.9.0
11844
11845 raptor2=no
11846 # Check whether --enable-raptor2 was given.
11847 if test "${enable_raptor2+set}" = set; then :
11848 enableval=$enable_raptor2; raptor2="$enableval"
11849 else
11850 raptor2="no"
11851 fi
Raptor 2.0.0 uses only pkg-config to provide configuration information, raptor-config was removed. The same applies to rasqal itself, the rasqal-config program will go away at some point. The --enable-raptor2 option to rasqal and librdf was for testing the beta raptor2, and it has been removed from rasqal 0.9.22 and librdf GIT head.
Set PKG_CONFIG_PATH to include the correct path:
env PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure
Another method, if available on your system, is to define the environment variable in /etc/environment:
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
I am attempting to make a qt program on Windows 7 that uses a MySQL plugin.
I have compiled both qt and the mysql plugin with no problems using my minGW 32bit compiler.
However, I keep on getting an error like this:
mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/Users/dhatt/Desktop/testdb2'
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_SQL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN - I"..\..\..\..\QT\qt\include\QtCore" -I"..\..\..\..\QT\qt\include\QtGui" -I"..\..\..\..\QT\qt\include\QtSql" -I"..\..\..\..\QT\qt\include" -I"..\..\..\..\MySQL\bin" -I"..\..\..\..\QT\qt\include\ActiveQt" -I"debug" -I"..\..\..\..\QT\qt\mkspecs\win32-g++" -o debug\database.o database.cpp
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug\testdb2.exe debug/database.o -L"c:\QT\qt\lib" -lmingw32 -lqtmaind -L C:\MySQL\lib\opt -LC:/QT/qt/plugins/sqldrivers -lqsqlmysqld -lQtSqld4 -lQtGuid4 -lQtCored4 -LC:\MySQL\lib\opt
C:/qt/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: cannot find -lqsqlmysqld
collect2: ld returned 1 exit status
mingw32-make[1]: *** [debug\executable.exe] Error 1
mingw32-make[1]: Leaving directory `C:/Users/dhatt/Desktop/testdb2'
mingw32-make: *** [debug] Error 2
I apologize in advance for being very verbose of what I did, but I am doing this partly for troubleshooting, and partly so any other lost souls don't end up wasting three weeks on this particular problem. :)
Here are my specs:
Windows 7 Nokia's Open Source QT
Qt SDK for Windows (C:\Qt\2010.04\qt)
Linux MinGW Version 5.1.6 (C\Linux\MinGW)
MySQL5 with C++ files (C:\MySQL5)
If you want to know how I installed qt, just follow this site's instructions:
http://www.jiggerjuice.net/software/qt-sql-drivers.html
These other sites may hold some extra information tidbits:
http://doc.qt.nokia.com/4.6/sql-driver.html
http://www.rag.com.au/linux/qt4howto.html
http://qtnode.net/wiki?title=Qt4_on_Windows (yes, I did check with Nokia's docs!!!)
http://doc.trolltech.com/qq/qq10-windows-deployment.html
This fellow mentioned about remaking qmake, which I am not doing unless I have a good reason.
http://christopher.rasch-olsen.no/2009/04/14/qt-45-and-mysql-plugin-with-mingw-on-windows-xp/
I've already deleted the plugin cache once before, I hope I won't have to do it again...
http://doc.trolltech.com/4.2/plugins-howto.html#the-plugin-cache
http://ubuntuforums.org/showthread.php?t=1070155
If there is any confusion, between the two compilation option (creating the mysql libraries statically, or as a plugin), I chose for the plugin because it compiles quicker and I don't have to worry about licensing.
Generally, the big trouble of mysql to most people is to make a mingw compatible library. Generally, I did this with the mingw tools in ( https://olex.openlogic.com/packages/mingw-utils )...
c:\> cd MySQL\lib\opt
c:\mysql\lib\opt> reimp -d libmysql.lib
c:\mysql\lib\opt> dlltool --input-def libmysql.def --dllname libmysql.dll --output-lib libmysql.a -k
I should have done it right since in my C:\MySQL\lib\opt, it has the two files:
libmysql.a
libmysql.lib
LIBMYSQL.def (not a typo)
and in the C:\MySQL\bin directory, I have:
libmySQL.bin (not a typo)
I had compiled the mysql plugin beforehand:
cd %QTDIR%\src\plugins\sqldrivers\mysql
qmake "INCLUDEPATH+=C:\MySQL\include" "LIBS+=C:\MYSQL\lib\opt\libmysql.lib" mysql.pro
mingw32-make
As a result, I have in my C:\QT\qt\plugins\sqldrivers folder:
libqsqlmysql4.a
libqsqlmysqldq4.a
libqsqlodbc4.a
libqsqlodbcd4.a
qsqlmysql4.dll
qsqlmysqld4.dll
qsqlodbc4.dll
qsqlodbc4.dll
And in my C:\QT\bin folder
QtSql4.dll
QtSqld4.dll
So, I assume from this site ( http://www.qtforum.org/article/21352/how-to-compile-use-a-mysql-driver.html) that I got it right.
I didn't use the binaries of qt itself, I used the compiled qt files(also from Nokia), but reconfigured and recompiled them using mingw32-make. I had no errors. This was my configuration options for remaking qt.
-opensource
-nomake examples
-nomake demos
-no-sql-lite
-no-qt3support
-no-gif
-no-libpng
-no-libmng
-no-libtiff
-no-phonon
-no-phonon-backend
-no-multimedia
-no-audio-backend
-no-webkit
-no-script
-no-scripttools
-nodeclarative
-plugin-sql-mysql -l mysql -I C:\QT\qt\include -L C:\QT\qt\lib\opt
Here is my .pro file
LANGUAGE = C++
TEMPLATE = app
TARGET = executable
QT += core sql
QTPLUGIN += qsqlmysql
DEPENDPATH += .
INCLUDEPATH += C:\MySQL\bin
LIBS += -L C:\MySQL\lib\opt -lmysql
# Input
SOURCES += database.cpp
I installed the plugin described in here:
C:\QT\qt
My path variables are:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Python26;C:\Linux\Cygwin\bin;C:\mingw-utils-0.3\bin;C:\QT\qt\bin;C:\MySQL\bin;C:\MySQL\include;C:\QT\mingw32\bin;C:\QT\mingw\bin;C:\QT\qt\plugins\sqldrivers
The qt command prompt added a few extra though, so I did all of this in the command prompt.
Setting up a MinGW/Qt only environment...
-- QTDIR set to C:\QT\qt
-- PATH set to C:\QT\qt\bin
-- Adding C:\QT\bin to PATH
-- Adding C:\Windows\System32 to PATH
-- QMAKESPEC set to win32-g++ (mingw is my only compiler so, this is unnecessary)
Although I either did all that already, or it is redundant. I only add this for the sake of completeness.
Here is my code (database.cpp):
#include <QtSql>
#include <iostream>
using namespace std;
int main( int argc, char ** argv )
{
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
db.setHostName("---.---.---.---");
db.setDatabaseName("--------");
db.setUserName("------------");
db.setPassword("------------");
if (!db.open()) cout << "Failed to connect to mysql" << endl;
else cout << "Works finally." << endl;
QSqlDatabase::removeDatabase("QMYSQL");
exit ( 0 );
}
Very simple, yes?
I went to my directory with the example code, run
mingw32-make distclean
qmake
mingw32-make
and get the error message above. I've tried building a version with the release version only (no debug), and it still shows the same message, but with "cannot find -lqsqlmysq", so it is not that.
I've tried many things, but where should I look next to solve it; maybe someone can narrow it down for me, set me on the right path, or even better, solve his annoying problem.
Also, I plan to use python bindings with my code (I need PyQT + MySQL). If the proposed solution would prevent me from doing so, let me know.
Well, I'm going to solve my own problem, again, so let's make this fun!
This is your last chance.
After this, there is no turning back.
You download the PyQT.exe, the story ends. You wake up in your bed and you believe whatever you want to believe. You modify the .pro file, you stay in wonderland. And, I show you how deep the rabbit hole goes.
I eventually gave up and downloaded the .exe, which does have MySQL support out of the box. If mysql does not work, your application is the problem, and I recommend you read this post here ( http://lists.trolltech.com/qt-interest/2006-06/thread00292-0.html ) or follow the quote below:
The issue is that you either have to
use the addLibraryPath method or
create a QCoreApplication instance
before your first call to loading a
database
Believe me, manually installing PyQT+MySQL on Windows is a pain. But if you need some out of the way plugin to get at that the executable doesn't know, you have to go down the rabbit hole further.
Here is the new and improved .pro file:
LANGUAGE = C++
TEMPLATE = app
TARGET = executable
QT += core sql
QTPLUGIN += qsqlmysql
DEPENDPATH += .
INCLUDEPATH += C:\MySQL\bin
LIBS += -L C:\MySQL\lib\opt
# Input
SOURCES += database.cpp
Turns out I did have the right path to mysql, I was just confusing it with the .pro file that I had. After redownloading qt and following the steps above again, modifying my .pro file made all the difference.
But now I had to download SIP and PyQT. I followed the docs on there. There are a few more problems. Follow the links or the directions which are left there in case the information is removed.
If your SIP make install has an error where it is looking at Unix paths (/usr/bin) instead of DOS paths (C:\QT), look at this link http://old.nabble.com/Building-SIP-on-MinGW-:-problem-at-%22make-install%22-td28909249.html#
(short version: the problem is the sh.exe in one of your other linux compilers like cygwin or msys, change the name temporarily to force the make install to use DOS path naming):
If you configure PyQT and it spits out a file error that has to do with QTCore
Google pexports and download. Go to %QTdir%/bin. Then follow instructions or link ( http://jeethurao.com/blog/?p=18 )
pexports QtCore4.dll > QtCore4.def
dlltool –dllname QtCore4.dll –def QtCore4.def –output-lib libQtCore4.a
move libQtCore4.a ..\lib
And now you know kung-fu.
P.S: I never tried this method myself. This is a different, but untested (by me) method of compiling PyQT, done up by the trolls at Trolltech:
http://www.diotavelli.net/PyQtWiki/InstallingPyQTCommercialWin
I know it's something silly, but for some reason Jython refuses to find javax.swing. I'm using Java 1.6.0_11. This is my start-up script:
#echo off
"%JAVA_HOME%\bin\java" -Xmx1024M -classpath ".;c:\Projects\Jython2.5.1\jython.jar" org.python.util.jython
My output looks like:
Jython 2.5.1 (Release_2_5_1:6813, Sep 26 2009, 13:47:54)
[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.6.0_10
Type "help", "copyright", "credits" or "license" for more information.
>>> import javax.swing
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named swing
>>> import javax
>>> dir(javax)
['__name__']
>>>
Most likely Jython is not scanning your packages. On startup, Jython tries to go through the jars and class files on its path and scan for Java packages. This is necessary because there is no way to look for Java packages by reflection. Package scanning can be deliberately turned off, or you could lack write privileges where it wants to write the cached information out see http://wiki.python.org/jython/PackageScanning for more. The best way to import Java classes is to do so explicitly class by class, like so:
from javax.swing import JFrame
This method should always work, even if package scanning is off or otherwise unable to work, and is the recommended approach (though it can be a bit tedious). If you do want to import packages (or if you want to do "from javax.swing import *" which also depends on package scanning - but is discouraged) you will need to figure out why your package scanning isn't working.
I had similar issues, and it turns out that since the standalone Jython dist does not support caching, it also does not support the "import *" approach. This is not clearly documented anywhere in the official Jython docs, but I concluded this based on a number of different bug reports:
https://groups.google.com/forum/?hl=en&fromgroups=#!topic/robotframework-users/6ipB0DYJkvU
http://bugs.jython.org/issue1778514
http://bugs.jython.org/issue1422
http://bugs.jython.org/issue1692579
Notable from that last link:
So as Oti noted, in standalone you must do full imports to succeed.
To fix your issue, use the non-standalone standard jython.jar generated by installing jython using the 'Standard' option.
If you wanted to package and distribute jython.jar with your application, in case a user does not have Jython installed, then you will also need to copy/pase the complete "Lib" folder from the jython installation directory into whichever location you end up placing jython.jar. This enables access to the python stdlib which is not included in the standard jar file.
UPDATE:
After playing around more, I think I have a fix to enable "import *" type imports even when using the standalone jar. All that needs to be done is to enable caching!
You can do this by either adding the following options to the jvm when running jython:
-Dpython.cachedir.skip=false -Dpython.cachedir=DESIRED CACHE PATH
(Note that the second argument is optional, and if left blank, a default value will be used)
If you are having an issue running the InteractiveConsole embedded in an app (which is what my problem was) you can add these properties before initializing the console:
Properties props = new Properties();
props.put("python.cachedir.skip", "false");
props.put("python.cachedir", "DESIRED CACHE PATH"); // again, this option is optional
InteractiveConsole.initialize(System.getProperties(), props, new String[0]);
I'm using Java 1.6.0_11
No, you're using
[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.6.0_10
What happens if you delete the cachedir from the Jython distribution directory, and try again?
Also, why are you explicitly setting the classpath that way? Why not simply
java -jar jython.jar
?