Scrapy pipeline mysql error - scrapy

When I wrote the Scrapy\pipeline and then I tried to use scrapy crawl dmoz,
an error occured:
File "F:\Python\lib\site-packages\scrapy\utils\misc.py", line 42, in load_object
raise ImportError("Error loading object '%s': %s" % (path, e))
ImportError: Error loading object 'tutorial.pipelines.Tutorialpipeline': DLL load failed: %1 is not a valid Win32 application.
UPDATE
the problem is fixed. when I used the pip install mysql-python, it installed a 32bits version of mysql-python, I uninstalled it and download a 64bits version.
however, I met another problem, when I run the spider, it shows that:
_mysql_exceptions.ProgrammingError: (1064,"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc,pic)values ('xe4\xbe\x9b\xe5\xba.......' at line 1")
I am not sure what happened,could anybody help me figure it out?
here is how I write the mysql insert function in pipeline
def _conditional_insert(self,tx,item):
tx.execute('insert into raw(title,area,date,sclass,link,desc,pic) values (%s,%s,%s,%s,%s,%s,%s) '
(item['title'],item['area'],item['date'],item['sclass'],item['link'],item['desc'],item['pic']))

the problem is fixed. when I used the pip install mysql-python, it installed a 32bits version of mysql-python, I uninstalled it and download a 64bits version.

Related

plotnine is broken with matplotlib==3.6

I am getting the following error with plotnine==0.9 and matplotlib==3.6.
File "D:\Python\Python310\lib\site-packages\plotnine\stats\stat_density_2d.py", line 3, in <module>
import matplotlib._contour as _contour
ModuleNotFoundError: No module named 'matplotlib._contour'
If I downgrade matplotlib==3.5, the problem goes away.
It's discussed here and it's already fixed here Note that it's already merged to main.
It was due to a internal matplotlib call that is no longer supported and has been replaced.
So I guess you could choose between:
downgrade to mlp 3.5.3
install plotnine#main
till the next plotnine release.
Carlos's answer is correct. However if anybody else, like me, is uncertain of how to install plotnine#main, you can implement the fix rather easily:
Find the site_packages folder you python script uses. It usually is a subdirectory of the python version you are using, which can located reliably by trying to reinstall matplotlib or any other package you know you have access to, and checking the logs in the console. ex using python -m pip install matplotlib.
Go down into the site_packages/plotnine/stats directory and open up the stats_density_2d.py file in your editor of choice.
Apply & save the modifications made in the fix. Alternatively, overwrite the file with the one from the github.
ModuleNotFoundError: No module named 'matplotlib._contour'
Issues with matplotlib 3.6.1 and
plotnine 0.9.0
K.I.S.S.
in terminal:
pip show matplotlib #enables you to check version
pip install matplotlib==3.5 #revert and problem is resolved for now.
no more:
ModuleNotFoundError: No module named 'matplotlib._contour'
resolves issue for now that will stop progress...

Problems with php-gd in php8.1

I have php8.1 running on FreeBSD 12.
Install php81-gd and having a trouble to start php due to the following error:
Any guess how to fix it, please?
PHP Warning: PHP Startup: Unable to load dynamic library 'gd.so' (tried: /usr/local/lib/php/20210902/gd.so (/usr/local/lib/php/20210902/gd.so: Undefined symbol "gdImageCreateFromAvif"), /usr/local/lib/php/20210902/gd.so.so (Cannot open "/usr/local/lib/php/20210902/gd.so.so")) in Unknown on line 0```
You probably need to upgrade the libgd package as well with pkg upgrade libgd; for whatever reason the package manager doesn’t seem to do it automatically when you install the php81-gd package.

how to install Imagic in WAMP server?

I am getting error php_imagick.dll is not working. %1 is not a valid W32 application.
I am using WAMP Server Apaches 2.4.4.6 and PHP 7.4.9. my OS is windows 10 64bit. i think i download php_imagick-3.6.0rc2-7.3-nts-vc15-x64.zip file.
I have installed all DDL file in PHP7.4.9/ext/ and apply all process for install Imagic but still i am getting error
i have add extension in php.ini file.
enter image description here
Warning: PHP Startup: Unable to load dynamic library 'php_imagick' (tried: d:/wamp/bin/php/php7.4.9/ext/php_imagick (%1 is not a valid Win32 application.), d:/wamp/bin/php/php7.4.9/ext/php_php_imagick.dll (The specified module could not be found.)) in Unknown on line 0
i tried to find required file and package form
https://windows.php.net/downloads/pecl/releases/imagick/3.6.0rc2/ also checked
https://www.apachelounge.com/viewtopic.php?t=6359
but nothing helpful for me. that Module is not loading..
please help me....
check that the dll is not blocked:
try downloading the imagick threadsafe for here, version made for your PHP version
also install it from here on top of it all

Missing package to enable rendering OpenAI Gym in Colab

I'm attempting to render OpenAI Gym environments in Colab via a Mac using the StarAI code referenced in previous questions on this topic. However, it fails. The key error (at least the first error) is shown in full below, but the import part seems to be "Please install xdpyinfo!"
PyPI doesn't have xdpyinfo. What is it and how do I install it?
Full error message:
482780428160 abstractdisplay.py:151] xdpyinfo was not found, X start can not be checked! Please install xdpyinfo!
I've seen the same error, and solved it by installing x11-utils package which includes xdpyinfo command.
!apt-get install x11-utils

tclmagick load error

I try to call in a Tcl script:
load tclmagick.dll
and get
couldn't load library "TclMagick.dll": invalid argument
I've tried the Dependency Walker, which tells me that the msvcrt.exe doesn't export a function named "__adjust_fdiv". However, I have no clue how to fix that. Any advice?
OS: Windows 7, 64bit
packages: TclMagick and ImageMagick