Python makes lib error when making FireFox Sync 1.5 - python

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.

Related

can't make imports

my project can't make import idk why
the error is showing
seifahmed15#Ubuntu:~/Desktop/DAC-master$ python3 main.py
Traceback (most recent call last):
File "/home/seifahmed15/Desktop/DAC-master/main.py", line 2, in <module>
from user import create
File "/home/seifahmed15/Desktop/DAC-master/user.py", line 5, in <module>
import hcaptcha
File "/home/seifahmed15/Desktop/DAC-master/hcaptcha.py", line 6, in <module>
from seleniumwire.undetected_chromedriver import Chrome
File "/home/seifahmed15/.local/lib/python3.11/site-packages/seleniumwire/undetected_chromedriver/__init__.py", line 9, in <module>
from seleniumwire.webdriver import Chrome
File "/home/seifahmed15/.local/lib/python3.11/site-packages/seleniumwire/webdriver.py", line 13, in <module>
from seleniumwire import backend
File "/home/seifahmed15/.local/lib/python3.11/site-packages/seleniumwire/backend.py", line 4, in <module>
from seleniumwire.server import MitmProxy
File "/home/seifahmed15/.local/lib/python3.11/site-packages/seleniumwire/server.py", line 4, in <module>
from seleniumwire.handler import InterceptRequestHandler
File "/home/seifahmed15/.local/lib/python3.11/site-packages/seleniumwire/handler.py", line 5, in <module>
from seleniumwire import har
File "/home/seifahmed15/.local/lib/python3.11/site-packages/seleniumwire/har.py", line 11, in <module>
from seleniumwire.thirdparty.mitmproxy import connections
File "/home/seifahmed15/.local/lib/python3.11/site-packages/seleniumwire/thirdparty/mitmproxy/connections.py", line 9, in <module>
from seleniumwire.thirdparty.mitmproxy.net import tls, tcp
File "/home/seifahmed15/.local/lib/python3.11/site-packages/seleniumwire/thirdparty/mitmproxy/net/tls.py", line 43, in <module>
"SSLv2": (SSL.SSLv2_METHOD, BASIC_OPTIONS),
^^^^^^^^^^^^^^^^
AttributeError: module 'OpenSSL.SSL' has no attribute 'SSLv2_METHOD'. Did you mean: 'SSLv23_METHOD'?
i have reinstall python and tried to install pkg manually
i have searched on google and YouTube and i didn't find any thing
The console message below offers a bit more context on one issue, specifically on line 43:
File "/home/seifahmed15/.local/lib/python3.11/site-packages/seleniumwire/thirdparty/mitmproxy/net/tls.py", line 43, in <module>
"SSLv2": (SSL.SSLv2_METHOD, BASIC_OPTIONS),
^^^^^^^^^^^^^^^^
AttributeError: module 'OpenSSL.SSL' has no attribute 'SSLv2_METHOD'. Did you mean: 'SSLv23_METHOD'?
It looks like you may have a typo in the area below:
"SSLv2": (SSL.SSLv2_METHOD, BASIC_OPTIONS)
As the error message tells us:
'OpenSSL.SSL' has no attribute 'SSLv2_METHOD'. Did you mean: 'SSLv23_METHOD'?
You could try revising like below:
"SSLv2": (SSL.SSLv23_METHOD, BASIC_OPTIONS)
The other text in your console log appears to be showing the full stack trace - There may be an error elsewhere, but the error message you posted seems to be referencing that specific error on line 43.
The thread below may help a bit with handling the stack trace and debugging further:
Get exception description and stack trace which caused an exception, all as a string

Python requests-html throwing multiprocessing error

I am attempting to move over my web scraping program from using the requests library to the requests-html library to allow me to render the javascript on webpages. On the import of the module this error is thrown:
Traceback (most recent call last):
File "backend2.py", line 2, in <module>
import requests_html
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests_html.py", line 9, in <module>
import pyppeteer
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyppeteer/__init__.py", line 30, in <module>
from pyppeteer.launcher import connect, launch, executablePath # noqa: E402
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyppeteer/launcher.py", line 24, in <module>
from pyppeteer.browser import Browser
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyppeteer/browser.py", line 15, in <module>
from pyppeteer.page import Page
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyppeteer/page.py", line 20, in <module>
from pyppeteer.coverage import Coverage
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyppeteer/coverage.py", line 15, in <module>
from pyppeteer.util import merge_dict
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyppeteer/util.py", line 10, in <module>
from pyppeteer.chromium_downloader import check_chromium, chromium_executable
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyppeteer/chromium_downloader.py", line 15, in <module>
from tqdm import tqdm
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tqdm/__init__.py", line 1, in <module>
from ._tqdm import tqdm
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tqdm/_tqdm.py", line 75, in <module>
mp_lock = mp.RLock() # multiprocessing lock
AttributeError: module 'multiprocessing' has no attribute 'RLock'
Any help is appreciated!
You are using Python 3.7, but the github of requests-html states that only Python 3.6 is supported (bottom of page). I get all kinds of horrible errors when I try to use Python 3.7 but 3.6 works fine. So, seems strange I know, but please try using 3.6
Even so, as #georgexsh states, there should still be a RLock available for import from multiprocessing in 3.7 so it looks like your error may actually be that one of your code files is called multiprocessing.py or you have your own package called multiprocessing (so you are importing that instead of the module you wanted).

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.

Opening ipython from sublime text

I added the following plugin to sublime text 2 which is meant to open the ipython qt console:
import sublime, sublime_plugin
from subprocess import call
# import os
class ipythonQtCommand(sublime_plugin.TextCommand):
def run(self, edit):
call(["start","ipython", "qtconsole", "--pylab", "--ConsoleWidget.font_size=9", "--ConsoleWidget.font_family='Consolas'"],shell=True)
Initially it worked just fine, i.e. the plugin opened an ipython shell. I then added a menu item and a key binding. At some point something must have gone wrong since now I get this error when I run the plugin:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Chris\Python27\lib\site-packages\IPython\__init__.py", line 43, in <
odule>
from .config.loader import Config
File "C:\Chris\Python27\lib\site-packages\IPython\config\__init__.py", line 1
, in <module>
from .application import *
File "C:\Chris\Python27\lib\site-packages\IPython\config\application.py", lin
31, in <module>
from IPython.config.configurable import SingletonConfigurable
File "C:\Chris\Python27\lib\site-packages\IPython\config\configurable.py", li
e 31, in <module>
from loader import Config
File "C:\Chris\Python27\lib\site-packages\IPython\config\loader.py", line 32,
in <module>
from IPython.utils.path import filefind, get_ipython_dir
File "C:\Chris\Python27\lib\site-packages\IPython\utils\path.py", line 29, in
<module>
from IPython.utils.process import system
File "C:\Chris\Python27\lib\site-packages\IPython\utils\process.py", line 25,
in <module>
from ._process_win32 import _find_cmd, system, getoutput, AvoidUNCPath, arg
split
File "C:\Chris\Python27\lib\site-packages\IPython\utils\_process_win32.py", l
ne 21, in <module>
import ctypes
File "C:\Chris\Python27\lib\ctypes\__init__.py", line 10, in <module>
from _ctypes import Union, Structure, Array
ImportError: Module use of python26.dll conflicts with this version of Python.
I tested the script by running it line by line in the st2 shell itself and it is the last line call([...]) that causes the error. I find this a little strange since the command works ok when calling it from somewhere else, e.g. ipython itself.
There seems to be a conflict with the st2 native python. In any case I managed to get os.system(...) to work when changing the working directory using os.chdir().

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