I was having many problems where Google Chrome would report the wrong language to websites that I was visiting, and I would get redirected to the foreign version of the website, not in English. I thought this was due to Chrome redirecting me to a foreign version of Google, but after fixing it so that I can always use the UK version, as mentioned in a previous post, I still had the problem of getting redirected to translated versions of the website. I thought this could be due to my location, and a geographical lookup of my IP, but once I returned to England I was still getting translations of websites I was visiting.
I tried a couple of times looking at the "Local State" file, but mine looked fine, and there was no mention of any foreign versions of Google.
I found the solution in a post at this link here: https://productforums.google.com/forum/#!topic/chrome/pKJ8eBCT4ec by CaseyD
To get to the options, the steps were slightly different, I clicked the "Customise and Control Google Chrome" button - the button with three horizontal lines in the top right corner of Chrome, the clicked the "Settings" option. Then you should be on the "Settings" tab, this is also accessible by entering chrome://settings/ into the address bar. From here, scroll to the bottom and click "+ Show Advanced Settings". Then scroll to the section "Languages", and click the button "Language and Input Settings...". In this list, drag up your preferred language to the top. The topmost language takes preference. Then click "Finished." and close the settings tab.
My blog with useful code snippets and solutions to problems that I have found. Mostly software solutions in R, Python, Matlab, and also problem solving with the Raspberry Pi. Some electronics stuff might also make it in here!
Thursday, 31 December 2015
Wednesday, 30 December 2015
Connecting Python 2.7 to XAMPP MySQL Database on Windows
I installed the XAMPP package on my Windows 8.1 device, and wanted to use python 2.7 to write to the MySQL database. I found that there is the package "mysql-python" which should allow reading and writing to a MySQL DB from python, however was having problems when installing.
The error message was as follows:
I had tried to install the mysql python connector from this website: https://dev.mysql.com/downloads/connector/python/ however this didn't help. I'd found some posts saying that a file in the tar ball used by the pip install needed modifying, however installing the python connector above didn't seem to install any files in the directory as expected, so I wasn't able to update the tar ball to the directory that I needed.
I also tried updating the PATH and PYTHONPATH environmental variables with no luck.
The solution that worked for me eneded up being from this post on stackoverflow: http://stackoverflow.com/a/25445938
I downloaded the file from this website: http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python
I used the file MySQL_python-1.2.5-cp27-none-win32.whl and installed it using the following command:
This finally installed successfully, and allowed me to the use the command "import mysql.connector" for my code.
The error message was as follows:
_mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h':No such file or directoryerror: command 'C:\\Users\\re\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2----------------------------------------Command "C:\Python27\python.exe -c "import setuptools, tokenize;__file__='c:\\users\\re\\appdata\\local\\temp\\pip-build-xnlpn9\\mysql-python\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\re\appdata\local\temp\pip-1k03uu-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\re\appdata\local\temp\pip-build-xnlpn9\mysql-python
I had tried to install the mysql python connector from this website: https://dev.mysql.com/downloads/connector/python/ however this didn't help. I'd found some posts saying that a file in the tar ball used by the pip install needed modifying, however installing the python connector above didn't seem to install any files in the directory as expected, so I wasn't able to update the tar ball to the directory that I needed.
I also tried updating the PATH and PYTHONPATH environmental variables with no luck.
The solution that worked for me eneded up being from this post on stackoverflow: http://stackoverflow.com/a/25445938
I downloaded the file from this website: http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python
I used the file MySQL_python-1.2.5-cp27-none-win32.whl and installed it using the following command:
pip install C:\MySQL_python-1.2.5-cp27-none-win32.whl
This finally installed successfully, and allowed me to the use the command "import mysql.connector" for my code.
Subscribe to:
Posts (Atom)