torchfile.T7ReaderException - python

I'm working on Windows 10. I get this issue:
DATAPATH: ../data/coco/test/val_captions.t7
Traceback (most recent call last):
File "main.py", line 77, in <module>
algo.sample(datapath, cfg.STAGE)
File "D:\documenti\Monica\StackGAN-Pytorch\code\trainer.py", line 243, in sample
t_file = torchfile.load(datapath)
File "C:\Users\Utente\venv\lib\site-packages\torchfile.py", line 424, in load
return reader.read_obj()
File "C:\Users\Utente\venv\lib\site-packages\torchfile.py", line 386, in read_obj
v = self.read_obj()
File "C:\Users\Utente\venv\lib\site-packages\torchfile.py", line 386, in read_obj
v = self.read_obj()
File "C:\Users\Utente\venv\lib\site-packages\torchfile.py", line 414, in read_obj
"unknown object type / typeidx: {}".format(typeidx))
torchfile.T7ReaderException: unknown object type / typeidx: -1112529805
Can anyone help me?
I installed python 3.6.8, pytorch, torchfile, torchvision, etc., and I'm working on virtualenv.

Related

Error creating Satellite images from THREDDS server after MetPy 0.12->1.1 upgrade

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__)

How to use dates in the yahoo_fin Python Package

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.

vboxapi COM API not working

I have the virtualbox 5.0.10 Python sdk in my source root, but when I run my code the program will fail:
Traceback (most recent call last):
File "C:/Users/xiao/.PyCharm50/config/scratches/scratch", line 2, in <module>
mgr=vboxapi.VirtualBoxManager()
File "C:\Users\xiao\Desktop\test\vboxapi\__init__.py", line 1018, in __init__
self.platform = PlatformMSCOM(dPlatformParams)
File "C:\Users\xiao\Desktop\test\vboxapi\__init__.py", line 513, in __init__
win32com.client.gencache.EnsureDispatch('VirtualBox.Session')
File "C:\Python27\lib\site-packages\win32com\client\gencache.py", line 540, in EnsureDispatch
disp_class = CLSIDToClass.GetClass(str(disp_clsid))
File "C:\Python27\lib\site-packages\win32com\client\CLSIDToClass.py", line 46, in GetClass
return mapCLSIDToClass[clsid]
KeyError: '{7844AA05-B02E-4CDD-A04F-ADE4A762E6B7}'
Here is my code: (really simple, right?)
import vboxapi
mgr=vboxapi.VirtualBoxManager()
This program is buggy under Python 2.7.6, but runabble under Python 3.4.0.
Why? How can I fix that?

Decompyle .pyc failed

From my pyc file I got an error:
>>> from decompile import main
>>> main('','.',['D:\\uiexchange.pyc'])
### Can't decompyle D:\uiexchange.pyc
Traceback (most recent call last):
File "<pyshell#1>", line 1, in ?
main('','.',['D:\\uiexchange.pyc'])
File "decompile\__init__.py", line 161, in main
decompyle_file(infile, outstream, showasm, showast)
File "decompile\__init__.py", line 101, in decompyle_file
version, co = _load_module(filename)
File "decompile\__init__.py", line 49, in _load_module
co = marshal.load(fp)
ValueError: bad marshal data
this is my pyc file
http://www5.zippyshare.com/v/92967047/file.html
maybe do you know why I got this error, and how to fix it ?

OSError: Result too large

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?

Categories