Why i got that problems when i run my script? - python

Hi, is there a solution for this error code ?
Traceback (most recent call last):
File "./weevely.py", line 2, in <module>
from core.terminal import Terminal
File "/Users/ismailtaibi/Desktop/isdo/scripts/weevely/core/terminal.py", line 6, in <module>
from core.module import Status
File "/Users/ismailtaibi/Desktop/isdo/scripts/weevely/core/module.py", line 14, in <module>
from core.vectorlist import VectorList
File "/Users/ismailtaibi/Desktop/isdo/scripts/weevely/core/vectorlist.py", line 15, in <module>
from core.vectors import Os
File "/Users/ismailtaibi/Desktop/isdo/scripts/weevely/core/vectors.py", line 11, in <module>
from mako.template import Template
ImportError: No module named mako.template
Thanks.

The answer is pretty self explainatory and with a google search you could have solved everything in seconds.
Here you have a how to install pip if you don`t have it: How do I install pip on macOS or OS X?
After this type in the terminal:
pip install Mako
as stated in the official website: http://www.makotemplates.org/download.html
If this doesn`t work you can manually download the Mako package here:
https://pypi.python.org/pypi/Mako/
Please, also read this carefully:
https://stackoverflow.com/help/how-to-ask

Related

dynamic module does not define module export function (PyInit_bz2)

I am using Python3.6 on CentOS linux and have created virtual environment using venv. I installed matplotlib using pip install matplotlib and it completed successfully. Now when I am trying to import matplotlib in python command line it is producing Import Error:
>>> import matplotlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/yogeshs/Python3.6VE/lib/python3.6/site-packages/matplotlib/__init__.py", line 127, in <module>
from . import cbook
File "/home/yogeshs/Python3.6VE/lib/python3.6/site-packages/matplotlib/cbook/__init__.py", line 13, in <module>
import bz2
ImportError: dynamic module does not define module export function (PyInit_bz2)
>>>
I read almost all the answers on similar issues on Stackoverflow and tried to follow the steps but I am unable to to resolve this problem. Can somebody please guide me through this? Thank you in advance.

"No module named zlib" error anytime I use pip

I'm using terminal on mac, and anytime I attempt to use pip, I get the following error message telling me that it cannot find a module named zlib:
$ pip --version
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/__init__.py", line 27, in <module>
from . import urllib3
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 42, in <module>
from .response import HTTPResponse
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 3, in <module>
import zlib
ModuleNotFoundError: No module named 'zlib'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/bin/pip", line 7, in <module>
from pip import main
File "/usr/local/lib/python3.6/site-packages/pip/__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/__init__.py", line 62, in <module>
from .packages.urllib3.exceptions import DependencyWarning
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/__init__.py", line 29, in <module>
import urllib3
File "/usr/local/lib/python3.6/site-packages/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 36, in <module>
from .response import HTTPResponse
File "/usr/local/lib/python3.6/site-packages/urllib3/response.py", line 3, in <module>
import zlib
ModuleNotFoundError: No module named 'zlib'
I've read several SO posts with the same error message, and have tried their solutions, including attempting to install zlib using homebrew, which fails, and updating my Xcode developer tools. I also installed pip earlier using python get-pip.py, and it said it installed successfully.
The reason I need pip is to install a package for use on python 2.7, but doing $ pip install "package-name" produces the same error as above. I have both Python 2 and 3 installed on my machine, if that helps. I'm kind of new to pip and using the command line in general, and I'm super confused; if anyone could help me out I'd really appreciate it.
This is the OP. I was able to fix the issue, and wanted to post my solution here in case it would help others.
Essentially I believe it occurred because Python2 is default on my machine, but pip is by default pointing to resources pertaining to Python3, or something like that. Doing pip2 --version instead provided the expected response.

pip commands return a TypeError

