I am trying to use the TensorFlow image classifier but halfway through the download my internet connection got lost and I could not download the file.
I understand that I have to delete the partial download and run again to make this work but I am not sure where the file is or how to find it.
I tried searching for the file name "Inception-2015-12-05.tgz" and nothing showed up. My guess is that there is a temporary file name when I downloaded it.
File "classify_image.py", line 227, in <module>
tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 126, in run
_sys.exit(main(argv))
File "classify_image.py", line 190, in main
maybe_download_and_extract()
File "classify_image.py", line 186, in maybe_download_and_extract
tarfile.open(filepath, 'r:gz').extractall(dest_directory)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tarfile.py", line 2007, in extractall
numeric_owner=numeric_owner)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tarfile.py", line 2049, in extract
numeric_owner=numeric_owner)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tarfile.py", line 2119, in _extract_member
self.makefile(tarinfo, targetpath)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tarfile.py", line 2168, in makefile
copyfileobj(source, target, tarinfo.size, ReadError, bufsize)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tarfile.py", line 248, in copyfileobj
buf = src.read(bufsize)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/gzip.py", line 276, in read
return self._buffer.read(size)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/_compression.py", line 68, in readinto
data = self.read(len(byte_view))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/gzip.py", line 482, in read
raise EOFError("Compressed file ended before the "
EOFError: Compressed file ended before the end-of-stream marker was reached
Delete the /tmp/imagenet folder, then restart the download.
Related
I'm trying to make an application with a module python barcode when I compiled it raw it worked well but when I tried to turn it into an exe (using pyinstaller) this gives me the error
File "barcode\base.py", line 67, in save
File "barcode\ean.py", line 95, in render
File "barcode\base.py", line 102, in render
File "barcode\writer.py", line 188, in render
File "barcode\writer.py", line 280, in _paint_text
File "PIL\ImageFont.py", line 959, in truetype
File "PIL\ImageFont.py", line 956, in freetype
File "PIL\ImageFont.py", line 247, in __init__
OSError: cannot open resource
Code that I'm currently running
bar_code = 310400070000555
bar_code = str(bar_code)
bar_code_obj = EAN13(bar_code, writer=ImageWriter())
bar_code_obj.save("bar_code_img")
I had tried a testing version in google colab for uploading the dataframe to gbq but in vs code I had result this error message
File "/usr/local/lib/python3.9/site-packages/pandas_gbq/gbq.py", line 1193, in to_gbq connector.load_data( File "/usr/local/lib/python3.9/site-packages/pandas_gbq/gbq.py", line 586, in load_data chunks = load.load_chunks( File "/usr/local/lib/python3.9/site-packages/pandas_gbq/load.py", line 237, in load_chunks load_parquet( File "/usr/local/lib/python3.9/site-packages/pandas_gbq/load.py", line 129, in load_parquet client.load_table_from_dataframe( File "/usr/local/lib/python3.9/site-packages/google/cloud/bigquery/client.py", line 2671, in load_table_from_dataframe _pandas_helpers.dataframe_to_parquet( File "/usr/local/lib/python3.9/site-packages/google/cloud/bigquery/_pandas_helpers.py", line 586, in dataframe_to_parquet arrow_table = dataframe_to_arrow(dataframe, bq_schema) File "/usr/local/lib/python3.9/site-packages/google/cloud/bigquery/_pandas_helpers.py", line 529, in dataframe_to_arrow bq_to_arrow_array(get_column_or_index(dataframe, bq_field.name), bq_field) File "/usr/local/lib/python3.9/site-packages/google/cloud/bigquery/_pandas_helpers.py", line 290, in bq_to_arrow_array return pyarrow.Array.from_pandas(series, type=arrow_type) File "pyarrow/array.pxi", line 915, in pyarrow.lib.Array.from_pandas File "pyarrow/array.pxi", line 312, in pyarrow.lib.array File "pyarrow/array.pxi", line 83, in pyarrow.lib._ndarray_to_array File "pyarrow/error.pxi", line 122, in pyarrow.lib.check_status pyarrow.lib.ArrowTypeError: Expected bytes, got a 'list' object
Hope to know how to solve this issue and why will to able to run in colab but error in vscode?
I hope to know how to solve this issue and why will it happen. Thank you very much
I'm trying to read a Excel file (.xlsx) and I'm getting the error "IndexError: list index out of range". My code is simple:
import pandas as pd
pd.read_excel(r'M:\PUBLIC\Felipe Dias\ONS\DIARIO_16-11-2021.xlsx')
The error:
File "<ipython-input-16-fd0112985376>", line 2, in <module>
pd.read_excel(r'M:\PUBLIC\Felipe Dias\ONS\DIARIO_16-11-2021.xlsx')
File "C:\Users\Felipe.dias\Anaconda3\lib\site-packages\pandas\util\_decorators.py", line 311, in wrapper
return func(*args, **kwargs)
File "C:\Users\Felipe.dias\Anaconda3\lib\site-packages\pandas\io\excel\_base.py", line 364, in read_excel
io = ExcelFile(io, storage_options=storage_options, engine=engine)
File "C:\Users\Felipe.dias\Anaconda3\lib\site-packages\pandas\io\excel\_base.py", line 1233, in __init__
self._reader = self._engines[engine](self._io, storage_options=storage_options)
File "C:\Users\Felipe.dias\Anaconda3\lib\site-packages\pandas\io\excel\_openpyxl.py", line 522, in __init__
super().__init__(filepath_or_buffer, storage_options=storage_options)
File "C:\Users\Felipe.dias\Anaconda3\lib\site-packages\pandas\io\excel\_base.py", line 420, in __init__
self.book = self.load_workbook(self.handles.handle)
File "C:\Users\Felipe.dias\Anaconda3\lib\site-packages\pandas\io\excel\_openpyxl.py", line 533, in load_workbook
return load_workbook(
File "C:\Users\Felipe.dias\Anaconda3\lib\site-packages\openpyxl\reader\excel.py", line 317, in load_workbook
reader.read()
File "C:\Users\Felipe.dias\Anaconda3\lib\site-packages\openpyxl\reader\excel.py", line 281, in read
apply_stylesheet(self.archive, self.wb)
File "C:\Users\Felipe.dias\Anaconda3\lib\site-packages\openpyxl\styles\stylesheet.py", line 198, in apply_stylesheet
stylesheet = Stylesheet.from_tree(node)
File "C:\Users\Felipe.dias\Anaconda3\lib\site-packages\openpyxl\styles\stylesheet.py", line 103, in from_tree
return super(Stylesheet, cls).from_tree(node)
File "C:\Users\Felipe.dias\Anaconda3\lib\site-packages\openpyxl\descriptors\serialisable.py", line 103, in from_tree
return cls(**attrib)
File "C:\Users\Felipe.dias\Anaconda3\lib\site-packages\openpyxl\styles\stylesheet.py", line 94, in __init__
self.named_styles = self._merge_named_styles()
File "C:\Users\Felipe.dias\Anaconda3\lib\site-packages\openpyxl\styles\stylesheet.py", line 114, in _merge_named_styles
self._expand_named_style(style)
File "C:\Users\Felipe.dias\Anaconda3\lib\site-packages\openpyxl\styles\stylesheet.py", line 124, in _expand_named_style
xf = self.cellStyleXfs[named_style.xfId]
File "C:\Users\Felipe.dias\Anaconda3\lib\site-packages\openpyxl\styles\cell_style.py", line 185, in __getitem__
return self.xf[idx]
IndexError: list index out of range
Maybe the Excel file is not proberly formatted, as stated here and here. But when I manually save the Excel file, the file is a "Excel Workbook (*.xlsx)" not a "Strict XML Open Spreadsheet", like in those other questions:
Print Screen: saving the Excel file manually
I downloaded this file from the web, so maybe the file is broken, but I don't know how to check it.
Thanks for your attention!
Edit 1:
Here is a print screen from the website's HTML
I don't know HTML, but I found strange that the file id is "xls-link" and its href is "./Html/DIARIO_16-11-2021.xlsx".
Like #Wayne said, when he downloaded the file, it came as .xls. After reading this answer, I tried running
pd.read_excel(r'M:\PUBLIC\Felipe Dias\ONS\DIARIO_16-11-2021.xls')
And got the error "[Errno 2] No such file or directory: 'M:\PUBLIC\Felipe Dias\ONS\DIARIO_16-11-2021.xls' "
Then I tried to open the file manually and save it as .xls. After running the code above, it actually worked!
But now my problem is: I will have to manually open and save as .xls all +5000 daily files that I need, which is a tedious quest. Does anyone know how I could do this automatically (without actually open it, because I still can't figure it out)?
I have made a simple application/GUI using PyQt5 that draws a map using Cartopy and allows users to drop points on the map. Everything works fine when I have access to Wifi. I used pyinstaller to bundle it up as one application so I can send it to my friends.
However, if you do not have access to the internet, cartopy is unable to draw the map because it cannot access the shapefiles which it downloads into the ~.local/share/cartopy/shapefiles location. I tried including the shapefiles using the --add-data command in pyinstaller but it didn't work?
I used sys._MEIPASS to include a CSV of other data, and it works just fine to read that data (coordinates of some landmarks).
The error looks something like:
File "site-packages\matplotlib\backends\backend_agg.py", line 393, in draw
File "site-packages\matplotlib\artist.py", line 38, in draw_wrapper
File "site-packages\matplotlib\figure.py", line 1735, in draw
File "site-packages\matplotlib\image.py", line 137, in _draw_list_compositing_images
File "site-packages\matplotlib\artist.py", line 38, in draw_wrapper
File "site-packages\cartopy\mpl\geoaxes.py", line 479, in draw
File "site-packages\matplotlib\artist.py", line 38, in draw_wrapper
File "site-packages\matplotlib\axes\_base.py", line 2630, in draw
File "site-packages\matplotlib\image.py", line 137, in _draw_list_compositing_images
File "site-packages\matplotlib\artist.py", line 38, in draw_wrapper
File "site-packages\cartopy\mpl\feature_artist.py", line 155, in draw
File "site-packages\cartopy\feature\__init__.py", line 302, in intersecting_geometries
File "site-packages\cartopy\feature\__init__.py", line 110, in intersecting_geometries
File "site-packages\cartopy\feature\__init__.py", line 284, in geometries
File "site-packages\cartopy\io\shapereader.py", line 295, in natural_earth
File "site-packages\cartopy\io\__init__.py", line 222, in path
File "site-packages\cartopy\io\shapereader.py", line 350, in acquire_resource
File "site-packages\cartopy\io\__init__.py", line 261, in _urlopen
File "urllib\request.py", line 222, in urlopen
File "urllib\request.py", line 525, in open
File "urllib\request.py", line 542, in _open
File "urllib\request.py", line 502, in _call_chain
File "urllib\request.py", line 1393, in https_open
File "urllib\request.py", line 1353, in do_open
urllib.error.URLError: <urlopen error [Errno 11001] getaddrinfo failed>
In the code itself, I have:
os.chdir(sys._MEIPASS)
datapath1 = 'data\\ne_50m_coastline.shp'
And further below
coastline = datapath1
map.add_feature(coastline, zorder=3)
But, as shown in the error above, when I run the executable with no internet access, it does not find the shapefile included in the exe onefile.
Thanks in advance for any help!
I'm trying to run TensorFlow's translate.py file, but after a few seconds already I keep getting this error:
tarfile.ReadError: unexpected end of data
I have no idea why this happens and I've tried several things, including downloading the needed data myself and comment the line in the code that do the downloading, but nothing worked.
Here is the site that I follow:
https://www.tensorflow.org/tutorials/seq2seq
And just in case you need everything, here are the lines from the command to the error:
C:\Users\Mueller>python translate.py
Preparing WMT data in /tmp
Extracting tar file /tmp\training-giga-fren.tar
Traceback (most recent call last):
File "translate.py", line 322, in <module>
tf.app.run()
File "C:\Users\Mueller\AppData\Local\Programs\Python\Python35\lib\site-package
s\tensorflow\python\platform\app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "translate.py", line 319, in main
train()
File "translate.py", line 173, in train
FLAGS.data_dir, FLAGS.from_vocab_size, FLAGS.to_vocab_size)
File "C:\Users\Mueller\data_utils.py", line 267, in prepare_wmt_data
train_path = get_wmt_enfr_train_set(data_dir)
File "C:\Users\Mueller\data_utils.py", line 83, in get_wmt_enfr_train_set
corpus_tar.extractall(directory)
File "C:\Users\Mueller\AppData\Local\Programs\Python\Python35\lib\tarfile.py",
line 1996, in extractall
numeric_owner=numeric_owner)
File "C:\Users\Mueller\AppData\Local\Programs\Python\Python35\lib\tarfile.py",
line 2038, in extract
numeric_owner=numeric_owner)
File "C:\Users\Mueller\AppData\Local\Programs\Python\Python35\lib\tarfile.py",
line 2108, in _extract_member
self.makefile(tarinfo, targetpath)
File "C:\Users\Mueller\AppData\Local\Programs\Python\Python35\lib\tarfile.py",
line 2156, in makefile
copyfileobj(source, target, tarinfo.size, ReadError)
File "C:\Users\Mueller\AppData\Local\Programs\Python\Python35\lib\tarfile.py",
line 243, in copyfileobj
raise exception("unexpected end of data")
tarfile.ReadError: unexpected end of data
Does anybody know what is happening here?
If your machine is running behind a proxy server, its possible that the downloaded tar file maybe getting stripped/blocked by proxy server, resulting in corrupted downloaded file.