Загрузка...

Python | The problem with the module, python is stupid!

Thread in Python created by Rostil Aug 24, 2019. 360 views

  1. Rostil
    Rostil Topic starter Aug 24, 2019 Дай личный! 504 Nov 12, 2018
    Ошибка, питон не находи атрибут в модуле!
    Помогите пожалуйста!
    Ето ошибка в cmd
    Code

    Traceback (most recent call last):
    File "opcode.py", line 5, in <module>
    from spockbot.plugins.core import auth, event, net, select, \
    File "C:\Users\Romanstik23\AppData\Local\Programs\Python\Python37-32\lib\site-
    packages\spockbot\__init__.py", line 3, in <module>
    from spockbot.plugins.loader import PluginLoader as Client # noqa
    File "C:\Users\Romanstik23\AppData\Local\Programs\Python\Python37-32\lib\site-
    packages\spockbot\plugins\__init__.py", line 1, in <module>
    from spockbot.plugins.core import auth, event, net, select, \
    File "C:\Users\Romanstik23\AppData\Local\Programs\Python\Python37-32\lib\site-
    packages\spockbot\plugins\core\net.py", line 12, in <module>
    from cryptography.hazmat.primitives import ciphers
    File "C:\Users\Romanstik23\AppData\Local\Programs\Python\Python37-32\lib\site-
    packages\cryptography\hazmat\primitives\ciphers\__init__.py", line 7, in <module
    >
    from cryptography.hazmat.primitives.ciphers.base import (
    File "C:\Users\Romanstik23\AppData\Local\Programs\Python\Python37-32\lib\site-
    packages\cryptography\hazmat\primitives\ciphers\base.py", line 11, in <module>
    from cryptography import utils
    File "C:\Users\Romanstik23\AppData\Local\Programs\Python\Python37-32\lib\site-
    packages\cryptography\utils.py", line 9, in <module>
    import inspect
    File "C:\Users\Romanstik23\AppData\Local\Programs\Python\Python37-32\lib\inspe
    ct.py", line 35, in <module>
    import dis
    File "C:\Users\Romanstik23\AppData\Local\Programs\Python\Python37-32\lib\dis.p
    y", line 8, in <module>
    from opcode import *
    File "C:\Users\Romanstik23\Desktop\Fenix Shop\OP Hacker\opcode.py", line 7, in
    <module>
    from spockbot.plugins.helpers import auxiliary, channels, chat, clientinfo,
    \
    File "C:\Users\Romanstik23\AppData\Local\Programs\Python\Python37-32\lib\site-
    packages\spockbot\plugins\helpers\auxiliary.py", line 9, in <module>
    from cryptography.hazmat.primitives import serialization
    File "C:\Users\Romanstik23\AppData\Local\Programs\Python\Python37-32\lib\site-
    packages\cryptography\hazmat\primitives\serialization\__init__.py", line 7, in <
    module>
    from cryptography.hazmat.primitives.serialization.base import (
    File "C:\Users\Romanstik23\AppData\Local\Programs\Python\Python37-32\lib\site-
    packages\cryptography\hazmat\primitives\serialization\base.py", line 71, in <mod
    ule>
    @utils.register_interface(KeySerializationEncryption)
    AttributeError: module 'cryptography.utils' has no attribute 'register_interface
    '
    Ето код файла utils.py
    Code

    # This file is dual licensed under the terms of the Apache License, Version
    # 2.0, and the BSD License. See the LICENSE file in the root of this repository
    # for complete details.

    from __future__ import absolute_import, division, print_function

    import abc
    import binascii
    import inspect
    import sys
    import warnings


    # We use a UserWarning subclass, instead of DeprecationWarning, because CPython
    # decided deprecation warnings should be invisble by default.
    class CryptographyDeprecationWarning(UserWarning):
    pass


    # Several APIs were deprecated with no specific end-of-life date because of the
    # ubiquity of their use. They should not be removed until we agree on when that
    # cycle ends.
    PersistentlyDeprecated2017 = CryptographyDeprecationWarning
    PersistentlyDeprecated2018 = CryptographyDeprecationWarning
    DeprecatedIn25 = CryptographyDeprecationWarning
    DeprecatedIn27 = CryptographyDeprecationWarning


    def _check_bytes(name, value):
    if not isinstance(value, bytes):
    raise TypeError("{} must be bytes".format(name))


    def _check_byteslike(name, value):
    try:
    memoryview(value)
    except TypeError:
    raise TypeError("{} must be bytes-like".format(name))


    def read_only_property(name):
    return property(lambda self: getattr(self, name))


    def register_interface(iface):
    def register_decorator(klass):
    verify_interface(iface, klass)
    iface.register(klass)
    return klass
    return register_decorator


    def register_interface_if(predicate, iface):
    def register_decorator(klass):
    if predicate:
    verify_interface(iface, klass)
    iface.register(klass)
    return klass
    return register_decorator


    if hasattr(int, "from_bytes"):
    int_from_bytes = int.from_bytes
    else:
    def int_from_bytes(data, byteorder, signed=False):
    assert byteorder == 'big'
    assert not signed

    return int(binascii.hexlify(data), 16)


    if hasattr(int, "to_bytes"):
    def int_to_bytes(integer, length=None):
    return integer.to_bytes(
    length or (integer.bit_length() + 7) // 8 or 1, 'big'
    )
    else:
    def int_to_bytes(integer, length=None):
    hex_string = '%x' % integer
    if length is None:
    n = len(hex_string)
    else:
    n = length * 2
    return binascii.unhexlify(hex_string.zfill(n + (n & 1)))


    class InterfaceNotImplemented(Exception):
    pass


    if hasattr(inspect, "signature"):
    signature = inspect.signature
    else:
    signature = inspect.getargspec


    def verify_interface(iface, klass):
    for method in iface.__abstractmethods__:
    if not hasattr(klass, method):
    raise InterfaceNotImplemented(
    "{} is missing a {!r} method".format(klass, method)
    )
    if isinstance(getattr(iface, method), abc.abstractproperty):
    # Can't properly verify these yet.
    continue
    sig = signature(getattr(iface, method))
    actual = signature(getattr(klass, method))
    if sig != actual:
    raise InterfaceNotImplemented(
    "{}.{}'s signature differs from the expected. Expected: "
    "{!r}. Received: {!r}".format(
    klass, method, sig, actual
    )
    )


    # No longer needed as of 2.2, but retained because we have external consumers
    # who use it.
    def bit_length(x):
    return x.bit_length()


    class _DeprecatedValue(object):
    def __init__(self, value, message, warning_class):
    self.value = value
    self.message = message
    self.warning_class = warning_class


    class _ModuleWithDeprecations(object):
    def __init__(self, module):
    self.__dict__["_module"] = module

    def __getattr__(self, attr):
    obj = getattr(self._module, attr)
    if isinstance(obj, _DeprecatedValue):
    warnings.warn(obj.message, obj.warning_class, stacklevel=2)
    obj = obj.value
    return obj

    def __setattr__(self, attr, value):
    setattr(self._module, attr, value)

    def __delattr__(self, attr):
    obj = getattr(self._module, attr)
    if isinstance(obj, _DeprecatedValue):
    warnings.warn(obj.message, obj.warning_class, stacklevel=2)

    delattr(self._module, attr)

    def __dir__(self):
    return ["_module"] + dir(self._module)


    def deprecated(value, module_name, message, warning_class):
    module = sys.modules[module_name]
    if not isinstance(module, _ModuleWithDeprecations):
    sys.modules[module_name] = _ModuleWithDeprecations(module)
    return _DeprecatedValue(value, message, warning_class)


    def cached_property(func):
    cached_name = "_cached_{}".format(func)
    sentinel = object()

    def inner(instance):
    cache = getattr(instance, cached_name, sentinel)
    if cache is not sentinel:
    return cache
    result = func(instance)
    setattr(instance, cached_name, result)
    return result
    return property(inner)

    Помогите пожалуйста, код нормально написал но модули тупят!
     
  2. Yggdrasil
    Ты модули импортировал через pip install?
     
  3. Rostil
    Rostil Topic starter Aug 24, 2019 Дай личный! 504 Nov 12, 2018
    Угу
     
Loading...
Top