I'm trying to use the whoosh python library.
I added it to my system via pip, and can see it in my python dist-packages folder, which is on the path.
in my code I have:
from whoosh.fields import Schema, TEXT
schema = Schema(title=TEXT, content=TEXT)
As per the whoosh documentation, but this throws "importerror: no module named fields"
What am I doing wrong?
(I'm running python 2.7)
Related
I've been struggling with the Azure library for a while now. I want to use Azure in python. I have azure.storage.blob installed (via pip install azure.storage.blob). I have upgraded it (also tried uninstalling and reinstalling) to version 12.8.1. I'm currently running python 3.7.6.
In spite of all this, I keep getting
from azure.storage.blob.sharedaccesssignature import BlobSharedAccessSignature
ModuleNotFoundError: No module named 'azure.storage.blob.sharedaccesssignature'
I see the module here: https://azure-storage.readthedocs.io/ref/azure.storage.blob.sharedaccesssignature.html
So I'm not sure why it's not recognized. Any ideas?
The reason you're getting this error is because BlobSharedAccessSignature is part of the old version of the SDK (azure-storage) whereas you're working with the newer version of the SDK (azure.storage.blob version 12.8.1).
To generate a shared access signature on a blob, you will need to use generate_blob_sas() function in the new SDK.
I am trying to port python 2.7 code to python 3.7 code
I am seeing an "import hotshots" in a file but getting a
ModuleNotFoundError: No module named 'hotshot'
I can't seem to find that module anywhere online. Is this a python 2.7 specific package replaced with something else ? I had that case with cStringIO
Additional info : this is implemented in a Django project. Maybe an older Django lib ? I am trying to port this code from Django 1.8 to 2.2
What I tried to do :
- pip install --upgrade hotshot
No matching distribution found for hotshot
Looking for hotshot on The Python Package Index
No library with that name
What it is used for ? The only line where it is used is
prof = hotshot.Profile(final_log_file)
The whole project code is available here :
https://github.com/EbookFoundation/fef-questionnaire,
the file using "hotshot" is "profiler.py". Additionnally, there are no "hotshot.py" file in the whole project.
Finally found something. hotshot was a Python profiler (https://docs.python.org/2/library/profile.html)
From https://docs.python.org/2/library/hotshot.html :
hotshot was an experimental C module that focused on minimizing the
overhead of profiling, at the expense of longer data post-processing
times. It is no longer maintained and may be dropped in a future
version of Python.
I simply have to replace hotshot by a newer Python profiler, compatible with Python 3 :
https://docs.python.org/3/library/profile.html
So either profile or cProfile.
Trying to run the following code:
conn.executescript("""
CREATE VIRTUAL TABLE Hashes USING rtree(
gives the following error:sqlite3 operational error no such module: rtree
To fix this, I have built the windows dll from the sqlite source with rtrees enabled.
Where should i put the dll in order for the sqlite3 python module to recognize it?
Is there any other fix for enabling rtree module on sqlite3 python module?
python version 2.7
I believe that this should be copied into the Dlls directory
I have installed the package xlrd but am unable to import it when using my IDE (Rodeo).
Having looked at a few questions on stackoverflow, I still can't work out why I get the following error:
ImportError: No module named 'xlrd'
The xlrd folder in site-packages does have an __init__.py file.
Additionally, if I attempt to import xlrd using the Command Prompt, I get no errors. But I do when using Rodeo.
While trying to solve this problem, I have added the file location of site-packages (C:\Users\HP\AppData\Local\Programs\Python\Python36-32\Lib\site-packages) to the System Variables "Path", although I'm not sure what this does or if it's relevant.
I am using Python 3.6 and am a Python beginner so would appreciate any answers to be described in a basic way!
I am using an online spreadsheet app called AirTable and need to be able to access the API using Python.
There is a python interface to the API as outlined on Github:
https://github.com/bayesimpact/airtable-python
I've followed the getting started directions and when I run the code I get the following error:
AttributeError: module 'airtable' has no attribute 'Airtable'
What am I doing wrong?
Temporary fix:
from airtable import airtable
Permanent fix:
1 find your airtable installed path
2 find the ini file
3 Remove the #
4 Specify the class you need to use once imported
from airtable import airtable
class Airtable(object):
pass
May be more class you need to add.
I had this problem as well. The filename which I was writing in was named airtable.py
When I changed the filename to air.py it was able to import airtable without an issue.
First, check that if your project has a file name "airtable.py"
"You should never use the same name for a python file that is for a python library, python confuses its self, deciding where should it import, its priority is to import from the project files first and go to libraries later"
if that does not works then you may have installed the wrong library
pip uninstall airtable
python working library for airtbale is
pip install airtable-python-wrapper