i am trying to streaming tweets for my project with kafka but a got this error :
Traceback (most recent call last):
File "/home/bigdata/anaconda3/lib/python3.7/site-packages/kafka/client_async.py", line 441, in __del__
self._close()
File "/home/bigdata/anaconda3/lib/python3.7/site-packages/kafka/client_async.py", line 415, in _close
if not self._closed:
AttributeError: 'KafkaClient' object has no attribute '_closed'
Traceback (most recent call last):
File "/home/bigdata/pythonscripts/testKafkaStreaming.py", line 28, in <module>
kafka = KafkaClient("localhost:9092")
TypeError: __init__() takes 1 positional argument but 2 were given
help me please what can i do
Related
I'm trying to solve this issue in OtreeHub,
Failed to create session: 'staticmethod' object is not callable
Traceback (most recent call last):
File "/app/.heroku/python/lib/python3.9/site-packages/otree/session.py", line 447, in create_session_traceback_wrapper
return create_session(**kwargs)
File "/app/.heroku/python/lib/python3.9/site-packages/otree/session.py", line 418, in create_session
func(subsession)
TypeError: 'staticmethod' object is not callable
I would like to know about how to solve this problem
I am working on a channels attribution project in Python. I use the python library "ChannelAttribution". When I followed the instruction from the official documentation and tried to use the built-in function "markov_model_local_api", it kept throwing an error. Then I tried to run the sample codes from https://channelattribution.io/pdf/ChannelAttributionWhitePaper.pdf:
from ChannelAttribution import *
#Download data
Data = pd.read_csv("https://channelattribution.io/csv/Data.csv",sep=";")
#Generate token
generate_token(email="my_email", job="my_job", company="my_institution")
token = 'my_token'
#Train
res=markov_model_local_api(token, Data, var_path="path", var_conv="total_conversions",var_value="total_conversion_value", var_null="total_null", order=1, sep=">")
It throws these errors below:
Exception ignored in: <function Connection.__del__ at 0x7fba45595670>
Traceback (most recent call last):
File "/Users/li/opt/anaconda3/lib/python3.8/site-packages/pysftp/__init__.py", line 1013, in __del__
self.close()
File "/Users/li/opt/anaconda3/lib/python3.8/site-packages/pysftp/__init__.py", line 784, in close
if self._sftp_live:
AttributeError: 'Connection' object has no attribute '_sftp_live'
Traceback (most recent call last):
File "src/cypack/ChannelAttribution.pyx", line 1188, in ChannelAttribution.markov_model_local_api
File "src/cypack/ChannelAttribution.pyx", line 894, in ChannelAttribution.__f_initialize_connection
File "/Users/li/opt/anaconda3/lib/python3.8/site-packages/pysftp/__init__.py", line 132, in __init__
self._tconnect['hostkey'] = self._cnopts.get_hostkey(host)
File "/Users/li/opt/anaconda3/lib/python3.8/site-packages/pysftp/__init__.py", line 71, in get_hostkey
raise SSHException("No hostkey for host %s found." % host)
SSHException: No hostkey for host 13.58.174.83 found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/li/Downloads/untitled0.py", line 18, in <module>
res=markov_model_local_api(token, Data, var_path="path", var_conv="total_conversions", var_value="total_conversion_value", var_null="total_null", order=1, sep=">")
File "src/cypack/ChannelAttribution.pyx", line 1248, in ChannelAttribution.markov_model_local_api
UnboundLocalError: local variable 'filename' referenced before assignment
How can I fix all errors and exceptions?
C:\Users\KrunkCiti\AppData\Local\Programs\Python\Python310\Scripts>python OpenGLTensorGrowth.py
Traceback (most recent call last):
File "C:\Users\KrunkCiti\AppData\Local\Programs\Python\Python310\Scripts\OpenGLTensorGrowth.py", line 29, in
Dict = Canvas.winfo_pixels(info, 3840_2160),[Self.tk.getint]
File "C:\Users\KrunkCiti\AppData\Local\Programs\Python\Python310\lib\tkinter_init_.py", line 1163, in winfo_pixels
return self.tk.getint(
AttributeError: 'function' object has no attribute 'tk'
I had tried this code:
from pywinauto import Application
app = Application().start("chrome")
but I get this error:
Traceback (most recent call last):
File "C:\Users\DEVDHRITI\AppData\Local\Programs\Python\Python310\lib\site-packages\pywinauto\application.py", line 1038, in start
(h_process, _, dw_process_id, _) = win32process.CreateProcess(
pywintypes.error: (2, 'CreateProcess', 'The system cannot find the file specified.')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\DEVDHRITI\AppData\Local\Programs\Python\Python310\lib\site-packages\pywinauto\application.py", line 1052, in start
raise AppStartError(message)
pywinauto.application.AppStartError: Could not create the process "chrome"
Error returned by CreateProcess: (2, 'CreateProcess', 'The system cannot find the file specified.')
So I tried this instead:
from pywinauto import Application
app = Application().start(r"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe")
This launched google however, I can't control it. When I run this code:
from pywinauto import Application
app = Application().start(r"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe")
app.NewTab.Edit.set_text("A link")
I get the following error:
Traceback (most recent call last):
File "C:\Users\DEVDHRITI\AppData\Local\Programs\Python\Python310\lib\site-packages\pywinauto\application.py", line 250, in __resolve_control
ctrl = wait_until_passes(
File "C:\Users\DEVDHRITI\AppData\Local\Programs\Python\Python310\lib\site-packages\pywinauto\timings.py", line 458, in wait_until_passes
raise err
pywinauto.timings.TimeoutError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\DEVDHRITI\AppData\Local\Programs\Python\Python310\lib\site-packages\pywinauto\application.py", line 379, in __getattribute__
ctrls = self.__resolve_control(self.criteria)
File "C:\Users\DEVDHRITI\AppData\Local\Programs\Python\Python310\lib\site-packages\pywinauto\application.py", line 261, in __resolve_control
raise e.original_exception
File "C:\Users\DEVDHRITI\AppData\Local\Programs\Python\Python310\lib\site-packages\pywinauto\timings.py", line 436, in wait_until_passes
func_val = func(*args, **kwargs)
File "C:\Users\DEVDHRITI\AppData\Local\Programs\Python\Python310\lib\site-packages\pywinauto\application.py", line 203, in __get_ctrl
dialog = self.backend.generic_wrapper_class(findwindows.find_element(**criteria[0]))
File "C:\Users\DEVDHRITI\AppData\Local\Programs\Python\Python310\lib\site-packages\pywinauto\findwindows.py", line 84, in find_element
elements = find_elements(**kwargs)
File "C:\Users\DEVDHRITI\AppData\Local\Programs\Python\Python310\lib\site-packages\pywinauto\findwindows.py", line 305, in find_elements
elements = findbestmatch.find_best_control_matches(best_match, wrapped_elems)
File "C:\Users\DEVDHRITI\AppData\Local\Programs\Python\Python310\lib\site-packages\pywinauto\findbestmatch.py", line 536, in find_best_control_matches
raise MatchError(items = name_control_map.keys(), tofind = search_text)
pywinauto.findbestmatch.MatchError: Could not find 'NewTab' in 'dict_keys([])'
I don't understand this error at all. I had searched stack overflow and tried this code:
from pywinauto import Application
app = Application().start("chrome.exe --force-renderer-accessibility")
app.NewTab.Edit.set_text("A link")
but it yielded the same results. I got this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'app' is not defined
>>> app = Application().start("chrome.exe --force-renderer-accessibility")
Traceback (most recent call last):
File "C:\Users\DEVDHRITI\AppData\Local\Programs\Python\Python310\lib\site-packages\pywinauto\application.py", line 1038, in start
(h_process, _, dw_process_id, _) = win32process.CreateProcess(
pywintypes.error: (2, 'CreateProcess', 'The system cannot find the file specified.')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\DEVDHRITI\AppData\Local\Programs\Python\Python310\lib\site-packages\pywinauto\application.py", line 1052, in start
raise AppStartError(message)
pywinauto.application.AppStartError: Could not create the process "chrome.exe --force-renderer-accessibility"
Error returned by CreateProcess: (2, 'CreateProcess', 'The system cannot find the file specified.')
>>> app.NewTab.Edit.set_text("A link")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'app' is not defined
>>> app = Application().start("chrome.exe --force-renderer-accessibility")
Traceback (most recent call last):
File "C:\Users\DEVDHRITI\AppData\Local\Programs\Python\Python310\lib\site-packages\pywinauto\application.py", line 1038, in start
(h_process, _, dw_process_id, _) = win32process.CreateProcess(
pywintypes.error: (2, 'CreateProcess', 'The system cannot find the file specified.')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\DEVDHRITI\AppData\Local\Programs\Python\Python310\lib\site-packages\pywinauto\application.py", line 1052, in start
raise AppStartError(message)
pywinauto.application.AppStartError: Could not create the process "chrome.exe --force-renderer-accessibility"
Error returned by CreateProcess: (2, 'CreateProcess', 'The system cannot find the file specified.')
Also I'm using python 3.10.0 so is this a bug of my version?
I am unable to access the disk drives on the Windows system using infi.manager package found on PyPi.
Tried the below :
from infi.devicemanager import DeviceManager
dm = DeviceManager()
dm.root.rescan()
disks = dm.disk_drives
names = [disk.friendly_name for disk in disks]
Error messages :
Traceback (most recent call last):
File "C:\Users\rsushmit\AppData\Local\Programs\Python\Python37-32\lib\site-packages\infi\devicemanager\setupapi\functions.py", line 56, in callee
yield decorated_func(*args, **kwargs)
File "C:\Users\rsushmit\AppData\Local\Programs\Python\Python37-32\lib\site-packages\infi\devicemanager\setupapi\functions.py", line 70, in SetupDiEnumDeviceInfo
interface(device_info_set, index, device_info_buffer)
File "C:\Users\rsushmit\AppData\Local\Programs\Python\Python37-32\lib\site-packages\infi\cwrap\__init__.py", line 138, in __new__
return_value = function(*args[1:], **kwargs)
File "C:\Users\rsushmit\AppData\Local\Programs\Python\Python37-32\lib\site-packages\infi\devicemanager\setupapi\__init__.py", line 35, in errcheck
raise WindowsException(GetLastError())
infi.devicemanager.setupapi.WindowsException: 259, No more data is available.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\rsushmit\AppData\Local\Programs\Python\Python37-32\lib\site-packages\infi\devicemanager\setupapi\functions.py", line 60, in callee
raise StopIteration
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\rsushmit\AppData\Local\Programs\Python\Python37-32\lib\site-packages\infi\devicemanager\__init__.py", line 215, in disk_drives
for controller in self.storage_controllers:
File "C:\Users\rsushmit\AppData\Local\Programs\Python\Python37-32\lib\site-packages\infi\devicemanager\__init__.py", line 227, in storage_controllers
return self.get_devices_from_handle(handle)
File "C:\Users\rsushmit\AppData\Local\Programs\Python\Python37-32\lib\site-packages\infi\devicemanager\__init__.py", line 198, in get_devices_from_handle
for devinfo in functions.SetupDiEnumDeviceInfo(handle):
RuntimeError: generator raised StopIteration
from infi.devicemanager import DeviceManager
dm = DeviceManager()
dm.root.rescan()
devices = dm.all_devices
for device in devices:
print(device)