how do i fix "No module named 'win32api'" on python2.7 - python-2.7

I am trying to import win32api in python 2.7.9. i did the "pip install pypiwin32" and made sure all the files were intalled correctly (i have the win32api.pyd under ${PYTHON_HOME}\Lib\site-packages\win32). i also tried coping the files from C:\Python27\Lib\site-packages\pywin32_system32 to C:\Python27\Lib\site-packages\win32. I also tried restarting my pc after each of these steps but nothing seems to work! i still get the error 'No module named 'win32api''

Well, turns out the answer is upgrading my python to 3.6.
python 2.7 seems to old to work with outside imports (I'm just guessing here, because its not the first time I'm having an import problem)
hope it helps :)

Related

ImportError sayins module dot not exist, but is already installed

I had to install new package on my project to handle with Base64 images from my API, so i installed django-extra-fields, so far so good, i have made my testes locally, everything working just fine, when i pushed my changes to production and installed the new package running pip install django-extra-fields with right virtualenv on, i just keep getting the error ImportError at /
No module named drf_extra_fields.fields
That seens a silly mistake, so i checked my code like 100 times so far, and everything is right
I'm using Django 1.11 with Python 2.7
My vm is called: vm-prod_cfr_nuvem
When i run pip freeze show all my packages:
(vm-prod_cfr_nuvem) [~ site-packages]$ pip freeze
Django==1.11.6
django-cors-headers==2.1.0
django-extra-fields==2.0.2
django-filter==1.1.0
And if i enter in vm site-packages path, i can see that is installed there
/home/daniloitj/.virtualenvs/vm-prod_cfr_nuvem/lib/python2.7/site-packages
django_cors_headers-2.1.0.dist-info
django_extra_fields-2.0.2.dist-info
django_filter-1.1.0.dist-info
on my view where the show the error, as you can see, is the same path as the last one in list
ImportError at /
No module named drf_extra_fields.fields
...
Python Path:
['/home/daniloitj/webapps/cfr_prod/lib/python2.7/Django-1.11.9-py2.7.egg',
'/home/daniloitj/webapps/cfr_prod',
'/home/daniloitj/webapps/cfr_prod/cfr_nuvem',
'/home/daniloitj/webapps/cfr_prod/lib/python2.7',
'/home/daniloitj/lib/python2.7',
'/home/daniloitj/lib/python2.7',
'/home/daniloitj/.virtualenvs/vm-prod_cfr_nuvem/lib64/python27.zip',
'/home/daniloitj/.virtualenvs/vm-prod_cfr_nuvem/lib64/python2.7',
'/home/daniloitj/.virtualenvs/vm-prod_cfr_nuvem/lib64/python2.7/plat-linux2',
'/home/daniloitj/.virtualenvs/vm-prod_cfr_nuvem/lib64/python2.7/lib-tk',
'/home/daniloitj/.virtualenvs/vm-prod_cfr_nuvem/lib64/python2.7/lib-old',
'/home/daniloitj/.virtualenvs/vm-prod_cfr_nuvem/lib64/python2.7/lib-dynload',
'/usr/lib64/python2.7',
'/usr/lib/python2.7',
'/usr/lib64/python2.7/lib-tk',
'/home/daniloitj/.virtualenvs/vm-prod_cfr_nuvem/lib/python2.7/site-packages']
Obs.: I thought that somehow my server is not using my VM or something like it... so i activate it manually on my terminal and run python manage.py shell and tried to import the lib import drf_extra_fields im still getting the same error
Obs2.: Didnt found anyone with same problem using that lib, and there is no issues about it, so probabily is my misconfiguration rather than something broke in the lib
Package Page: https://github.com/Hipo/drf-extra-fields
That error make me crazy... i solved it going back 1 small version... so instead of using 2.0.2 i'm using 2.0.1, the odd thing is... the 2.0.2 still working on my local environment, but dont work on production, and dont seems be environment problem cuz my server match all requirements to use that lib

ImportError: No module named vaderSentiment

