Every "az" commands are now failing, how do I fix it? - azure

I managed to break az, by using CTRL-C after the command "az login". Now, all I can get is this message :
Traceback (most recent call last):
File "runpy.py", line 193, in _run_module_as_main
File "runpy.py", line 85, in _run_code
File "C:\Users\trdai\AppData\Local\Temp\pip-install-8jgnm5o1\azure-cli\azure\cli\__main__.py", line 32, in <module>
File "C:\Users\trdai\AppData\Local\Temp\pip-install-8jgnm5o1\azure-cli-core\azure\cli\core\__init__.py", line 509, in get_default_cli
File "C:\Users\trdai\AppData\Local\Temp\pip-install-8jgnm5o1\azure-cli-core\azure\cli\core\__init__.py", line 52, in __init__
File "C:\Users\trdai\AppData\Local\Temp\pip-install-8jgnm5o1\azure-cli-core\azure\cli\core\_session.py", line 40, in load
File "json\__init__.py", line 299, in load
File "json\__init__.py", line 354, in loads
File "json\decoder.py", line 339, in decode
File "json\decoder.py", line 357, in raw_decode
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
The command I use to get this message
Any idea on how to clean the cache? I already tried to reinstall, to repair, to remove and reinstall again, with no success.
Thanks in advance.

In this case cleaning the temp folder (/home/user/.azure) solved the problem

Related

PyInstaller --onefile is throwing file not found error

