I used mysqldump to export the db in the old system and imported the 
database to the new system afterwards, but now I am getting this error 
message in Trac:

*Unable to get database connection within 0 seconds. (AttributeError: 
'NoneType' object has no attribute 'connect')*



Jun Omae schrieb am Donnerstag, 18. März 2021 um 11:04:00 UTC+1:

> trac-migrate.py isn't needed for your case. Instead, use mysqldump.
>
> On Thu, Mar 18, 2021 at 6:42 PM Andreas <muffe...@gmail.com> wrote:
> >
> > I finally found the solution to install MySQL-python here, but I do have 
> another problem now while running the migration script...I guess it doesn't 
> have to do with the migration script as I tried to migrate in Ubuntu 18.04 
> (without any errors), exported the MariaDB-database, imported the database 
> in Ubuntu 20.04, changed the connection string in trac.ini to mysql and I 
> am getting the following error in the Trac Logfile:
> >
> > 2021-03-18 10:16:31,836 Trac[main] ERROR: can't retrieve session: 
> TimeoutError: Unable to get database connection within 0 seconds. 
> (AttributeError: 'NoneType' object has no attribute 'connect')
> >
> > Additionally, I am getting the following warnings in the Browser:
> >
> > Warning:
> >
> > Error with navigation contributor "PreferencesModule"
> > Error with navigation contributor "BrowserModule"
> >
> >
> >
> > Does anyone have an idea of what could be wrong? Maybe just a permission 
> issue somewhere?
> > I am thankful for every kind of hint!
> >
> > Thanks!
> >
> >
> >
> > Migration script error:
> >
> > ./trac-migrate.py --in-place /var/lib/trac/visicon 
> mysql://tracuser:password@localhost/trac_migrate
> > Traceback (most recent call last):
> > File "./trac-migrate.py", line 55, in <module>
> > sys.exit(main(sys.argv[1:]) or 0)
> > File "./trac-migrate.py", line 45, in main
> > if env.needs_upgrade():
> > File "/usr/local/lib/python2.7/dist-packages/trac/env.py", line 806, in 
> needs_upgrade
> > for participant in self.setup_participants:
> > File "/usr/local/lib/python2.7/dist-packages/trac/core.py", line 95, in 
> extensions
> > components = [component.compmgr[cls] for cls in classes]
> > File "/usr/local/lib/python2.7/dist-packages/trac/core.py", line 238, in 
> __getitem__
> > component = cls(self)
> > File "/usr/local/lib/python2.7/dist-packages/trac/core.py", line 157, in 
> __call__
> > self.__init__()
> > File "build/bdist.linux-x86_64/egg/trachours/db.py", line 45, in __init__
> > File "build/bdist.linux-x86_64/egg/trachours/db.py", line 104, in version
> > File "/usr/local/lib/python2.7/dist-packages/trac/db/api.py", line 121, 
> in execute
> > with self as db:
> > File "/usr/local/lib/python2.7/dist-packages/trac/db/api.py", line 174, 
> in __enter__
> > db = self.dbmgr.get_connection(readonly=True)
> > File "/usr/local/lib/python2.7/dist-packages/trac/db/api.py", line 465, 
> in get_connection
> > db = self._cnx_pool.get_cnx(self.timeout or None)
> > File "/usr/local/lib/python2.7/dist-packages/trac/db/pool.py", line 214, 
> in get_cnx
> > return _backend.get_cnx(self._connector, self._kwargs, timeout)
> > File "/usr/local/lib/python2.7/dist-packages/trac/db/pool.py", line 135, 
> in get_cnx
> > raise TimeoutError(errmsg)
> > trac.db.pool.TimeoutError: Unable to get database connection within 0 
> seconds. (AttributeError: 'NoneType' object has no attribute 'connect')
> >
> >
> >
> > Andreas schrieb am Donnerstag, 18. März 2021 um 07:14:34 UTC+1:
> >>
> >> Hey Ryan,
> >>
> >> I just tried this, but I'm still getting the same error...
> >> Any other idea?
> >>
> >> Thank you!
> >>
> >>
> >> (env) root@andreas-VirtualBox:/home/andreas/env# pip install 
> MySQL-python
> >>
> >> DEPRECATION: Python 2.7 reached the end of its life on January 1st, 
> 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 
> 21.0 will drop support for Python 2.7 in January 2021. More details about 
> Python 2 support in pip can be found at 
> https://pip.pypa.io/en/latest/development/release-process/#python-2-support 
> pip 21.0 will remove support for this functionality.
> >> Collecting MySQL-python
> >> Using cached MySQL-python-1.2.5.zip (108 kB)
> >> Building wheels for collected packages: MySQL-python
> >> Building wheel for MySQL-python (setup.py) ... error
> >> ERROR: Command errored out with exit status 1:
> >> command: /home/andreas/env/bin/python -u -c 'import sys, setuptools, 
> tokenize; sys.argv[0] = 
> '"'"'/tmp/pip-install-feS5dG/mysql-python/setup.py'"'"'; 
> __file__='"'"'/tmp/pip-install-feS5dG/mysql-python/setup.py'"'"';f=getattr(tokenize,
>  
> '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', 
> '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' 
> bdist_wheel -d /tmp/pip-wheel-vt99l4
> >> cwd: /tmp/pip-install-feS5dG/mysql-python/
> >>
> >> Complete output (30 lines):
> >> running bdist_wheel
> >> running build
> >> running build_py
> >> creating build
> >> creating build/lib.linux-x86_64-2.7
> >> copying _mysql_exceptions.py -> build/lib.linux-x86_64-2.7
> >> creating build/lib.linux-x86_64-2.7/MySQLdb
> >> copying MySQLdb/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb
> >> copying MySQLdb/converters.py -> build/lib.linux-x86_64-2.7/MySQLdb
> >> copying MySQLdb/connections.py -> build/lib.linux-x86_64-2.7/MySQLdb
> >> copying MySQLdb/cursors.py -> build/lib.linux-x86_64-2.7/MySQLdb
> >> copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
> >> copying MySQLdb/times.py -> build/lib.linux-x86_64-2.7/MySQLdb
> >> creating build/lib.linux-x86_64-2.7/MySQLdb/constants
> >> copying MySQLdb/constants/__init__.py -> 
> build/lib.linux-x86_64-2.7/MySQLdb/constants
> >> copying MySQLdb/constants/CR.py -> 
> build/lib.linux-x86_64-2.7/MySQLdb/constants
> >> copying MySQLdb/constants/FIELD_TYPE.py -> 
> build/lib.linux-x86_64-2.7/MySQLdb/constants
> >> copying MySQLdb/constants/ER.py -> 
> build/lib.linux-x86_64-2.7/MySQLdb/constants
> >> copying MySQLdb/constants/FLAG.py -> 
> build/lib.linux-x86_64-2.7/MySQLdb/constants
> >> copying MySQLdb/constants/REFRESH.py -> 
> build/lib.linux-x86_64-2.7/MySQLdb/constants
> >> copying MySQLdb/constants/CLIENT.py -> 
> build/lib.linux-x86_64-2.7/MySQLdb/constants
> >> running build_ext
> >> building '_mysql' extension
> >> creating build/temp.linux-x86_64-2.7
> >> x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -Wdate-time 
> -D_FORTIFY_SOURCE=2 -g 
> -fdebug-prefix-map=/build/python2.7-QDqKfA/python2.7-2.7.18=. 
> -fstack-protector-strong -Wformat -Werror=format-security -fPIC 
> -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql 
> -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o
> >> _mysql.c:44:10: fatal error: my_config.h: No such file or directory
> >> 44 | #include "my_config.h"
> >> | ^~~~~~~~~~~~~
> >>
> >> compilation terminated.
> >> error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
> >> ----------------------------------------
> >> ERROR: Failed building wheel for MySQL-python
> >> Running setup.py clean for MySQL-python
> >> Failed to build MySQL-python
> >> Installing collected packages: MySQL-python
> >> Running setup.py install for MySQL-python ... error
> >> ERROR: Command errored out with exit status 1:
> >> command: /home/andreas/env/bin/python -u -c 'import sys, setuptools, 
> tokenize; sys.argv[0] = 
> '"'"'/tmp/pip-install-feS5dG/mysql-python/setup.py'"'"'; 
> __file__='"'"'/tmp/pip-install-feS5dG/mysql-python/setup.py'"'"';f=getattr(tokenize,
>  
> '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', 
> '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' 
> install --record /tmp/pip-record-NNfKPd/install-record.txt 
> --single-version-externally-managed --compile --install-headers 
> /home/andreas/env/include/site/python2.7/MySQL-python
> >> cwd: /tmp/pip-install-feS5dG/mysql-python/
> >>
> >> Complete output (30 lines):
> >> running install
> >> running build
> >> running build_py
> >> creating build
> >> creating build/lib.linux-x86_64-2.7
> >> copying _mysql_exceptions.py -> build/lib.linux-x86_64-2.7
> >> creating build/lib.linux-x86_64-2.7/MySQLdb
> >> copying MySQLdb/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb
> >> copying MySQLdb/converters.py -> build/lib.linux-x86_64-2.7/MySQLdb
> >> copying MySQLdb/connections.py -> build/lib.linux-x86_64-2.7/MySQLdb
> >> copying MySQLdb/cursors.py -> build/lib.linux-x86_64-2.7/MySQLdb
> >> copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
> >> copying MySQLdb/times.py -> build/lib.linux-x86_64-2.7/MySQLdb
> >> creating build/lib.linux-x86_64-2.7/MySQLdb/constants
> >> copying MySQLdb/constants/__init__.py -> 
> build/lib.linux-x86_64-2.7/MySQLdb/constants
> >> copying MySQLdb/constants/CR.py -> 
> build/lib.linux-x86_64-2.7/MySQLdb/constants
> >> copying MySQLdb/constants/FIELD_TYPE.py -> 
> build/lib.linux-x86_64-2.7/MySQLdb/constants
> >> copying MySQLdb/constants/ER.py -> 
> build/lib.linux-x86_64-2.7/MySQLdb/constants
> >> copying MySQLdb/constants/FLAG.py -> 
> build/lib.linux-x86_64-2.7/MySQLdb/constants
> >> copying MySQLdb/constants/REFRESH.py -> 
> build/lib.linux-x86_64-2.7/MySQLdb/constants
> >> copying MySQLdb/constants/CLIENT.py -> 
> build/lib.linux-x86_64-2.7/MySQLdb/constants
> >> running build_ext
> >> building '_mysql' extension
> >> creating build/temp.linux-x86_64-2.7
> >> x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -Wdate-time 
> -D_FORTIFY_SOURCE=2 -g 
> -fdebug-prefix-map=/build/python2.7-QDqKfA/python2.7-2.7.18=. 
> -fstack-protector-strong -Wformat -Werror=format-security -fPIC 
> -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql 
> -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o
> >> _mysql.c:44:10: fatal error: my_config.h: No such file or directory
> >> 44 | #include "my_config.h"
> >> | ^~~~~~~~~~~~~
> >>
> >> compilation terminated.
> >> error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
> >> ----------------------------------------
> >> ERROR: Command errored out with exit status 1: 
> /home/andreas/env/bin/python -u -c 'import sys, setuptools, tokenize; 
> sys.argv[0] = '"'"'/tmp/pip-install-feS5dG/mysql-python/setup.py'"'"'; 
> __file__='"'"'/tmp/pip-install-feS5dG/mysql-python/setup.py'"'"';f=getattr(tokenize,
>  
> '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', 
> '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' 
> install --record /tmp/pip-record-NNfKPd/install-record.txt 
> --single-version-externally-managed --compile --install-headers 
> /home/andreas/env/include/site/python2.7/MySQL-python Check the logs for 
> full command output.
> >>
> >>
> >> RjOllos schrieb am Mittwoch, 17. März 2021 um 17:27:03 UTC+1:
> >>>
> >>> On Wed, Mar 17, 2021 at 9:14 AM Andreas <muffe...@gmail.com> wrote:
> >>>>
> >>>> Hello again,
> >>>>
> >>>> I do now really have to migrate our database to MariaDB as we have to 
> access Trac from another system to read and write data to it.
> >>>>
> >>>> As the pip-installation is not working anymore, I found a way to 
> install python-mysqldb (is this even the right package?!) on Ubuntu 20.04 
> by adding an older repository to my installation with the following 
> commands:
> >>>>
> >>>> sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu bionic 
> main'
> >>>> sudo apt update
> >>>> sudo apt install -y python-mysqldb
> >>>>
> >>>> Source:
> >>>> 
> https://stackoverflow.com/questions/63457213/how-to-install-python-mysqldb-for-python-2-7-in-ubuntu-20-04-focal-fossa
> >>>>
> >>>> ... but I am still getting the error during Trac migration that says 
> "trac.core.TracError: Unsupported database type "mysql".
> >>>> Any idea of what coul be wrong / how to install the right package on 
> Ubuntu 20.04?
> >>>>
> >>>> As long as the TracHoursPlugin is not working on Trac 1.4.2, I really 
> need to find a way to migrate the older 1.2.2 to MySQL on Ubuntu 20.04...
> >>>>
> >>>> Thanks for any hints!!
> >>>
> >>>
> >>> I would create a virtualenv and "pip install mysql-python".
> >>> https://pypi.org/project/MySQL-python/
> >
> > --
> > You received this message because you are subscribed to the Google 
> Groups "Trac Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to trac-users+...@googlegroups.com.
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/trac-users/79d7dcad-eabf-4563-bbbb-0c1b6590dd7fn%40googlegroups.com
> .
>
>
>
> -- 
> Jun Omae <jun...@gmail.com> (大前 潤)
>

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/trac-users/6b4951bd-f241-4609-815c-9053d24bf8f5n%40googlegroups.com.

Reply via email to