I needed to install hashlib for one of my projects, and used easy_install hashlib (as was stated by this Stack Exchange post) to do so. However, right after I installed this package, I haven't been able to use pip at all. Whenever I type a command with pip (like pip install), I get the following error message:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 37, in <module>
import email.parser
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/email/parser.py", line 12, in <module>
from email.feedparser import FeedParser
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/email/feedparser.py", line 27, in <module>
from email import message
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/email/message.py", line 16, in <module>
import email.charset
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/email/charset.py", line 13, in <module>
import email.base64mime
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/email/base64mime.py", line 40, in <module>
from email.utils import fix_eols
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/email/utils.py", line 27, in <module>
import random
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/random.py", line 49, in <module>
import hashlib as _hashlib
File "build/bdist.macosx-10.13-intel/egg/hashlib.py", line 115, in <module>
"""
TypeError: 'frozenset' object is not callable
This also now occurs when I'm using easy_install- same error. I'm also not able to uninstall pip and reinstall- any command with pip results in the error above. Even executing
pip --version yields the same error. I know it's something to do with the hashlib package, but I'm not sure how to delete it and reinstall without messing up my entire Python configurations. My hypothesis is that the version of hashlib I installed is either too old or too new for my Python 2.7, and doesn't play well with it.
Does anyone know what exactly is going on behind the scenes here in this stack trace, and how I can fix pip?
Is the best thing to do to literally go in and delete hashlib.py from my lib/python2.7 folder?
So, this doesn't solve the issue with hashlib, but it does get you a working pip again: literally download and reinstall Python 2.7 all over again from the source. If anyone comes up with a better, more elegant solution for fixing pip, I am all for it.
However, at least I can use pip again...

Can't import the py-translate 1.03 package

Is someone familiar with these package?
I tried easy install and many things I saw in imports problems solution
>>> import translate
output:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import translate
File "C:\Python27\lib\site-packages\translate\__init__.py", line 8, in <module>
from .translator import *
File "C:\Python27\lib\site-packages\translate\translator.py", line 13, in <module>
import requests
ImportError: No module named requests
Moreover, in the directory of the package there is a test file.
I tried to run it but I got this:
Traceback (most recent call last):
File "C:\Python27\Lib\site-packages\translate\tests\test_translator.py", line 10, in <module>
from ..translator import translator
ValueError: Attempted relative import in non-package
How have you installed py-translate.
It requires: requests
My advice is pip install requests (or easy_install requests)
Their latest release is 1.0.2, but also goes by 1.0.3.
Pip install the package, don't just download the archive as you will miss the dependancies

No Module Named pydispatch when using pyOpenGL

I have been attempting to follow a tutorial online and I have followed every single line and for some reason I get the following error:
Traceback (most recent call last):
File "C:/Users/User/Desktop/OpenGLContextTest.py", line 2, in <module>
from OpenGLContext import testingcontext
File "C:\Python27\lib\site-packages\openglcontext-2.2.0a2-py2.7.egg\OpenGLContext\testingcontext.py", line 10, in <module>
from OpenGLContext import plugins, context, contextdefinition
File "C:\Python27\lib\site-packages\openglcontext-2.2.0a2-py2.7.egg\OpenGLContext\context.py", line 32, in <module>
from OpenGLContext import visitor, texturecache,plugins
File "C:\Python27\lib\site-packages\openglcontext-2.2.0a2-py2.7.egg\OpenGLContext\visitor.py", line 3, in <module>
from OpenGLContext.scenegraph import nodepath
File "C:\Python27\lib\site-packages\openglcontext-2.2.0a2-py2.7.egg\OpenGLContext\scenegraph\nodepath.py", line 3, in <module>
from vrml.vrml97 import nodepath, nodetypes
File "C:\Python27\lib\site-packages\pyvrml97-2.3.0a2-py2.7.egg\vrml\vrml97\nodepath.py", line 4, in <module>
from vrml import nodepath
File "C:\Python27\lib\site-packages\pyvrml97-2.3.0a2-py2.7.egg\vrml\nodepath.py", line 3, in <module>
from vrml import node, weaklist
File "C:\Python27\lib\site-packages\pyvrml97-2.3.0a2-py2.7.egg\vrml\node.py", line 6, in <module>
from vrml import field, fieldtypes, weaklist, weakkeydictfix
File "C:\Python27\lib\site-packages\pyvrml97-2.3.0a2-py2.7.egg\vrml\field.py", line 2, in <module>
from pydispatch import dispatcher, robustapply
ImportError: No module named pydispatch
I have attempted searching on google for the chance that this tutorial may be broken or something, but I don't believe it is. I have pydispatch and have attempted to install it using easy_install yet nothing changes. Can someone please help me with this? I know the code is completely correct as after a while I copied and pasted everything to ensure that it wasn't my syntax.
The instructions (apparently incorrectly) say to install pydispatcher. I had the same problem you did until I installed the module PyDispatcher. Confusingly, both exist.
To clarify on #Phil's answer.
I saw:
No module named pydispatch
And so I did:
sudo pip install pydispatch
The install worked, but Scrapy still didn't work because we were supposed to:
sudo pip install pydispatcher
You need to install PyDispatcher separately. Please take a look at the required packages for the tutorial to work along with the installation instructions here:
PyOpenGL Introduction
Check particularly within the section named Package Installation

Categories

Resources