Trying to run some code. Get this error when I do. I thought I had all the necessary dependencies installed, but still getting this error.
linux; GNU C++ version 4.8.1; Boost_105300; UHD_003.007.000-133-g6bd9fed2
Traceback (most recent call last):
File "/usr/local/bin/tpms_rx", line 274, in <module>
main()
File "/usr/local/bin/tpms_rx", line 265, in main
tb = top_block(source, args)
File "/usr/local/bin/tpms_rx", line 229, in __init__
self.source = source_rtlsdr(args.tuned_frequency, args.if_rate)
File "/usr/local/lib/python2.7/dist-packages/tpms/source.py", line 98, in __init__
rf_decimation, rf_decimation_remainder = divmod(rf_sampling_rate, if_sampling_rate)
TypeError: unsupported operand type(s) for divmod(): 'int' and 'NoneType'
When you run your program you need to pass a parameter -i/--if-rate or else the default is None which eventually gets passed, 2 layers later, to divmod.
See https://github.com/jboone/gr-tpms/blob/master/apps/tpms_rx and https://github.com/jboone/gr-tpms/blob/master/python/source.py additionally.
Related
I am trying to make a program that translates whatever you say in Swedish and PyAutoGUI Typewrites it. But when I run the code, I just get the same error.
trans=Translator()
translating_text=input('Enter text to translate into S w e d i s h:')
t=trans.translate(translating_text,src='en',dest='sv')
time.sleep(5)
translated=t
pyautogui.typewrite(translated)
pyautogui.press('enter')
The error:
Traceback (most recent call last):
File "C:\Users\admin\Documents\Python Projects\CrendlePy.py", line 56, in <module>
ahm_swedish()
File "C:\Users\admin\Documents\Python Projects\CrendlePy.py", line 54, in ahm_swedish
pyautogui.typewrite(translated)
File "C:\Users\admin\AppData\Local\Programs\Python\Python39\lib\site-
packages\pyautogui\__init__.py", line 586, in wrapper
returnVal = wrappedFunction(*args, **kwargs)
File "C:\Users\admin\AppData\Local\Programs\Python\Python39\lib\site-
packages\pyautogui\__init__.py", line 1665, in typewrite
for c in message:
TypeError: 'Translated' object is not iterable
Can someone pls help me with this?
Error speaks for its self, pyautogui.typewrite() is expecting iterable, for example, string, but you are passing Translated object.
You have to explore the way to get text out of your Translated object and only then pass it to pyautogui.
There are code for QGIS which used for parcel evaluation.
import processing
processing.run('qgis:postgisexecutesql', "parcell_GIS07", "select_parcel_eval('[%"cadnum" %]')")
qgis.utils.iface.mapCanvas().refresh()
When i try to use it on parcel in QGIS, it give off error window with this code:
An error occurred during execution of following code:
import processing
processing.run('qgis:postgisexecutesql', "parcell_GIS07", "select_parcel_eval('060130018')")
qgis.utils.iface.mapCanvas().refresh()
Traceback (most recent call last):
File "", line 2, in
File "C:/OSGEO4~1/apps/qgis/./python/plugins\processing\tools\general.py", line 106, in run
return Processing.runAlgorithm(algOrName, parameters, onFinish, feedback, context)
File "C:/OSGEO4~1/apps/qgis/./python/plugins\processing\core\Processing.py", line 133, in runAlgorithm
ok, msg = alg.checkParameterValues(parameters, context)
TypeError: QgsProcessingAlgorithm.checkParameterValues(): argument 1 has unexpected type 'str'
I'm using the instabot_py module to automate some social media processes. This involves checking whether variables are above a certain value (i.e. if followers > 0 then ). It works fine on my PC both through command line and Eclipse but a TypeError is thrown when I run it on my EC2.
I've tried updating python versions and skirting around these checks but they are process critical. The default value of self.bot.follow_time is 0.
Traceback (most recent call last):
File "/home/ec2-user/.local/bin/instabot-py", line 10, in <module>
sys.exit(main())
File "/home/ec2-user/.local/lib/python3.6/site-packages/instabot_py/__main__.py", line 252, in main
bot.mainloop()
File "/home/ec2-user/.local/lib/python3.6/site-packages/instabot_py/instabot.py", line 756, in mainloop
self.new_auto_mod_unfollow()
File "/home/ec2-user/.local/lib/python3.6/site-packages/instabot_py/instabot.py", line 899, in new_auto_mod_unfollow
user = self.persistence.get_username_to_unfollow_random()
File "/home/ec2-user/.local/lib/python3.6/site-packages/instabot_py/persistence/sql.py", line 95, in get_username_to_unfollow_random
if self.bot.follow_time > 0:
TypeError: '>' not supported between instances of 'str' and 'int'
Expecting no error messages and the logic to run as expected
So I'm trying to get scapy to work on my windows computer. After a lot of work I finally was able to load the library without any errors. However when I call the function sniff(count=1) I get an error. It seems that a variable called "device" is getting the value None. Here is the error :
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python34\lib\site-packages\scapy\arch\windows\__init__.py", line 445, in sniff
s = L2socket(type=ETH_P_ALL, *arg, **karg)
File "C:\Python34\lib\site-packages\scapy\arch\pcapdnet.py", line 266, in __init__
self.ins = open_pcap(iface, 1600, self.promisc, 100)
File "C:\Python34\lib\site-packages\scapy\arch\windows\__init__.py", line 223, in <lambda>
pcapdnet.open_pcap = lambda iface,*args,**kargs: _orig_open_pcap(pcap_name(iface),*args,**kargs)
File "C:\Python34\lib\site-packages\scapy\arch\pcapdnet.py", line 251, in <lambda>
open_pcap = lambda *args,**kargs: _PcapWrapper_pypcap(*args,**kargs)
File "C:\Python34\lib\site-packages\scapy\arch\pcapdnet.py", line 215, in __init__
self.iface = create_string_buffer(device.encode('ascii'))
AttributeError: 'NoneType' object has no attribute 'encode'
Thanks In Advance For Any Help :)
After downloading the new development version and tinkering around with the timeouts of some of the powershell commands I fixed it! Guess it was just a bug with the old version. Scapy doesn't have the best Windows support.
I'm trying to automate tasks for teamcenter using pywinauto python module.But I was not able to work properly with TreeViews. When ever I'm trying to use GetItem(),SubElements(),Item() and many other function under _treeview_element giving error.Please look into below errors.
I'm using python 2.7 and i also have pywin32 module installed
for i in range(tr.ItemCount()):
print tr.GetItem(i)
Traceback (most recent call last):
File "<pyshell#61>", line 2, in <module>
print tr.GetItem(i) File "C:\Users\patibj\Desktop\pywinauto-
master\pywinauto\controls\common_controls.py", line 1010, in GetItem
if isinstance(path[0], int):
TypeError: 'int' object has no attribute '__getitem__'
This is when i'm trying to use GetChild()
a[0] is <pywinauto.controls.common_controls._treeview_element object at 0x02EC11B0> a[0].GetChild((1))
Traceback (most recent call last):
File "<pyshell#49>", line 1, in <module>
a[0].GetChild((1))
File "C:\Users\patibj\Desktop\pywinauto- master\pywinauto\controls\common_controls.py", line 840, in GetChild
return self.Children()[index]
File "C:\Users\patibj\Desktop\pywinauto-master\pywinauto\controls\common_controls.py", line 739, in Children
if self.Item().cChildren not in (0, 1):
File "C:\Users\patibj\Desktop\pywinauto-master\pywinauto\controls\common_controls.py", line 539, in Item
return self._readitem()[0]
File "C:\Users\patibj\Desktop\pywinauto-master\pywinauto\controls\common_controls.py", line 904, in _readitem
raise ctypes.WinError() WindowsError: [Error 0] The operation completed successfully.
Please help me out .Thanks in advance.
TreeViewWrapper.GetItem() method gets path argument which should be the string starting with back-slash \\ symbol. Example:
app.Dialog.TreeView.GetItem('\\1st_level_item_name\\2ndlevelitem').Click()
For access by index use a list of integers:
app.Dialog.TreeView.GetItem([1, 0])
GetChild() works with explorer.exe TreeView:
>>> tree.GetItem([1]).GetChild(2).Text()
u'Computer'