BLE: Executing the bluez test "test-proximity" - bluetooth

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

Related

Access denied when trying to run django-admin startproject

I am new to django and I tried to create a project with django-admin startproject command. The tutorial I was referring to had no errors while going through this command but I get the following error. The tutorial and I are not doing it in any virtual environment. Though this error comes, the files and folder are created in the directory I am working in, how should I solve this error?
Traceback (most recent call last):
File "C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python39\\lib\\runpy.py", line 197, in _run_module_as_main
return run_code(code, main_globals, None,
File "C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python39\\lib\\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python39\\Scripts\\django-admin.exe_main_.py", line 7, in \<module\>
File "C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\django\\core\\management\__init_.py", line 446, in execute_from_command_line
utility.execute()
File "C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\django\\core\\management\__init_.py", line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\django\\core\\management\\base.py", line 402, in run_from_argv
self.execute(\*args, \*\*cmd_options)
File "C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\django\\core\\management\\base.py", line 448, in execute
output = self.handle(\*args, \*\*options)
File "C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\django\\core\\management\\commands\\startproject.py", line 21, in handle super().handle("project", project_name, target, \*\*options)
File "C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\django\\core\\management\\templates.py", line 225, in handle
run_formatters(\[top_dir\])
File "C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\django\\core\\management\\utils.py", line 165, in run_formatters
subprocess.run(
File "C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python39\\lib\\subprocess.py", line 501, in run
with Popen(\*popenargs, \*\*kwargs) as process:
File "C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python39\\lib\\subprocess.py", line 947, in __init__
self.\_execute_child(args, executable, preexec_fn, close_fds,
File "C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python39\\lib\\subprocess.py", line 1416, in \_execute_child
hp, ht, pid, tid = \_winapi.CreateProcess(executable, args,
PermissionError: \[WinError 5\] Access is denied

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.

Generated Ebook throws error when trying to read it with ebook readers using Ebooklib

While the epub is being generated successfully, but when I try to read the epub using readers like Calibre or Sigil. They throw errors like certain files are missing.
Here's my code to generate the epub file:
book = epub.EpubBook()
book.set_title(novelName)
book.set_language("en")
book.set_cover('temp.jpg', content=open('temp.jpg','rb').read())
book.set_identifier("test")
for i in authorNames:
book.add_author(i)
for i in range(1):
driver.get(chapterLinks[i])
try:
content=driver.find_element_by_id('chr-content').get_attribute("innerHTML")
time.sleep(5)
except Exception as e:
driver.close()
driver = webdriver.Chrome(ChromeDriverManager().install(),options=options)
driver.get(chapterLinks[i])
content=driver.find_element_by_id('chr-content').get_attribute("innerHTML")
time.sleep(5)
soup = BeautifulSoup(content)
ads=soup.find("div", class_="ads-holder")
if(ads!=None):
ads.decompose()
print(chapterNames[i], chapterLinks[i])
chapterName=chapterNames[i].replace("-","")
c=epub.EpubHtml(title=chapterName,
file_name='{}.xhtml'.format(chapterName),
lang='en')
c.set_content(str(soup).encode('utf-8'))
book.add_item(c)
chapterList.append(c)
book.toc = chapterList
book.spine = chapterList
book.add_item(epub.EpubNcx())
book.add_item(epub.EpubNav())
epub.write_epub('test.epub', book)
and here are the errors:
Calibre :
calibre, version 5.20.0
ERROR: Loading book failed: Failed to open the book at C:\Users\xxxxx\Documents\Visual Studio 2019\PersonalProjects\Novel Grabber\test.epub. Click "Show details" for more info.
Failed to convert book: C:\Users\xxxxx\Documents\Visual Studio 2019\PersonalProjects\Novel Grabber\test.epub with error:
InputFormatPlugin: EPUB Input running
on C:\Users\xxxxx\Documents\Visual Studio 2019\PersonalProjects\Novel Grabber\test.epub
Failed to run pipe worker with command: from calibre.srv.render_book import viewer_main; viewer_main()
Traceback (most recent call last):
File "runpy.py", line 194, in _run_module_as_main
File "runpy.py", line 87, in _run_code
File "site.py", line 82, in <module>
File "site.py", line 77, in main
File "site.py", line 49, in run_entry_point
File "calibre\utils\ipc\worker.py", line 197, in main
File "<string>", line 1, in <module>
File "calibre\srv\render_book.py", line 824, in viewer_main
File "calibre\srv\render_book.py", line 815, in render_for_viewer
File "calibre\srv\render_book.py", line 793, in render
File "calibre\srv\render_book.py", line 601, in process_exploded_book
File "calibre\srv\render_book.py", line 604, in <setcomp>
File "calibre\ebooks\oeb\polish\container.py", line 561, in has_name_and_is_not_empty
File "genericpath.py", line 50, in getsize
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\\Users\\xxxxxx\\AppData\\Local\\calibre-cache\\ev2\\t\\c0-vdo66nim\\EPUB\\Chapter 2 '
Sigil:
Files exist in epub that are not listed in manifest, they will be ignored
Does anybody know what could be the cause for this?

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

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

VisaIOError: VI_ERROR_RSRC_NFOUND (-1073807343): Insufficient location information or the requested device or resource is not present in the system

I am running a code to connect Keithley multimeter to my laptop. I am using windows 10 and python 2.7. But when I try to run the code, this appears. Help me, i am very basic in programming and computer and I am in need of help. I have been searching for solution for days but to no avail , after I have fixed one error, another error pops up. this is the latest error. I hope after this one is solved i can use it . This is the message from iPython
runfile('C:/Users/user/Downloads/program (2).py',
wdir='C:/Users/user/Downloads') initializing Traceback (most recent
call last):
File "", line 1, in
runfile('C:/Users/user/Downloads/program (2).py', wdir='C:/Users/user/Downloads')
File
"C:\Users\user\Anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py",
line 710, in runfile
execfile(filename, namespace)
File
"C:\Users\user\Anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py",
line 86, in execfile
exec(compile(scripttext, filename, 'exec'), glob, loc)
File "C:/Users/user/Downloads/program (2).py", line 422, in
dmm = DMM()
File "C:/Users/user/Downloads/program (2).py", line 40, in init
self.A=self.rm.open_resource('ASRL3::INSTR')
File "C:\Users\user\Anaconda2\lib\pyvisa\highlevel.py", line 1656,
in open_resource
res.open(access_mode, open_timeout)
File "C:\Users\user\Anaconda2\lib\pyvisa\resources\resource.py",
line 209, in open
self.session, status = self._resource_manager.open_bare_resource(self._resource_name,
access_mode, open_timeout)
File "C:\Users\user\Anaconda2\lib\pyvisa\highlevel.py", line 1613,
in open_bare_resource
return self.visalib.open(self.session, resource_name, access_mode, open_timeout)
File "C:\Users\user\Anaconda2\lib\pyvisa\ctwrapper\functions.py",
line 1213, in open
ret = library.viOpen(session, resource_name, access_mode, open_timeout, byref(out_session))
File "C:\Users\user\Anaconda2\lib\pyvisa\ctwrapper\highlevel.py",
line 188, in _return_handler
raise errors.VisaIOError(ret_value)
VisaIOError: VI_ERROR_RSRC_NFOUND (-1073807343): Insufficient location
information or the requested device or resource is not present in the
system.

Resources