How to install MySQLDb adaptor in zope? - zope

I am trying to install MySQLDB adaptor in zope. I have a mac book pro with snow leopard. I have downloaded the "MySQL-python-1.2.0.
from: http://old.zope.org/Members/adustman/Products/MySQLdb/
I extracted the file in /usr/local/zope/lib/python/products
and then I changed directory to it:
cd MySQL-python-1.2.0
And I typed:
sudo /Users/dkar/Desktop/zope/bin/python setup.py build
sudo /User/dkar/Desktop/zope/bin/python setup.py install
I get this error:
Traceback (most recent call last):
File "setup.py", line 34, in ?
mysqlstatic = eval(os.getenv('mysqlstatic', 'False'))
File "<string>", line 0, in ?
NameError: name 'False' is not defined
I see the lines 0 and 34 in the setup.py but I don't know what should I do. Any suggestions what to do? I am new in these things and I don't have any idea how to solve this issue.
Please let me know if you don't understand some part and I will try to explain it better!

Environment that was used:
Debian 2.6.32-5-amd64
Plone 4.3.10
MySQL Server 5.1.49-3
Python-MySQL 1.2.3
ZMySQLDA
Step by step...
Install Plone
Install MySQL, in this exemple I install using apt-get install mysql-server
Install another dependecies apt-get install libmysqlclient-dev
Edit base.cfg or buildout.cfg in eggs add:
eggs =
MySQL_python
In buildout.cfg at the bottom add:
[zmysqlda]
recipe = collective.recipe.zmysqlda
target = ${buildout:directory}/products
run buildout bin/buildout -v
edit DABase.py at the line 92 and the file DA.py line 96
Where have: from ImageFile import ImageFile
Change to: from App.ImageFile import ImageFile
create a folder that the script request:
mkdir -p /{buildout_folder}/buildout-cache/eggs/Zope2-2.13.12-py2.6.egg/Shared/DC/ZRDB/www
Put the icon that don't exist in the folder
wget http://old.zope.org/Documentation/Guides/ZSQL-HTML/DBAdapterFolder_icon.gif
run buildout again.
In zope interface management add Z MySQL database connection
Enter Database conection string:
I hope help yoU!
I extract this cookbook from my post here: http://julianoaraujo.objectis.net/blog/pzp/400320287, it's in Brazilian Portuguese.

I don't know what causes the strange error you get so I'm not sure if my answer will help you. I also had trouble installing mySQLdb. I found out that mysql has to be installed on your system, even if you do not intend to use it with mySQLdb (maybe you just want to use it with a remote connection).
Before building and installing, you have to edit site.cfg and set the path to your mysql_config (which on my mac is: /usr/local/mysql/bin/mysql_config). Then make a symlink, so that your mysql client will be found:
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
Hope that helps :)

Related

Crontab, Systemd.timer module import problem, Pyperclip could not find a copy/paste mechanism for your system

