error in using pattern.db - python

I use pattern.db module from pattern-2.5 in python to make a database, but when i run it, there is a message:
Traceback (most recent call last):
File "cobadb.py", line 25, in <module>
db = Database('my_stuff')
File "/usr/local/lib/python2.7/dist-packages/pattern/db/__init__.py", line 381, in __init__
_import_db(type)
File "/usr/local/lib/python2.7/dist-packages/pattern/db/__init__.py", line 54, in _import_db
import pysqlite2.dbapi2 as sqlite
ImportError: No module named pysqlite2.dbapi2

As is quite clear from the message, you need to install pysqlite2.

Related

Cannot able to run cqlsh due to python attribute error

Cannot able to execute the command cqlsh in mac m1 based system.
% bin/cqlsh
Traceback (most recent call last):
File "/Users/avinashkasukurthi/devtools/apache-cassandra-4.0.7/bin/cqlsh.py", line 159, in <module>
from cqlshlib import cql3handling, cqlhandling, pylexotron, sslhandling, cqlshhandling
File "/Users/avinashkasukurthi/devtools/apache-cassandra-4.0.7/bin/../pylib/cqlshlib/cql3handling.py", line 19, in <module>
from cqlshlib.cqlhandling import CqlParsingRuleSet, Hint
File "/Users/avinashkasukurthi/devtools/apache-cassandra-4.0.7/bin/../pylib/cqlshlib/cqlhandling.py", line 23, in <module>
from cqlshlib import pylexotron, util
File "/Users/avinashkasukurthi/devtools/apache-cassandra-4.0.7/bin/../pylib/cqlshlib/pylexotron.py", line 342, in <module>
class ParsingRuleSet:
File "/Users/avinashkasukurthi/devtools/apache-cassandra-4.0.7/bin/../pylib/cqlshlib/pylexotron.py", line 343, in ParsingRuleSet
RuleSpecScanner = SaferScanner([
^^^^^^^^^^^^^^
File "/Users/avinashkasukurthi/devtools/apache-cassandra-4.0.7/bin/../pylib/cqlshlib/saferscanner.py", line 91, in __init__
s = re.sre_parse.State()
^^^^^^^^^^^^
AttributeError: module 're' has no attribute 'sre_parse'
Looks like there may have been a breaking change introduced to Python's synchronized regex engine (SRE) with Python 3.11. I have created a ticket for this on the Cassandra project (CASSANDRA-18088).
In the interim, downgrade your local Python to 3.10, and you should be fine.

Keep getting ModuleNotFoundError: No module named 'lib.cogs' error when trying to run my bot on an ubuntu server

Is this a code error, or something i forgot to install? Please help thank you!
Exact error:
Traceback (most recent call last):
File "launcher.py", line 5, in <module>
bot.run(VERSION)
File "/root/doob/lib/bot/__init__.py", line 61, in run
self.setup()
File "/root/doob/lib/bot/__init__.py", line 47, in setup
self.load_extension(f"lib.cogs.{cog}")
File "/usr/local/lib/python3.8/dist-packages/discord/ext/commands/bot.py", line 660, in load_extension
spec = importlib.util.find_spec(name)
File "/usr/lib/python3.8/importlib/util.py", line 94, in find_spec
parent = __import__(parent_name, fromlist=['__path__'])
ModuleNotFoundError: No module named 'lib.cogs.'
In your setup function you have f"lib.cogs.{cog}", but cog is an empty string or something, so its trying to essentially import lib.cogs. which is not a valid module / does not exist and is causing your error.
it's because file structures work different on linux than Windows.
(how i fixed it, https://stackoverflow.com/a/63931191/12388205)

nrfutil changes python version mid-script

I'm using nrfutil in a shell script. It's failing with this error:
Traceback (most recent call last):
File "/usr/local/bin/nrfutil", line 6, in <module>
from nordicsemi.__main__ import cli
File "/Library/Python/2.7/site-packages/nordicsemi/__main__.py", line 57, in <module>
from nordicsemi.zigbee.prod_config import ProductionConfig, ProductionConfigWrongException, ProductionConfigTooLargeException
File "/Library/Python/2.7/site-packages/nordicsemi/zigbee/prod_config.py", line 41, in <module>
import yaml
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/yaml/__init__.py", line 374
class YAMLObject(metaclass=YAMLObjectMetaclass):
It's starting in python 2.7, then it looks like its running "import yaml" from a 3.6 library.
Why would it do this? How do I prevent it?
Thanks
I had an old version of nrfutil. I upgraded, all is good

cannot launch Jupyter from anaconda

I just got a new laptop at work and installed anaconda.. howerver, when i launched Jupyter I received the following error. Does anyone know what i should do here? Cheers
Traceback (most recent call last):
File "C:\Users\darren.chapman\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 9, in
import sqlite3
File "C:\Users\darren.chapman\AppData\Local\Continuum\anaconda3\lib\sqlite3\__init__.py", line 23, in
from sqlite3.dbapi2 import *
File "C:\Users\darren.chapman\AppData\Local\Continuum\anaconda3\lib\sqlite3\dbapi2.py", line 27, in
from _sqlite3 import *
ImportError: DLL load failed: The specified procedure could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\darren.chapman\AppData\Local\Continuum\anaconda3\Scripts\jupyter-notebook-script.py", line 6, in
from notebook.notebookapp import main
File "C:\Users\darren.chapman\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\notebookapp.py", line 86, in
from .services.sessions.sessionmanager import SessionManager
File "C:\Users\darren.chapman\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 12, in
from pysqlite2 import dbapi2 as sqlite3
ModuleNotFoundError: No module named 'pysqlite2'
You have to add the path.
while installing click the add anoconda to the path.

ImportError: DLL load failed: The specified module could not be found

I have created a python application using py2exe. when i run this exe/application on my build environment, it works properly. But when i try to run it on clean machine, it gives me a error that,
Traceback (most recent call last):
File "wx\_misc.pyc", line 1358, in Notify
File "wx\_core.pyc", line 14771, in Notify
File "invesalius.py", line 174, in Startup
File "gui\frame.pyc", line 30, in <module>
File "constants.pyc", line 25, in <module>
File "project.pyc", line 31, in <module>
File "vtk\__init__.pyc", line 43, in <module>
File "vtkIOPython.pyc", line 12, in <module>
File "vtkIOPython.pyc", line 10, in __load
ImportError: DLL load failed: The specified module could not be
found.
Traceback (most recent call last):
File "wx\_misc.pyc", line 1358, in Notify
File "wx\_core.pyc", line 14771, in Notify
File "invesalius.py", line 82, in Startup2
AttributeError: 'SplashScreen' object has no attribute 'control'
Traceback (most recent call last):
File "invesalius.py", line 197, in OnClose
AttributeError: 'SplashScreen' object has no attribute 'fc'
I am using:
1. windows 8.1 RTM(64 bit)
2. python (2.7 amd64)
3. py2exe (0.6.10a1)
Any comments will be greatly appreciated...
Sounds like you need a python runtime on the target machine. Does the error message give you any more information about the missing DLL? If there is no further information, there is a Dependency Walker program (depends.exe) that may help you identify the missing dll.

Categories

Resources