dnspython 1.11.1 EmptyLabel exception in python 2.7.6 - python

I just installed dnspython using "pip install dnspython". I then opened up a python shell and tried the following code:
import dns.resolver
answers = dns.resolver.query('dnspython.org', 'MX')
and am immediately getting the following:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "dns/resolver.py", line 973, in query
return get_default_resolver().query(qname, rdtype, rdclass, tcp, source,
File "dns/resolver.py", line 961, in get_default_resolver
default_resolver = Resolver()
File "dns/resolver.py", line 489, in __init__
self.read_resolv_conf(filename)
File "dns/resolver.py", line 540, in read_resolv_conf
self.search.append(dns.name.from_text(suffix))
File "dns/name.py", line 638, in from_text
raise EmptyLabel
dns.name.EmptyLabel
I am on OSX Mavericks using python 2.7.6, pip version 1.5.4, and dnspython version 1.11.1

It looks like you might have some DNS issues locally or permissions issue. Can you make sure you have your network DNS pages setup correctly.

Related

Oct2Py - OSError: Octave not found, please see README - Mac M1

I am aware of this similar question, but that is on Windows and not for Mac M1, and their solution didn't work for me.
Aim
I would like to be able to use the python package oct2py.
Set Up and Problem
I have a new Mac M1. I have installed Anaconda using the 64-Bit (M1) Graphical Installer (316 MB). I have created an environment env-name, activated it, and installed oct2py using the command conda install -c conda-forge oct2py. In Python, when running from oct2py import octave or simply import oct2py it fails with the following traceback
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/anaconda3/envs/env-name/lib/python3.10/site-packages/oct2py/__init__.py", line 38, in <module>
octave = Oct2Py()
File "/opt/anaconda3/envs/env-name/lib/python3.10/site-packages/oct2py/core.py", line 83, in __init__
self.restart()
File "/opt/anaconda3/envs/env-name/lib/python3.10/site-packages/oct2py/core.py", line 533, in restart
self._engine = OctaveEngine(stdin_handler=self._handle_stdin,
File "/opt/anaconda3/envs/env-name/lib/python3.10/site-packages/octave_kernel/kernel.py", line 173, in __init__
self.executable = self._get_executable()
File "/opt/anaconda3/envs/env-name/lib/python3.10/site-packages/octave_kernel/kernel.py", line 472, in _get_executable
raise OSError('octave not found, please see README')
OSError: octave not found, please see README

uninstall/re-install of poetry package manager not working due to missing pyvenv.config

OS: Windows 11, Python version: 3.10.3
Initial poetry install via Powershell command:
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python -
Had some problems with initial install, so ran uninstall with no problems. However, on attempting to reinstall, got the following message:
Installing Poetry (1.1.13)
Installing Poetry (1.1.13): Creating environment
Actual environment location may have moved due to redirects, links or junctions.
Requested location: "C:\Users\321gp\AppData\Roaming\pypoetry\venv\Scripts\python.exe"
Actual location: "C:\Users\321gp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\Roaming\pypoetry\venv\Scripts\python.exe"
Actual environment location may have moved due to redirects, links or junctions.
Requested location: "C:\Users\321gp\AppData\Roaming\pypoetry\venv\Scripts\python.exe"
Actual location: "C:\Users\321gp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\Roaming\pypoetry\venv\Scripts\python.exe"
Installing Poetry (1.1.13): An error occurred. Removing partial environment.
Poetry installation failed.
See C:\Users\321gp\poetry-installer-error-2yr835li.log for error logs.
Error log contains the following:
No pyvenv.cfg file
Traceback:
File "<stdin>", line 879, in main
File "<stdin>", line 515, in run
File "<stdin>", line 536, in install
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1008.0_x64__qbz5n2kfra8p0\lib\contextlib.py", line 135, in __enter__
return next(self.gen)
File "<stdin>", line 608, in make_env
File "<stdin>", line 594, in make_env
File "<stdin>", line 326, in make
File "<stdin>", line 349, in pip
File "<stdin>", line 346, in python
File "<stdin>", line 339, in run
Checking the links listed, C:\Users\... \Roaming\pypoetry\venv\ does not exist.
Suggestions on how to correct this?

TypeError from pip when setting up virtualenv

new to coding and I think I've searched thoroughly for answers to this question, but the suggested solutions haven't been working for me. Apologies if this is a duplicate, though!
I'm trying to set up my computer according to these instructions, currently trying to get virtualenv up and running. However, pip doesn't seem to be working properly. I was able to use python -m pip as a workaround and installed virtualenv using: python -m pip install virtualenv
But the same workaround doesn't seem to work with virtualenvwrapper: python -m pip install virtualenvwrapper gives me this error:
Exception:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/commands/install.py", line 324, in run
requirement_set.prepare_files(finder)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req/req_set.py", line 634, in _prepare_file
abstract_dist.prep_for_dist()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req/req_set.py", line 129, in prep_for_dist
self.req_to_install.run_egg_info()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req/req_install.py", line 412, in run_egg_info
self.setup_py, self.name,
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req/req_install.py", line 387, in setup_py
import setuptools # noqa
File "/Library/Python/2.7/site-packages/setuptools/__init__.py", line 12, in <module>
import setuptools.version
File "/Library/Python/2.7/site-packages/setuptools/version.py", line 1, in <module>
import pkg_resources
File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 72, in <module>
import packaging.requirements
File "/Library/Python/2.7/site-packages/packaging/requirements.py", line 59, in <module>
MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
TypeError: __call__() takes exactly 2 arguments (1 given)
If I try running anything directly with a pip command, such as pip install virtualenvwrapper, I get this error:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 72, in <module>
import packaging.requirements
File "/Library/Python/2.7/site-packages/packaging/requirements.py", line 59, in <module>
MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
TypeError: __call__() takes exactly 2 arguments (1 given)
I have a mac running Sierra (10.12.4). Python version 2.7.6. Pip 9.0.1
Thoughts? Thank you!

Firefox Add-on SDK error

I try to launch:cfx runbut I'm getting following error:
(C:\Users\michal smoczyk\Downloads\addon-sdk-1.14) C:\Users\michal smoczyk\Downloads\addon-sdk-1.14\my-addon>cfx run
Using binary at 'C:\Program Files\Mozilla Firefox\firefox.exe'.
Using profile at 'c:\users\michal~1\appdata\local\temp\tmpkcrwv7.mozrunner'.
Traceback (most recent call last):
File "C:\Users\michal smoczyk\Downloads\addon-sdk-1.14\bin\cfx", line 33, in <module>
cuddlefish.run()
File "C:\Users\michal smoczyk\Downloads\addon-sdk-1.14\python-lib\cuddlefish\__init__.py", line 928, in run
bundle_sdk=options.bundle_sdk)
File "C:\Users\michal smoczyk\Downloads\addon-sdk-1.14\python-lib\cuddlefish\runner.py", line 706, in run_app
runner.start()
File "C:\Users\michal smoczyk\Downloads\addon-sdk-1.14\python-lib\mozrunner\__init__.py", line 529, in start
self.process_handler = run_command(self.command+self.cmdargs, self.env, **self.kp_kwargs)
File "C:\Users\michal smoczyk\Downloads\addon-sdk-1.14\python-lib\mozrunner\__init__.py", line 59, in run_command
return killableprocess.Popen(cmd, env=env, **killable_kwargs)
File "C:\Python27\lib\subprocess.py", line 709, in __init__
errread, errwrite)
TypeError: _execute_child() takes exactly 17 arguments (18 given)
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "C:\Python27\lib\atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "C:\Users\michal smoczyk\Downloads\addon-sdk-1.14\python-lib\cuddlefish\runner.py", line 534, in maybe_remove_outfile
os.remove(outfile)
WindowsError: [Error 32] The process cannot access the file because it is being used by another process: 'c:\\users\\michal~1\\appdata\\local\\temp\\harness-stdout-l8remz'
Error in sys.exitfunc:
Traceback (most recent call last):
File "C:\Python27\lib\atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "C:\Users\michal smoczyk\Downloads\addon-sdk-1.14\python-lib\cuddlefish\runner.py", line 534, in maybe_remove_outfile
os.remove(outfile)
WindowsError: [Error 32] The process cannot access the file because it is being used by another process: 'c:\\users\\michal~1\\appdata\\local\\temp\\harness-stdout-l8remz'
My Firefox version: 26. I've installed Python 2.7. OS: Windows Vista, SDK: 1.14
The current 1.15 version of the Add-on SDK seems to be incomaptible with Python 2.7.6.
I got the same error and downgraded to Python 2.7.5 to solve this issue.
Here are some relevant bug reports:
Bug 950894 - [mozprocess] TypeError under windows evironment in cpython 2.7.6
Bug 958609 - Add-on SDK 1.15 incompatible with Python 2.7.6
Update: The bug has been fixed.
I suggest getting the latest version of the SDK (addon-sdk-1.15.zip) from the Mozilla Developer Hub :: Add-ons for Firefox web page. Also make sure to read an follow the instructions in the README file that comes with it (if you haven't already).
One pertinent thing it says is:
If you get an error when running cfx or have any other problems
getting started, see the "Troubleshooting" guide at:
https://addons.mozilla.org/en-US/developers/docs/sdk/latest/dev-guide/tutorials/troubleshooting.html
try to install add-on sdk 1.15 with python 2.6.6 then do this steps
1- Download cp720
2- unzip the zip file.
3- Copy or Move the file cp720.py into your python encodings folder.
Example: C:\Python26\Lib\encodings\

Twisted under windows

Twisted located at C:\Python26\Lib\site-packages\Twisted-11.0.0-py2.6-win32.egg\twisted
but
C:\projects\webmorda>twistd -n morda_server
Traceback (most recent call last):
File "C:\Python26\Scripts\twistd.py", line 4, in <module>
import pkg_resources
File "C:\Python27\lib\site-packages\pkg_resources.py", line 2671, in <module>
working_set.require(__requires__)
File "C:\Python27\lib\site-packages\pkg_resources.py", line 654, in require
needed = self.resolve(parse_requirements(requirements))
File "C:\Python27\lib\site-packages\pkg_resources.py", line 552, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: twisted==11.0.0
what's wrong?
It looks like you have installed Twisted in a Python 2.6 environment but are using Python 2.7 to run it. I think the following command should work:
C:\Python26\python.exe C:\Python26\Scripts\twistd.py -n morda_server
(It looks like the twistd.py script is being run by the python.exe binary associated with the .py file extension - which in your case appears to be Python 2.7. Alternatively you have a PYTHONPATH environment variable set up to point to the Python 2.7 site-packages directory.)

Categories

Resources