I'm trying to run a code in python2.7 on windows os that uses sentiment analysis
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
analyzer = SentimentIntensityAnalyzer()
and I'm getting this error
ImportError: No module named vaderSentiment
Can anyone help me with this?
Assuming you solved this one as it's from 7 months ago, but for anyone else searching for it:
Go into terminal/cmd and paste the following:
pip install vaderSentiment
More info on VADER: https://github.com/cjhutto/vaderSentiment
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
#note: depending on how you installed (e.g., using source code download versus pip install), you may need to import like this:
#from vaderSentiment import SentimentIntensityAnalyzer
read the comment in a code
Try running your file with Python3 instead of just python. Sometimes when you have different pips/pythons installed on your computer you might have vaderSentiment installed in python2 when you need to run it in python3.

Error on Pycharm: ImportError

I'm, working on Windows 8 and I receive this error when launching my python program on pycharm:
ImportError: No module named Qwt5
refered to the line: "import PyQt4.Qwt5 as Qwt"
the program always worked till today, and the IDE still suggests me Qwt5 as a module to import when pressing CTRL+SPACE, so it seems is still recognized.
I checked the Qwt5 folder and there is the __init__.py file
I use Python 2.7.9 an is correctly selected as Python Interpreter
I've already tried to remove the packages and reinstall them.
Someone can help me?
i tried this and working.sudo apt-get install python-qwt5-qt4

py2exe can't find msvcp90.dll

I'm working on converting a simple GUI script written with Python 2.7 and Pyqt4 into a standalone executable using py2exe. I keep getting "no such file exists" errors, and I've managed to fix a few, though this one seems stubborn. It can't find msvcp90.dll, and returns an error message with a short traceback to distutils and then back to my py2exe script, which isn't very enlightening.
I've installed the MS C++ redistributable runtime, as recommended in
py2exe fails to generate an executable
but my script still can't locate the .dll. Below is my py2exe script, with the name of my script blocked out:
from distutils.core import setup
from py2exe.build_exe import py2exe
import sys, os, zmq
sys.argv.append('py2exe')
os.environ["PATH"] = \
os.environ["PATH"] + \
os.path.pathsep + os.path.split(zmq.__file__)[0]
setup(
options = {'py2exe':{'bundle_files':1,"includes":["zmq.utils",
"zmq.utils.jsonapi","zmq.utils.strtypes"]}},
console = [{'script':"#######.py"}],
zipfile = None
)
I've already fixed an issue with zmq (which isn't ever used by my script, or my GUI, for that matter, as far as I know). What am I doing wrong?
Right, I've managed to get my app to build, and although the question is now moderately old, it's my hope this is eventually of use to someone.
Firstly, py2exe is probably the wrong tool. It's old and AFAICT unmaintained. Consider PyInstaller instead. Using PyInstaller is literally as simple as installing it, installing PyWin32, and then going python %path_to_pyinstaller%/pyinstaller.py --onefile --windowed source.py. PyInstaller deals with all the mess of side by side assemblies and so on without you having to do anything.
In short, use PyInstaller.
However, to answer your question, this worked for me:
The question you've linked to - in particular this answer is the right start. Find the right DLLs and copy them to C:\Python27\DLLs
Ditch your existing setup.py file. If you're not using zmq, there's no reason to import it. Also, for a windowed application you want windows= not console=. My file goes (for packaging show.py):
#!/usr/bin/python
from distutils.core import setup
import py2exe
setup(options={'py2exe':{'bundle_files':1}},
windows=['show.py'])
(This is pinched off http://www.blog.pythonlibrary.org/2010/07/31/a-py2exe-tutorial-build-a-binary-series/)

Django Gramps no module named web.settings

I'm using Gramps 3.3.1 under Ubuntu 12.04 and trying to in Django Export/Import. The install is okay, but when I look at the installed addons, it says that it failed, with reason: "No module named web.settings".
I cann't for the life of me figure out how to fix this. I'm assuming that it's this line in the python script:
import web.settings as default_settings
Anyone have any ideas? I'm trying to get this data out and into a MySQL database, but I can't seem to.
Thanks!
When you run into an error where Python tells you "No module named blah" it really means it can't find "blah".
I would check your pythonpath and the filesystem permissions on the stuff in your path.
Edit
Your issue seems to be a known issue: http://www.gramps-project.org/bugs/view.php?id=5464
It's caused by not running Gramps from source, near as I can tell. It doesn't look like a Python Path issue, so much as the Gramps Django devs making assumptions where your Django settings would be (but I could be wrong).
As for Python Path, there's plenty of resources describing how to. The simplest way to check your Python path is to run echo $PYTHONPATH in a terminal. If you don't see it there, Python might not find it.