According to PEP440, it seems the following format below is a valid version string:
X.Y.postN # Post-release
But when I use something like: 1.0.post1, I get the following exception in pbr.
(I'm using the pbr version 0.11.0)
ERROR:root:Error parsing
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pbr/core.py", line 104, in pbr
attrs = util.cfg_to_args(path)
File "/usr/local/lib/python2.7/dist-packages/pbr/util.py", line 238, in cfg_to_args
pbr.hooks.setup_hook(config)
File "/usr/local/lib/python2.7/dist-packages/pbr/hooks/__init__.py", line 27, in setup_hook
metadata_config.run()
File "/usr/local/lib/python2.7/dist-packages/pbr/hooks/base.py", line 29, in run
self.hook()
File "/usr/local/lib/python2.7/dist-packages/pbr/hooks/metadata.py", line 28, in hook
self.config['name'], self.config.get('version', None))
File "/usr/local/lib/python2.7/dist-packages/pbr/packaging.py", line 1009, in get_version
version = _get_version_from_git(pre_version)
File "/usr/local/lib/python2.7/dist-packages/pbr/packaging.py", line 947, in _get_version_from_gitpre_version)
File "/usr/local/lib/python2.7/dist-packages/pbr/version.py", line 236, in from_pip_string
% (remainder, version_string))
ValueError: Unknown remainder ['post1'] in '1.0.post1'
error in setup command: Error parsing /home/admin/mypackage/setup.cfg:
ValueError: Unknown remainder ['post1'] in '1.0.post1'
Anybody knows why that format is not supported in PBR?
Ref the docs: http://docs.openstack.org/developer/pbr/#version
The versions should be compatible with "Linux Compatible Semantic Versioning 3.0.0": http://docs.openstack.org/developer/pbr/semver.html
Related
Upgraded MetPy to 1.1 and my ability to produce satellite images from a THREDDS server is no longer working. I isolated the part that is causing me issues.
Example:
#!/usr/bin/python3
import metpy
from siphon.catalog import TDSCatalog
cat_e = TDSCatalog('https://thredds.ucar.edu/thredds/catalog/satellite/goes/east/products/CloudAndMoistureImagery/FullDisk/Channel09/current/catalog.xml')
nc_e = cat_e.datasets[0].remote_access(use_xarray=True)
data_e = nc_e.metpy.parse_cf('Sectorized_CMI')
yields the following output/error
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/metpy/xarray.py", line 785, in _rebuild_coords
var = var.metpy.convert_coordinate_units(coord_name, 'meters')
File "/usr/local/lib/python3.6/dist-packages/metpy/xarray.py", line 190, in convert_coordinate_units
data=self._data_array[coord].metpy.unit_array.m_as(units)
File "/usr/local/lib/python3.6/dist-packages/pint/quantity.py", line 386, in m_as
return self.to(units).magnitude
File "/usr/local/lib/python3.6/dist-packages/pint/quantity.py", line 591, in to
magnitude = self._convert_magnitude_not_inplace(other, *contexts, **ctx_kwargs)
File "/usr/local/lib/python3.6/dist-packages/pint/quantity.py", line 540, in _convert_magnitude_not_inplace
return self._REGISTRY.convert(self._magnitude, self._units, other)
File "/usr/local/lib/python3.6/dist-packages/pint/registry.py", line 925, in convert
return self._convert(value, src, dst, inplace)
File "/usr/local/lib/python3.6/dist-packages/pint/registry.py", line 1762, in _convert
return super()._convert(value, src, dst, inplace)
File "/usr/local/lib/python3.6/dist-packages/pint/registry.py", line 1376, in _convert
return super()._convert(value, src, dst, inplace)
File "/usr/local/lib/python3.6/dist-packages/pint/registry.py", line 958, in _convert
raise DimensionalityError(src, dst, src_dim, dst_dim)
pint.errors.DimensionalityError: Cannot convert from 'microradian' (dimensionless) to 'meter' ([length])
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/data/home/met_scheduler/scripts/satellite/satellite_metpy11.py", line 8, in <module>
data_e = nc_e.metpy.parse_cf('Sectorized_CMI')
File "/usr/local/lib/python3.6/dist-packages/metpy/xarray.py", line 774, in parse_cf
var = self._rebuild_coords(var, crs)
File "/usr/local/lib/python3.6/dist-packages/metpy/xarray.py", line 797, in _rebuild_coords
var = var.assign_coords(coords={coord_name: new_coord_var})
File "/data/home/met_scheduler/.local/lib/python3.6/site-packages/xarray/core/common.py", line 349, in assign_coords
data.coords.update(results)
File "/data/home/met_scheduler/.local/lib/python3.6/site-packages/xarray/core/coordinates.py", line 90, in update
priority_arg=1, indexes=self.indexes)
File "/data/home/met_scheduler/.local/lib/python3.6/site-packages/xarray/core/merge.py", line 362, in merge_coords
expanded = expand_variable_dicts(aligned)
File "/data/home/met_scheduler/.local/lib/python3.6/site-packages/xarray/core/merge.py", line 222, in expand_variable_dicts
var = as_variable(var, name=name)
File "/data/home/met_scheduler/.local/lib/python3.6/site-packages/xarray/core/variable.py", line 96, in as_variable
"variable %r has invalid type %r" % (name, type(obj)))
TypeError: variable 'coords' has invalid type <class 'dict'>
I appreciate any thoughts on how to get around this.
Can you double check that your Python installation with MetPy is correct? I was able to run your code fine on my local install of MetPy 1.1.0 with Python 3.9. Also, your traceback shows Python 3.6 being used; MetPy 1.1.0 only supports Python >=3.7. You should not have been able to install MetPy 1.1.0 with that version of Python.
You can confirm the version of MetPy being used by adding the following to your script:
print(metpy.__version__)
I have installed librosa correctly with pip3 on ubuntu subsystem on windows, but when I try to execute a simple program like this one:
import librosa
data, sr = librosa.load('sound.mp3')
print(data.shape)
It is what happens:
/home/henistein/librosa/librosa/core/audio.py:144: UserWarning: PySoundFile failed. Trying audioread instead.
warnings.warn('PySoundFile failed. Trying audioread instead.')
Traceback (most recent call last):
File "/home/henistein/librosa/librosa/core/audio.py", line 128, in load
with sf.SoundFile(path) as sf_desc:
File "/home/henistein/.local/lib/python3.8/site-packages/soundfile.py", line 740, in __init__
self._file = self._open(file, mode_int, closefd)
File "/home/henistein/.local/lib/python3.8/site-packages/soundfile.py", line 1264, in _open
_error_check(_snd.sf_error(file_ptr),
File "/home/henistein/.local/lib/python3.8/site-packages/soundfile.py", line 1455, in _error_check
raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace'))
RuntimeError: Error opening 'sound.mp3': File contains data in an unknown format.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "PerfectPitch.py", line 2, in <module>
data, sr = librosa.load('sound.mp3')
File "/home/henistein/librosa/librosa/core/audio.py", line 145, in load
y, sr_native = __audioread_load(path, offset, duration, dtype)
File "/home/henistein/librosa/librosa/core/audio.py", line 169, in __audioread_load
with audioread.audio_open(path) as input_file:
File "/home/henistein/.local/lib/python3.8/site-packages/audioread/__init__.py", line 116, in audio_open
raise NoBackendError()
audioread.exceptions.NoBackendError
What am I doing wrong?
According to the manual you'll probably also need to install ffmpeg, to allow for librosa to decode various formats.
Since you're working in the Ubuntu subsystem, simply
apt install ffmpeg
should do the trick.
I recently installed yahoo_fin and I tired the following example:
get_calls('NFLX' ')
It worked. I then tired the following:
get_calls('NFLX', '11/8/2019')
It failed. Here is what I got:
get_calls('NFLX', '11/8/2019')
Traceback (most recent call last):
File "", line 1, in
get_calls('NFLX', '11/8/2019')
File "C:\Users\rsher\Anaconda3\lib\site-packages\yahoo_fin\options.py", line 48, in get_calls
options_chain = get_options_chain(ticker, date)
File "C:\Users\rsher\Anaconda3\lib\site-packages\yahoo_fin\options.py", line 32, in get_options_chain
tables = pd.read_html(site)
File "C:\Users\rsher\Anaconda3\lib\site-packages\pandas\io\html.py", line 906, in read_html
keep_default_na=keep_default_na)
File "C:\Users\rsher\Anaconda3\lib\site-packages\pandas\io\html.py", line 743, in _parse
raise_with_traceback(retained)
File "C:\Users\rsher\Anaconda3\lib\site-packages\pandas\compat__init__.py", line 344, in raise_with_traceback
raise exc.with_traceback(traceback)
ValueError: No tables found
I am using version 3.6.3 of Python and I am also using Spyder.
Am I doing something wrong? Do you think I have found a bug?
I updated my version of yahoo_fin. Not really sure it was out of date. I now get the following error messages when I run the command: get_calls("nflx", "1/31/20")
Traceback (most recent call last):
File "", line 1, in
get_calls("nflx", "1/31/20")
File "C:\Users\rsher\Anaconda3\lib\site-packages\yahoo_fin\options.py", line 48, in get_calls
options_chain = get_options_chain(ticker, date)
File "C:\Users\rsher\Anaconda3\lib\site-packages\yahoo_fin\options.py", line 32, in get_options_chain
tables = pd.read_html(site)
File "C:\Users\rsher\Anaconda3\lib\site-packages\pandas\io\html.py", line 906, in read_html
keep_default_na=keep_default_na)
File "C:\Users\rsher\Anaconda3\lib\site-packages\pandas\io\html.py", line 743, in _parse
raise_with_traceback(retained)
File "C:\Users\rsher\Anaconda3\lib\site-packages\pandas\compat__init__.py", line 344, in raise_with_traceback
raise exc.with_traceback(traceback)
ValueError: No tables found
It should work the way you have it.
from yahoo_fin.options import get_calls
get_calls("nflx", "1/31/20")
Are you using the most recent version of yahoo_fin? It should be (as of this writing) version 0.8.4. Another possible issue is that there could have been a problem with Yahoo Finance's page for that option chain at that particular time.
I downloaded the ansible-2.0.0-0.2.alpha2.tar.gz and installed it on my control machine. However now I'm not able to ping any of my machines. Previously using v1.9.2 i could communicate with them. Now it gives the following error:
Unexpected Exception: lstat() argument 1 must be encoded string without NULL bytes, not str
the full traceback was:
Traceback (most recent call last):
File "/usr/bin/ansible", line 79, in
sys.exit(cli.run())
File "/usr/lib/python2.6/site-packages/ansible/cli/adhoc.py", line 111, in run
inventory = Inventory(loader=loader, variable_manager=variable_manager, host_list=self.options.inventory)
File "/usr/lib/python2.6/site-packages/ansible/inventory/init.py", line 77, in init
self.parse_inventory(host_list)
File "/usr/lib/python2.6/site-packages/ansible/inventory/init.py", line 133, in parse_inventory
host.vars = combine_vars(host.vars, self.get_host_variables(host.name))
File "/usr/lib/python2.6/site-packages/ansible/inventory/init.py", line 499, in get_host_variables
self.vars_per_host[hostname] = self.get_host_variables(hostname, vault_password=vault_password)
File "/usr/lib/python2.6/site-packages/ansible/inventory/__init.py", line 529, in get_host_variables
vars = combine_vars(vars, self.get_host_vars(host))
File "/usr/lib/python2.6/site-packages/ansible/inventory/__init_.py", line 653, in get_host_vars
return self.get_hostgroup_vars(host=host, group=None, new_pb_basedir=new_pb_basedir)
File "/usr/lib/python2.6/site-packages/ansible/inventory/__init_.py", line 702, in _get_hostgroup_vars
base_path = os.path.realpath(os.path.join(basedir, "host_vars/%s" % host.name))
File "/usr/lib64/python2.6/posixpath.py", line 365, in realpath
if islink(component):
File "/usr/lib64/python2.6/posixpath.py", line 132, in islink
st = os.lstat(path)
TypeError: lstat() argument 1 must be encoded string without NULL bytes, not str
Any help would be appreciated.
This is a known bug due to some Unicode changes made to the playbook parser in 2.0. Several versions of Python shipped with a version of shlex.split() that fails horribly on Unicode input- you likely have one of them installed. The bug has been worked around and will be included in the next drop. See https://github.com/ansible/ansible/issues/12257
I'am playing around with scapy but i cant get it to work. I tried different code's but all gave me the same output:
Traceback (most recent call last):
File "<module1>", line 7, in <module>
File "C:\Python26\lib\site-packages\scapy\sendrecv.py", line 357, in srp
s = conf.L2socket(iface=iface, filter=filter, nofilter=nofilter, type=type)
File "C:\Python26\lib\site-packages\scapy\arch\pcapdnet.py", line 313, in __init__
self.outs = dnet.eth(iface)
File "dnet.pyx", line 112, in dnet.eth.__init__
OSError: Result too large
Iam using python 2.6 with all dependencies installed for scapy.
How to fix this?