everyone i'm using oracle arm/amd processor servers with ubuntu 22.04
i have searching for an solution for this over 1 week more than 100 hours
but i had no luck to figure out what is the problem
so if you know about this please help me!
what is problem :
here's a simply code with pyperclip
import pyperclip
string = 'testing'
pyperclip.copy(string)
a = pyperclip.paste()
print()
whenever i execute this code directly in the cli , it is okay to run
However whenever i run this code with schedulers like Crontab or Systemd.timer
(xclip && xsel is already installed)
i got this error and cannot run the code like below
Traceback (most recent call last):
File "/home/ubuntu/web_selenium/pytest.py", line 10, in <module>
pyperclip.copy(string)
File "/usr/lib/python3/dist-packages/pyperclip/__init__.py", line 689, in lazy_load_stub_copy
return copy(text)
File "/usr/lib/python3/dist-packages/pyperclip/__init__.py", line 358, in __call__
raise PyperclipException(EXCEPT_MSG)
pyperclip.PyperclipException:
Pyperclip could not find a copy/paste mechanism for your system.
For more information, please visit https://pyperclip.readthedocs.io/en/latest/index.html#not-implemented-error
i tried most of solutions in stackoverflow, mostly it was about setting path for interpreter and packages
of course i installed xclip and xsel as well / everything is good when i run code directly through cli
but only when i run code or shell script through Crontab , Systemd.timer, this error is generated
what i have tried
1. run pyperclip code through shell script with various python env PATH
i tried to lay all the possible env path like /usr/bin:/usr/local/bin .......
and even my python pakages path as .profile and ~./bashrc - failed
2. set new venv and install all the modules, run code - failed
3. run crontab as root - failed
4. install new ubuntu and switch server ubuntu amd -> ubuntu aarch64 - failed
5. reinstall module - failed
6. set shebang inside of python script ( whereis python3 - inside of python file - #!/usr/bin/python3.10) - failed
7. set shell into crontab (SHELL=/bin/bash) - failed
now i'm thinking this is the problem of pyperclip
pleaese help me!

Redis ERR unknown command 'BZPOPMIN'

I installed Redis version 4.0.9 in a Ubuntu Linux Subsystem on Windows 10 by following these instructions (i.e. sudo apt-get install redis-server).
I am following this tutorial on Django channels, and I ran the following code:
>>> import channels.layers
>>> channel_layer = channels.layers.get_channel_layer()
>>> from asgiref.sync import async_to_sync
>>> async_to_sync(channel_layer.send)('test_channel', {'type': 'hello'})
>>> async_to_sync(channel_layer.receive)('test_channel')
When the last line above is executed, I get this error:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Users\xyz\Anaconda3\envs\django\lib\site-packages\asgiref\sync.py", line 120, in __call__
return call_result.result()
File "C:\Users\xyz\Anaconda3\envs\django\lib\concurrent\futures\_base.py", line 425, in result
return self.__get_result()
File "C:\Users\xyz\Anaconda3\envs\django\lib\concurrent\futures\_base.py", line 384, in __get_result
raise self._exception
File "C:\Users\xyz\Anaconda3\envs\django\lib\site-packages\asgiref\sync.py", line 180, in main_wrap
result = await self.awaitable(*args, **kwargs)
File "C:\Users\xyz\Anaconda3\envs\django\lib\site-packages\channels_redis\core.py", line 485, in receive
return (await self.receive_single(channel))[1]
File "C:\Users\xyz\Anaconda3\envs\django\lib\site-packages\channels_redis\core.py", line 508, in receive_single
index, channel_key, timeout=self.brpop_timeout
File "C:\Users\xyz\Anaconda3\envs\django\lib\site-packages\channels_redis\core.py", line 345, in _brpop_with_clean
result = await connection.bzpopmin(channel, timeout=timeout)
aioredis.errors.ReplyError: ERR unknown command 'BZPOPMIN'
On this page, someone suggested using Redis version 5. How do I install Redis version 5 on Windows 10? Any other ideas on how to solve this issue?
I think the problem is in the compatibility with version of the channels-redis package! I had already tested channels some time ago and it worked beautifully with channels-redis version 2.4.2, recently they are in version 3.0.1 and this version doesn't work properly yet I don't know why.
Try install the version 2.4.2 with pip:
pip install channels-redis==2.4.2
Use redis 5.0.9. It worked for for the same error.
Get it from github.com/tporadowski/redis/releases
There is no official support for Redis in Windows OS.
However, Microsoft develops and maintains microsoftarchive/redis. Also it is no longer supported (older versions are availble). I had long search on this about installing version 5 in windows 10. But no luck.
Better you can go for Memurai. Memurai is 100% compatible with the Redis protocol (also supported version 5 too). It is free for development and testing.
EDIT : From Itamar comment, u can also use this as alternative for Memurai
Just download the latest version of Redis for Windows https://github.com/tporadowski/redis/releases from here it will work.
you don't need to downgrade the version of your channels-redis etc. This problem with Redis not with any python packages at all.
You need to install the latest version(6+) of redis:
$ sudo add-apt-repository ppa:redislabs/redis
$ sudo apt-get update
$ sudo apt-get install redis
then restart the redis-server.
This is how i resolve this issue.
Ubuntu 18 installs redis 4 but ubuntu 20 installs redis 5. You can find your redis version by typing redis-cli -v. So i uninstall ubuntu 18 from my windows subsystem for linux (WSL) and reinstall ubuntu 20. It worked just fine.
Same problem on Ubuntu 16.04
Similarly, I was following the chat application tutorial on Django Channels website and had the same error:
aioredis.errors.ReplyError: ERR unknown command 'BZPOPMIN'
The problem occurred when I used these versions:
redis-server==3.0.6
channels==3.0.3
channels-redis==3.2.0
Thanks to #marvin-correia for his answer I figured out the problem's reason is the version of the channels-redis package! So as he suggested, I installed channel-redis version 2.4.2 and the error has gone.
pip install channels-redis==2.4.2
Also, I've to note that channels package downgraded to channels==2.4.0 automatically.
Problem is with the version.
Try older one
I found "2,3,4" any version with it stable and properly working.
https://github.com/tporadowski/redis/releases
To add to #Marvin answer, for me it was similar (some versioning problem probably), I reinstalled django_channels and django to the exact version as specified in the tutorial (3.0, 2.2) and it worked. Not sure what exactly worked but recommend checking it:)
I will also confirm Marvins answer. Hopefully this will help someone out but also leaving this here for notes.
Development:
(this setup works) considering data is sent to and form http://localhost:8000
Setup
Windows 10 Running WSL with Ubuntu 20.04
Python==3.10
Django==4.0
Redis==5.0.7
channels-redis==3.3.1
Production
setup
Python==3.8
Ubuntu==16.04
Redis-server==3.0.6
chanels-redis==2.4.2
channels==3.0.3
When I downgraded, channels-redis, it automcatically downgraded channels as well. Then you can force the upgrade to channels==3.0.3, but it will raise an incompatibility error. Also, if 2 files will most likely to be updated to run Django 4.0
1 being here
https://github.com/django/channels/issues/1609
I was getting this error on a Windows machine, I would suggest you to use Redis on a docker image instead of using Redis server on a windows machine.
One of the way to run a redis server via a docker image and map the port 6379 is to:
start docker desktop
In your terminal type the below command.
docker run -p 6379:6379 -d redis:5

SOLVED - Ubuntu 18.04 setting up virtualenvwrapper, python 3.8

Original question:
I am installing virtualenvwrapper on Ubuntu 18.04. Here is what I have tried so far:
From https://virtualenvwrapper.readthedocs.io/en/latest/#:~:text=virtualenvwrapper%20is%20a%20set%20of,introducing%20conflicts%20in%20their%20dependencies:
$ pip install virtualenvwrapper
...
$ export WORKON_HOME=~/Envs
$ mkdir -p $WORKON_HOME
$ source /usr/local/bin/virtualenvwrapper.sh
Error: bash: /usr/local/bin/virtualenvwrapper.sh: No such file or directory
Ok, so I went looking for virtualenvwrapper.sh. Eventually I found it:
joanna#joanna-X441BA:~/.local/bin$ ls
...
virtualenv-clone
virtualenvwrapper_lazy.sh
virtualenvwrapper.sh
...
Tried again with the new path: joanna#joanna-X441BA:/$ source /home/.local/bin/virtualenvwrapper.sh
bash: /home/.local/bin/virtualenvwrapper.sh: No such file or directory
Agh, ok. Searched StackOverflow, followed the instructions in Issue installing Virtualenvwrapper on Ubuntu 18.04?:
export WORKON_HOME=$HOME/.virtualenv
export VIRTUALENVWRAPPER_LOG_DIR="$WORKON_HOME"
export VIRTUALENVWRAPPER_HOOK_DIR="$WORKON_HOME"
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
I checked that this is in fact where my python3 installation lives. Same result though - No such file or directory.
Also tried sudo apt-get update and it successfully updated a bunch of stuff. But still No such file or directory.
Following this article, I also tried
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
(with the paths corrected for my filesystem setup.)
I don't understand why Bash is saying "No such file or directory" when it is in fact there (inexact error message that could be improved?), or more importantly how to fix this problem.
Note: This article warns me not to use sudo with pip because "If you think you need to use sudo, you're probably trying to modify a distribution-owned file", which is apparently Very Bad. I have also seen several articles warning that I should really use python -m pip install (or python3 -m pip install?) instead of plain pip install, because plain pip install can cause unintended side effects. I am not an expert by any means in these matters, but avoiding side effects sounds good to me.
Solution:
I finally got it to work! I kept playing around with it and double-checking that all the paths were correct and I did everything in the right order. I also had a stray installation of Python 3.8 that it seems I had installed in one of my folders that I use for code (my understanding is that Python installations should automatically go into one of the root folders like /usr/bin). On advice from my mentor I used the file manager to delete the stray Python 3.8, which may have helped with the virtualenvwrapper problem. After deleting the stray Python 3.8 I ran these commands and it finally worked!!!!
export WORKON_HOME=$HOME/.virtualenv
export VIRTUALENVWRAPPER_LOG_DIR="$WORKON_HOME"
export VIRTUALENVWRAPPER_HOOK_DIR="$WORKON_HOME"
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
source ~/.local/bin/virtualenvwrapper.sh
My advice to readers of this question who are stumped with similar problems: triple-check the paths you are using by cd-ing into the folders, and also check for spelling errors in what you are typing. Your computer's file system may be set up slightly different from mine so don't blindly copy-paste the file paths I used. This will save you a lot of time and frustration. Also note that the file location of ~ is NOT the same as /home, that's one mistake I made.

Can't install nautilus-dropbox on Centos 8

I try to install dropbox on Centos8, however Terminal gives strange errors. Tried different commands, same error.
Firstly downloaded *.rpm file from dropbox website, currently trying to install it.
Commands I tried:
rpm -ivh nautilus-dropbox-2020.03.04-1.fedora.x86_64.rpm
yum localinstall nautilus-dropbox-2020.03.04-1.fedora.x86_64.rpm
Error:
Last metadata expiration check: 0:18:27 ago on Thu 12 Mar 2020 03:46:17 PM EET
Error:
Problem: conflicting requests
nothing provides libgnome >= %{gnome_version} needed by nautilus-dropbox-2020.03.04-1.fc21.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
[root#localhost Downloads]
Also tried --skip-broken and --nobest - but no luck.
Also tried sudo yum install libgnome but it gives error:
Last metadata expiration check: 9:51:39 ago on Thu 12 Mar 2020 02:42:06 PM UTC.
No match for argument: libgnome
Error: Unable to find a match: libgnome
I have:
[adminuser#localhost ~]$ cat /etc/centos-release
CentOS Linux release 8.1.1911 (Core)
Tried to google this mistake, but no luck. Could you please give me any hint how I could overcome this?
Thank you
This is a bug in packaging. Contact Dropbox support and report it as a bug.
Technical details (just in case you are Dropbox employee):
During building rpm, when you use macro then it is expanded. Try yoursel:
$ rpm --eval '%{_bindir}'
/usr/bin
However, when the macro is not defined, you get original value:
$ rpm --eval '%{some_bullshit}'
%{some_bullshit}
So the macro gnome_version should likely contain some version, but this macro was not defined.
nothing provides libgnome
"libgnome" is about libgnome-2 → https://linux.dropbox.com/fedora/ → I.e. Fedora only packages. CentOS 8 has no libgnome* available.
https://www.dropbox.com/install-linux → Compile from source → CentOS 8
# dnf install nautilus-devel-3.28.1-10.el8.x86_64 python3-docutils
tar xvf nautilus-dropbox-2020.03.04.tar.bz2
cd nautilus-dropbox-2020.03.04/
./configure && make
# make install
Result : nautilus-dropbox-2020.03.04-1.el8.x86_64.rpm https://drive.google.com/file/d/1AcxlVdbWOzQvcoVOFYCiaVny9MzgC-Ea/view?usp=sharing
# rpm -Uvh nautilus-dropbox-2020.03.04-1.el8.x86_64.rpm : No issues.
First, realize that the command showing at the install page is for the headless installation. It will probably work, but my preference is to use Dropbox with nautilus integration.
This instructions assumes a installation of Dropbox with Nautilus integration.
We need to compile the installer from source.
a. Download last package
wget https://linux.dropbox.com/packages/nautilus-dropbox-2020.03.04.tar.bz2
b. Extract tarball
tar xjf ./nautilus-dropbox-2020.03.04.tar.bz2
c. Try to compile
cd nautilus-dropbox-2020.03.04; ./configure;
Then you get an Error:
Erro:
Problema: conflicting requests
- nothing provides libgnome >= %{gnome_version} needed by nautilus-dropbox-2020.03.04-1.fc21.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
Now we need to install nautilus-devel and python3-docutils
NOTE: You will get configure: error: couldn't find docutils if forget python3-docutils.
This command will enable the PowerTools repository and install what is needed:
dnf --enablerepo=PowerTools install nautilus-devel python3-docutils
Now you can run ./configure && sudo make install
That's it. Go for the start menu type "Dropbox", it will start the installer.
Restore a local backup of Dropbox (optional)
If you have a local backup, turn of the network after you see the Dropbox folder created. Then copy all your files to that folder and turn it on after copy.
This solution worked for me running CentOS Linux release 8.2.2004 (Core).

install memcache onfedora linux OS

I installed memcache in the following way:
1) yum install memcached
2) yum install php-pecl-memcached
3) Also enabled the 'memcached.so' in php.ini
I tested the memcached in the follwing way:
$mc = new Memcache;
$mc->addServer('localhost', 11211);
echo "Server's version: " . $mc->getVersion() ;
But it generates the following error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/memcached.so' - /usr/lib64/php/modules/memcached.so: undefined symbol: php_json_encode in Unknown on line 0
PHP Fatal error: Class 'Memcache' not found in /root/memcacheTest.php on line 2
Thank u.
I don't know PHP well (or at all), but from the error message I'll hazzard a guess that you do not have the PHP JSON extension installed, which is apparently needed by the memchached extension.
Apparently, the JSON extension has been in PHP since version 5.2.0, therefore:
You have an older version and you need to upgrade or install the JSON extension yourself
or
Your operating system distributor supplies the PHP JSON extension in a different package that you have not installed.
There is of course the possibility of a misconfiguration, but I think it's slightly less likely.
This showed memcached.so didn't loaded successfully.
Error shows the reason: json.so should be load before memcached.so
Please use php -m | grep memcached to check whether memcached.so is loaded successfully.
If show memcached, this mean it succeeded.
If show like PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/memcached.so' - /usr/lib64/php/modules/memcached.so: undefined symbol: php_json_decode_ex in Unknown on line 0
Here is the solusion:
e.g your php.ini is /etc/php.ini, your php.d is /etc/php.d/
Solution 1
comment 'memcached.so' in php.ini
vim /etc/php.d/memcached.ini
add extension=memcached.so in /memcached.ini
php -m | grep memcached check whether memcached is succeed loaded
Solution 2
rm /etc/php.d/json.ini
add extension=json.so in php.in before extension=memcached.so
php -m | grep memcached check whether memcached is succeed loaded
Can you check and double check user permissions? Additionally, my experience with PHP is that the distribution repository versions of PHP aren't very good. I solved those symbol errors by compiling PHP from the ground up. But that's a very radical and time-consuming solution.
http://pecl.php.net/bugs/bug.php?id=17574&edit=1
Just make sure that extension=json.so is specified BEFORE
extension=memcached.so.
I had placed extension=memcached.so in php.ini, and extension=json.so
was specified in /etc/php.d/json.ini, that is parsed AFTER php.ini.
That is why PHP can't find php_json_encode() at the point of loading
memcached.so.
Also, check that the permissions on memcached.so are the same as the other extensions
Try to install the version 2.0. It helped for me.
yum -y install gcc-c++
wget http://launchpad.net/libmemcached/1.0/0.50/+download/libmemcached-0.50.tar.gz
tar xzf libmemcached-0.50.tar.gz
cd libmemcached-0.50
./configure
make
make install
wget http://pecl.php.net/get/memcached-2.0.0b2.tgz
pecl install memcached-2.0.0b2.tgz
echo 'extension=memcached.so' > /etc/php.d/memcached.ini
service php-fpm restart
cd ..
rm -r libmemcached-0.50*
rm -r memcached-