I am trying to make an executable of a python 3.10 file using PyInstaller in the command prompt:
python -m PyInstaller --onefile 1.0.py
with "1.0" being my file name. I have done this many times before on the same PC and with the same python version, but for this file it is throwing a "file specified not found" error:
while run_next_command(read_fh, write_fh):
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\jackp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\PyInstaller\__main__.py", line 188, in <module>
run()
File "C:\Users\jackp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\PyInstaller\__main__.py", line 178, in run
run_build(pyi_config, spec_file, **vars(args))
File "C:\Users\jackp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\PyInstaller\__main__.py", line 59, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "C:\Users\jackp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\PyInstaller\building\build_main.py", line 934, in main
build(specfile, distpath, workpath, clean_build)
File "C:\Users\jackp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\PyInstaller\building\build_main.py", line 856, in build
exec(code, spec_namespace)
File "E:\Python Scripts\High Spen\Combined\1.0.spec", line 7, in <module>
a = Analysis(
File "C:\Users\jackp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\PyInstaller\building\build_main.py", line 381, in __init__
self.__postinit__()
File "C:\Users\jackp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\PyInstaller\building\datastruct.py", line 173, in __postinit__
self.assemble()
File "C:\Users\jackp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\PyInstaller\building\build_main.py", line 660, in assemble
isolated.call(find_binary_dependencies, list(self.binaries), self.binding_redirects, collected_packages)
File "C:\Users\jackp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\PyInstaller\isolated\_parent.py", line 238, in call
return isolated.call(function, *args, **kwargs)
File "C:\Users\jackp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\PyInstaller\isolated\_parent.py", line 176, in call
raise RuntimeError(f"Child process call to {function.__name__}() failed with:\n" + output)
RuntimeError: Child process call to find_binary_dependencies() failed with:
File "C:\Users\jackp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\win32ctypes\pywin32\pywintypes.py", line 35, in pywin32error
yield
File "C:\Users\jackp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\win32ctypes\pywin32\win32api.py", line 43, in LoadLibraryEx
return _dll._LoadLibraryEx(fileName, 0, flags)
File "C:\Users\jackp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\win32ctypes\core\cffi\_dll.py", line 23, in _LoadLibraryEx
result = check_null(
File "C:\Users\jackp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\win32ctypes\core\cffi\_util.py", line 81, in __call__
self._raise_error(function_name)
File "C:\Users\jackp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\win32ctypes\core\cffi\_util.py", line 92, in _raise_error
raise exception
OSError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\jackp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\PyInstaller\isolated\_child.py", line 63, in run_next_command
output = function(*args, **kwargs)
File "C:\Users\jackp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\PyInstaller\building\build_main.py", line 162, in find_binary_dependencies
return bindepend.Dependencies(binaries, redirects=binding_redirects, xtrapath=extra_libdirs)
File "C:\Users\jackp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\PyInstaller\depend\bindepend.py", line 205, in Dependencies
for ftocnm, fn in getAssemblyFiles(pth, manifest, redirects):
File "C:\Users\jackp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\PyInstaller\depend\bindepend.py", line 372, in getAssemblyFiles
for assembly in getAssemblies(pth):
File "C:\Users\jackp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\PyInstaller\depend\bindepend.py", line 326, in getAssemblies
res = winmanifest.GetManifestResources(pth)
File "C:\Users\jackp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\PyInstaller\utils\win32\winmanifest.py", line 979, in GetManifestResources
return winresource.GetResources(filename, [RT_MANIFEST], names, languages)
File "C:\Users\jackp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\PyInstaller\utils\win32\winresource.py", line 155, in GetResources
hsrc = win32api.LoadLibraryEx(filename, 0, LOAD_LIBRARY_AS_DATAFILE)
File "C:\Users\jackp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\win32ctypes\pywin32\win32api.py", line 42, in LoadLibraryEx
with _pywin32error():
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "C:\Users\jackp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\win32ctypes\pywin32\pywintypes.py", line 37, in pywin32error
raise error(exception.winerror, exception.function, exception.strerror)
win32ctypes.pywin32.pywintypes.error: (2, 'LoadLibraryEx', 'The system cannot find the file specified')
Please could someone let me know how I would solve this or otherwise another method of turning this into an .exe. Thanks
Update:
I have tried uninstalling my python 3.10 and downloading 3.7 instead, as I saw somewhere that PyInstaller is incompatible with 3.8 and above, but this still didn't work for another reason. So I reinstalled 3.10 (effectively at this point I have uninstalled and reinstalled my python and IDE) and I am still getting the same error.

jupyter notebook crash with blocking cell running using ipython_blocking

I write a simple jupyter notebook script to block some cells running when need to UI input, such as follows;
when I enter the button, there come out some exceptions like follows;
Traceback (most recent call last):
File "C:\Users\joye\Anaconda3\envs\perf_analysis\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\joye\Anaconda3\envs\perf_analysis\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\joye\Anaconda3\envs\perf_analysis\lib\site-packages\ipykernel_launcher.py", line 16, in <module>
app.launch_new_instance()
File "C:\Users\joye\Anaconda3\envs\perf_analysis\lib\site-packages\traitlets\config\application.py", line 846, in launch_instance
app.start()
File "C:\Users\joye\Anaconda3\envs\perf_analysis\lib\site-packages\ipykernel\kernelapp.py", line 677, in start
self.io_loop.start()
File "C:\Users\joye\Anaconda3\envs\perf_analysis\lib\site-packages\tornado\platform\asyncio.py", line 199, in start
self.asyncio_loop.run_forever()
File "C:\Users\joye\Anaconda3\envs\perf_analysis\lib\asyncio\base_events.py", line 541, in run_forever
self._run_once()
File "C:\Users\joye\Anaconda3\envs\perf_analysis\lib\asyncio\base_events.py", line 1771, in _run_once
handle = self._ready.popleft()
IndexError: pop from an empty deque
I don't know how to solve this exception. Do anyone also meet this problem, thanks!

Tensorflow KeyError for creating train.record for model

I'm current facing this error when creating a train.record file for my. I'm following a guide from Medium
Previously I had no issue but today I have this error
/content/gdrive/MyDrive/TensorFlow/scripts/preprocessing
Traceback (most recent call last):
File "generate_tfrecord.py", line 168, in <module>
tf.app.run()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/platform/app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 300, in run
_run_main(main, args)
File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 251, in _run_main
sys.exit(main(argv))
File "generate_tfrecord.py", line 158, in main
tf_example = create_tf_example(group, path)
File "generate_tfrecord.py", line 132, in create_tf_example
classes.append(class_text_to_int(row['class']))
File "generate_tfrecord.py", line 101, in class_text_to_int
return label_map_dict[row_label]
KeyError: '\\'
Successfully created the TFRecord file: /content/gdrive/MyDrive/TensorFlow/workspace/training_demo/annotations/test.record
I suspect the problem might be with one of the annotation .xml file in my train image folder causing the issue but I can't seem to find any other sources to confirm. Can someone please enlighten me?
Edit: Here is the generate_tfrecord.py for reference if required. Thank you

Tensorflow Hub Model download causes PermissionDeniedError in WSL

In my project, the three following paths refer to the same location:
os.environ["TFHUB_CACHE_DIR"] = "~/my_repos/my_project/data/tfhub_cache/"
os.environ["TFHUB_CACHE_DIR"] = os.path.normpath("./data/tfhub_cache/")
os.environ["TFHUB_CACHE_DIR"] = os.path.normpath(os.path.dirname(__file__) + "../data/tfhub_cache/")
and they are used by the following code:
import tensorflow_hub as hub
embed = hub.load("https://tfhub.dev/google/universal-sentence-encoder/3")
However, the first one works correctly, while the other two, cause the following error:
Downloading pre-trained embeddings from tensorflow hub...
Traceback (most recent call last):
File "/home/my_username/.pyenv/versions/3.7.5/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/home/my_username/.pyenv/versions/3.7.5/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/my_username/my_repos/my_project/my_script.py", line 229, in <module>
embed = hub.load("https://tfhub.dev/google/universal-sentence-encoder/3")
File "/home/my_username/.local/share/virtualenvs/my_project-fkeckdfE/lib/python3.7/site-packages/tensorflow_hub/module_v2.py", line 90, in load
module_path = resolve(handle)
File "/home/my_username/.local/share/virtualenvs/my_project-fkeckdfE/lib/python3.7/site-packages/tensorflow_hub/module_v2.py", line 52, in resolve
return registry.resolver(handle)
File "/home/my_username/.local/share/virtualenvs/my_project-fkeckdfE/lib/python3.7/site-packages/tensorflow_hub/registry.py", line 42, in __call__
return impl(*args, **kwargs)
File "/home/my_username/.local/share/virtualenvs/my_project-fkeckdfE/lib/python3.7/site-packages/tensorflow_hub/compressed_module_resolver.py", line 88, in __call__
self._lock_file_timeout_sec())
File "/home/my_username/.local/share/virtualenvs/my_project-fkeckdfE/lib/python3.7/site-packages/tensorflow_hub/resolver.py", line 414, in atomic_download
tf_v1.gfile.Rename(tmp_dir, module_dir)
File "/home/my_username/.local/share/virtualenvs/my_project-fkeckdfE/lib/python3.7/site-packages/tensorflow_core/python/lib/io/file_io.py", line 504, in rename
rename_v2(oldname, newname, overwrite)
File "/home/my_username/.local/share/virtualenvs/my_project-fkeckdfE/lib/python3.7/site-packages/tensorflow_core/python/lib/io/file_io.py", line 521, in rename_v2
compat.as_bytes(src), compat.as_bytes(dst), overwrite)
tensorflow.python.framework.errors_impl.PermissionDeniedError: /home/my_username/my_repos/my_project/data/tfhub_cache/42480c3c7f42bf87d36d4c58fc4374b08dae2909.dcfe9db0c4ea456b9d3c97359f57ec1a.tmp; Permission denied
Any ideas what is causing this? (I have already chmod -R 777 on the directory!)
The script is ran using pipenv ie. pipenv run python -m scripts.my_script
Ideally, I would like the second one to work, so that other devs who have their repo in different locations are still able to just run the script.

BLE: Executing the bluez test "test-proximity"

Hey i got some trouble running the ./test-proximity. I'm using bluez-5.16 and dbus-1.8.0.
In the folder test/ is the BLE text for PXP profile.
To call it i wrote: ./test-proximity -i 0 -b 88:33:14:E5:EE:A1 LinkLossAlertLevel mild
Error:
Traceback (most recent call last):
File "./test-proximity", line 52, in <module>
device = bluezutils.find_device(options.address, options.dev_id)
File "/home/pi/bluez-5.16/test/bluezutils.py", line 29, in find_device
return find_device_in_objects(get_managed_objects(), device_address,
File "/home/pi/bluez-5.16/test/bluezutils.py", line 9, in get_managed_objects
manager = dbus.Interface(bus.get_object("org.bluez", "/"),
File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 241, in get_object
follow_name_owner_changes=follow_name_owner_changes)
File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 248, in __init__
self._named_service = conn.activate_name_owner(bus_name)
File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 180, in activate_name_owner
self.start_service_by_name(bus_name)
File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 278, in start_service_by_name
'su', (bus_name, flags)))
File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.bluez was not provided by any .service files
It seems like there is something wrong with .service files. But i can'f find them.
thanks in advance

Resources