Lamson (Python SMTP Server) Error - python

I've installed Lamson via easy_install on my webfaction shared hosting. Went to do the '30 Second Introduction' (See http://lamsonproject.org/docs/getting_started.html) but after:
[almacmillan#web129 python2.6]$ lamson gen -project mymailserver
I get:
Traceback (most recent call last):
File "/home/almacmillan/bin/lamson", line 5, in <module>
pkg_resources.run_script('lamson==1.0', 'lamson')
File "/usr/local/lib/python2.6/site-packages/pkg_resources.py", line 448, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/local/lib/python2.6/site-packages/pkg_resources.py", line 1166, in run_script
execfile(script_filename, namespace, namespace)
File "/home/almacmillan/lib/python2.6/lamson-1.0-py2.6.egg/EGG-INFO/scripts/lamson", line 3, in <module>
from lamson import args, commands
File "/home/almacmillan/lib/python2.6/lamson-1.0-py2.6.egg/lamson/commands.py", line 28, in <module>
from lamson import server, args, utils, mail, routing, queue, encoding
File "/home/almacmillan/lib/python2.6/lamson-1.0-py2.6.egg/lamson/utils.py", line 12, in <module>
from daemon import pidlockfile
File "/home/almacmillan/lib/python2.6/python_daemon-1.5.5-py2.6.egg/daemon/pidlockfile.py", line 33, in <module>
class PIDLockFile(LinkFileLock, object):
TypeError: Error when calling the metaclass bases
function() argument 1 must be code, not str
I'm a very new programmer. I'd really appreciate some debugging help.

There's already a ticket for the problem here: http://support.lamsonproject.org/tktview?name=06d488141d
Use http://pypi.python.org/pypi/lockfile/0.8 as 0.9.1's
API changes break python_daemon-1.5.5-py2.5.egg/daemon/pidlockfile.py.
0.9.1 comes with easy_install. So, it's not an issue with lamson.
To solve: remove lockfile 0.9.1 from your Python site-packages
and get 0.8 from the cheese shop instead.

Related

Impossible to retrieve data form pyattck module

I am using the pyattck module to retrieve information from mitre att&ck.
Versions:
- pyattck==7.0.0
- pyattck-data==2.5.2
Then, I just created a simple main.py file to test the module.
from pyattck import Attck
def main():
attck = Attck()
for technique in attck.enterprise.techniques:
print(technique.name)
if __name__ == '__main__':
main()
When running the main.py script I get the following exception:
Traceback (most recent call last):
File "/<path>/main.py", line 15, in <module>
main()
File "/<path>/main.py", line 8, in main
for technique in attck.enterprise.techniques:
File "/<path_venv>/lib/python3.10/site-packages/pyattck/attck.py", line 253, in enterprise
from .enterprise import EnterpriseAttck
File "/<path_venv>/lib/python3.10/site-packages/pyattck/enterprise.py", line 7, in <module>
class EnterpriseAttck(Base):
File "/<path_venv>/lib/python3.10/site-packages/pyattck/enterprise.py", line 42, in EnterpriseAttck
__attck = MitreAttck(**Base.config.get_data("enterprise_attck_json"))
File "/<path_venv>/lib/python3.10/site-packages/pyattck_data/attack.py", line 55, in __init__
raise te
File "/<path_venv>/lib/python3.10/site-packages/pyattck_data/attack.py", line 53, in __init__
self.__attrs_init__(**kwargs)
File "<attrs generated init pyattck_data.attack.MitreAttck>", line 14, in __attrs_init__
File "/<path_venv>/lib/python3.10/site-packages/pyattck_data/attack.py", line 66, in __attrs_post_init__
raise te
File "/<path_venv>/lib/python3.10/site-packages/pyattck_data/attack.py", line 62, in __attrs_post_init__
data = TYPE_MAP.get(item['type'])(**item)
TypeError: 'NoneType' object is not callable
Anyone knows where is the issue? Maybe I have forgotten to import something? It would be helpful to know if this module actually works in another version. This one is the lasted stable one ATTOW.
UPDATE
There is am issue with this project. Mitre added some new features that are not supported by the module and make it unusable.
There is an issue on github related to this.
They have already fixed this issue in future releases. You just need to update your package pyattck-data form the bugged version 2.5.2 to 2.6.1 (or any newer).
If you are using pip, just run this:
pip install --upgrade pyattck-data
If you are using conda (inside your venv):
conda update pyattck-data

ImportError: cannot import name 'bytes_type' from 'oauthlib.common'

I am updating airflow from 1.10.5 to 1.10.10. I am getting the following error in webserver when using google OAuth
Traceback (most recent call last):
File "/home/airflow/.local/bin/airflow", line 37, in <module>
args.func(args)
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/utils/cli.py", line 75, in wrapper
return f(*args, **kwargs)
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/bin/cli.py", line 900, in webserver
app = cached_app_rbac(None) if settings.RBAC else cached_app(None)
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/www_rbac/app.py", line 295, in cached_app
app, _ = create_app(config, session, testing)
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/www_rbac/app.py", line 108, in create_app
update_perms=conf.getboolean('webserver', 'UPDATE_FAB_PERMS'))
File "/home/airflow/.local/lib/python3.7/site-packages/flask_appbuilder/base.py", line 148, in __init__
self.init_app(app, session)
File "/home/airflow/.local/lib/python3.7/site-packages/flask_appbuilder/base.py", line 202, in init_app
self.sm = self.security_manager_class(self)
File "/home/airflow/.local/lib/python3.7/site-packages/airflow/www_rbac/security.py", line 177, in __init__
super(AirflowSecurityManager, self).__init__(appbuilder)
File "/home/airflow/.local/lib/python3.7/site-packages/flask_appbuilder/security/sqla/manager.py", line 51, in __init__
super(SecurityManager, self).__init__(appbuilder)
File "/home/airflow/.local/lib/python3.7/site-packages/flask_appbuilder/security/manager.py", line 249, in __init__
from flask_oauthlib.client import OAuth
File "/home/airflow/.local/lib/python3.7/site-packages/flask_oauthlib/client.py", line 20, in <module>
from .utils import to_bytes
File "/home/airflow/.local/lib/python3.7/site-packages/flask_oauthlib/utils.py", line 5, in <module>
from oauthlib.common import to_unicode, bytes_type
ImportError: cannot import name 'bytes_type' from 'oauthlib.common' (/home/airflow/.local/lib/python3.7/site-packages/oauthlib/common.py)
This error is because of the dependency mismatch. Airflow 1.10.10 is installing oauthlib==3.1.0 and Flask-OAuthlib==0.9.5 and in 3.1.0 version of oauthlib, there is no bytes_type while Flash-OAuthlib is expecting it to be there.
Considering that lepture has archived flask-oauthlib and created authlib, I see a PR in airflow from lepture about this change https://github.com/apache/airflow/pull/6140/files but it is not merged and marked stale by the bot
Has anyone faced this issue in Airflow 1.10.10? I have fixed this issue by changing the oauthlib version to 2.1.0 in requirement.txt
We faced the same issue and temporary fixed it by force upgrade flask_oauthlib to 0.9.6:
(When we wait for airflow fix its dependencies)
pip install flask_oauthlib==0.9.6

Importing requests in python gives error

I have a small python (2.7) script that works with several threads. One of the threads will read a global list and post an https post request for each one of the entries of this list.
For doing that I saw that the best way is to use python requests module. I have installed it with pip (no problem with that, it is placed in ...Python/2.7/site-packages/requests/...), but, when I import this module in my script, I get an error.
I have created another script with just one line (import requests) to reproduce the error, and I get this:
Traceback (most recent call last):
File "req.py", line 1, in <module>
import requests
File "/Library/Python/2.7/site-packages/requests/__init__.py", line 43, in <module>
import urllib3
File "/Library/Python/2.7/site-packages/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "/Library/Python/2.7/site-packages/urllib3/connectionpool.py", line 11, in <module>
from .exceptions import (
File "/Library/Python/2.7/site-packages/urllib3/exceptions.py", line 2, in <module>
from .packages.six.moves.http_client import (
File "/Library/Python/2.7/site-packages/urllib3/packages/six.py", line 203, in load_module
mod = mod._resolve()
File "/Library/Python/2.7/site-packages/urllib3/packages/six.py", line 115, in _resolve
return _import_module(self.mod)
File "/Library/Python/2.7/site-packages/urllib3/packages/six.py", line 82, in _import_module
__import__(name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 69, in <module>
from array import array
File "/Users/carlestalenssebastia/Documents/mychip/raspberry pi/array.py", line 3, in <module>
IndexError: list index out of range
Python 2.7.10
MacBook Pro with macOS Sierra (v 10.12)
Am I doing something wrong? Didn't I installed the module in the proper way?
it seems that you're having two modules with the same name array.py
rename your local array.py module to something more unique to resolve this.
take a look at this answer for more info on how to handle this issue and here to learn more on how python import system works.

Python makes lib error when making FireFox Sync 1.5

I've tried to make my own server to new sync service in FireFox.
I used the following tutorial: https://docs.services.mozilla.com/howtos/run-sync-1.5.html .
When I wanted to check it by using make test I got the following error:
Traceback (most recent call last):
File "/home/jj/syncserver/local/local/lib/python2.7/site-packages/nose/loader.py", line 403, in loadTestsFromName
module = resolve_name(addr.module)
File "/home/jj/syncserver/local/local/lib/python2.7/site-packages/nose/util.py", line 311, in resolve_name
module = __import__('.'.join(parts_copy))
File "/home/jj/syncserver/local/local/lib/python2.7/site-packages/syncstorage/__init__.py", line 5, in <module>
import mozsvc.config
File "/home/jj/syncserver/local/local/lib/python2.7/site-packages/mozsvc/config.py", line 10, in <module>
from konfig import Config, SettingsDict
File "/home/jj/syncserver/local/local/lib/python2.7/site-packages/konfig/__init__.py", line 11, in <module>
from configparser import ConfigParser, ExtendedInterpolation
ImportError: cannot import name ExtendedInterpolation
What's happened?
configparser.ExtendedInterpolation does not exist in Python 2.
You need to use Python 3.

lightblue Python module not working on mac

I'm trying to connect to wiimote via Python on mac osx 10.7.2.
For that I'm trying to use lightblue. When running: import lightblue Python gives me this error.
>>> import lightblue
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lightblue/__init__.py", line 160, in <module>
from _lightblue import *
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lightblue/_lightblue.py", line 27, in <module>
import _IOBluetooth
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lightblue/_IOBluetooth.py", line 47, in <module>
globals=globals())
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/objc/_bridgesupport.py", line 142, in initFrameworkWrapper
_parseBridgeSupport(data, globals, frameworkName)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/objc/_bridgesupport.py", line 42, in _parseBridgeSupport
objc.parseBridgeSupport(data, globals, frameworkName, *args, **kwds)
ValueError: cftype for 'IOBluetoothDeviceInquiryRef' must include gettypeid_func, tollfree or both
I found one with a similar problem here: http://python.6.n6.nabble.com/Python-bridgesupport-issue-on-Lion-td2161049.html#a32196961 but the answer doesn't help me much, since it seems to me that it is already using lightblue's files. Any suggestions?
Seems like a bug with Apple's gen_bridge_metadata script. You can make the error go away by editing the generated file by hand.
Open up /System/Library/Frameworks/IOBluetooth.framework/Versions/Current/Resources/BridgeSupport/IOBluetooth.bridgesupport and delete the lines that start with <cftype.

Categories