I am trying to run a code,
if __name__ == "__main__":
print ("hello")
manager()
I am getting the following error:
Error: no such option: -f
An exception has occurred, use %tb to see the full traceback.
SystemExit: 2
On running
%tb
I am getting the following:
---------------------------------------------------------------------------
SystemExit Traceback (most recent call last)
<ipython-input-16-7c8a2c69be4e> in <module>()
165
166 if __name__ == "__main__":
--> 167 manager()
C:\Users\Anaconda2\lib\site-packages\click\core.pyc in __call__(self, *args, **kwargs)
720 def __call__(self, *args, **kwargs):
721 """Alias for :meth:`main`."""
--> 722 return self.main(*args, **kwargs)
723
724
C:\Users\Anaconda2\lib\site-packages\click\core.pyc in main(self, args, prog_name, complete_var, standalone_mode, **extra)
706 raise
707 e.show()
--> 708 sys.exit(e.exit_code)
709 except IOError as e:
710 if e.errno == errno.EPIPE:
SystemExit: 2
I followed the instruction and ran:
sys.argv
I got the following:
['C:\\Users\\Anaconda2\\lib\\site-packages\\ipykernel\\__main__.py',
'-f',
'C:\\Users\\AppData\\Roaming\\jupyter\\runtime\\kernel-85f59a10-ccfe-4f4e-8ba7-72b1d24e60ef.json']
I really don't understand what parameters I need to pass and why?
def manager():
pass
Related
Hi i am having issues with loading the .s2p file
when i ran the following code
import skrf as rf
from skrf import Network, Frequency
data1 = rf.Network('/Users/pradeeps/Desktop/Project/meas2018_07_06/300MHzNLOSX1DPS.s2p')
It showed the following error as shown below
---------------------------------------------------------------------------
UnpicklingError Traceback (most recent call last)
File ~/Desktop/Project/project/lib/python3.10/site-packages/skrf/network.py:450, in Network.__init__(self, file, name, params, comments, f_unit, s_def, **kwargs)
449 try:
--> 450 self.read(fid)
451 except UnicodeDecodeError: # Support for pickles created in Python2 and loaded in Python3
File ~/Desktop/Project/project/lib/python3.10/site-packages/skrf/network.py:2357, in Network.read(self, *args, **kwargs)
2356 from .io.general import read
-> 2357 self.copy_from(read(*args, **kwargs))
File ~/Desktop/Project/project/lib/python3.10/site-packages/skrf/io/general.py:140, in read(file, *args, **kwargs)
139 try:
--> 140 obj = pickle.load(fid, *args, **kwargs)
141 except (UnpicklingError, UnicodeDecodeError) as e:
142 # if fid is seekable then reset to beginning of file
UnpicklingError: invalid load key, '3'.
During handling of the above exception, another exception occurred:
NotImplementedError Traceback (most recent call last)
Untitled-1.ipynb Cell 2' in <cell line: 1>()
----> 1 data1 = rf.Network('/Users/pradeeps/Desktop/Project/meas2018_07_06/300MHzNLOSX1DPS.s2p')
File ~/Desktop/Project/project/lib/python3.10/site-packages/skrf/network.py:458, in Network.__init__(self, file, name, params, comments, f_unit, s_def, **kwargs)
456 filename = fid.name
457 fid.close()
--> 458 self.read_touchstone(filename, self.encoding)
460 if name is None and isinstance(file, str):
461 name = os.path.splitext(os.path.basename(file))[0]
File ~/Desktop/Project/project/lib/python3.10/site-packages/skrf/network.py:1956, in Network.read_touchstone(self, filename, encoding)
1953 touchstoneFile = touchstone.Touchstone(filename, encoding=encoding)
1955 if touchstoneFile.get_format().split()[1] != 's':
-> 1956 raise NotImplementedError('only s-parameters supported for now.')
1958 self.comments = touchstoneFile.get_comments()
1960 try:
NotImplementedError: only s-parameters supported for now.
As shown in this particular code i used scikit-rf is there any other package that i should use in this particular instance or am i doing anything wrong.
Thank you
I downloaded kivy successfully.
When I was trying to start the kivy window with this command that I found at the original kivy basics web site:
import kivy
from kivy.app import App
from kivy.uix.label import Label
class MyApp(App):
def build(self):
return Label(text='Hello world')
if __name__ == '__main__':
MyApp().run()
It gives an error:
ArgumentError Traceback (most recent call last)
D:\Anaconda\lib\site-packages\kivy\core\window\window_sdl2.py in mainloop(self)
746 try:
--> 747 self._mainloop()
748 except BaseException as inst:
D:\Anaconda\lib\site-packages\kivy\core\window\window_sdl2.py in _mainloop(self)
478 def _mainloop(self):
--> 479 EventLoop.idle()
480
D:\Anaconda\lib\site-packages\kivy\base.py in idle(self)
361 Logger.error('Base: Application will leave')
--> 362 self.exit()
363 return False
D:\Anaconda\lib\site-packages\kivy\base.py in exit(self)
374 '''Close the main loop and close the window.'''
--> 375 self.close()
376 if self.window:
D:\Anaconda\lib\site-packages\kivy\base.py in close(self)
171 self.quit = True
--> 172 self.stop()
173 self.status = 'closed'
D:\Anaconda\lib\site-packages\kivy\base.py in stop(self)
183 for provider in reversed(self.input_providers[:]):
--> 184 provider.stop()
185 if provider in self.input_providers_autoremove:
D:\Anaconda\lib\site-packages\kivy\input\providers\wm_pen.py in stop(self)
110 self.pen = None
--> 111 SetWindowLong_WndProc_wrapper(self.hwnd, self.old_windProc)
112
D:\Anaconda\lib\site-packages\kivy\input\providers\wm_common.py in _closure(hWnd, wndProc)
121 def _closure(hWnd, wndProc):
--> 122 oldAddr = func(hWnd, GWL_WNDPROC, cast(wndProc, c_void_p).value)
123 return cast(c_void_p(oldAddr), WNDPROC)
ArgumentError: argument 3: <class 'TypeError'>: wrong type
During handling of the above exception, another exception occurred:
ArgumentError Traceback (most recent call last)
D:\Anaconda\lib\site-packages\kivy\base.py in runTouchApp(widget, slave)
503 else:
--> 504 EventLoop.window.mainloop()
505 finally:
D:\Anaconda\lib\site-packages\kivy\core\window\window_sdl2.py in mainloop(self)
751
Please help me why doesn't it works?
Here is the example of working: https://kivy.org/doc/stable/guide/basic.html
I have set up ad manager credentials. I'm trying to access the Admanager API, im getting the following error.
from googleads import ad_manager
client = ad_manager.AdManagerClient.LoadFromStorage()
network_service = client.GetService('NetworkService', version='v201902')
current_network = network_service.getCurrentNetwork()
the error im facing is:
Fault Traceback (most recent call last)
~\Anaconda3\lib\site-packages\googleads\common.py in MakeSoapRequest(*args)
1381 return soap_service_method(
-> 1382 *packed_args, _soapheaders=soap_headers)['body']['rval']
1383 except zeep.exceptions.Fault as e:
~\Anaconda3\lib\site-packages\zeep\proxy.py in __call__(self, *args, **kwargs)
41 self._proxy._client, self._proxy._binding_options,
---> 42 self._op_name, args, kwargs)
43
~\Anaconda3\lib\site-packages\zeep\wsdl\bindings\soap.py in send(self, client, options, operation, args, kwargs)
131
--> 132 return self.process_reply(client, operation_obj, response)
133
~\Anaconda3\lib\site-packages\zeep\wsdl\bindings\soap.py in process_reply(self, client, operation, response)
193 if response.status_code != 200 or fault_node is not None:
--> 194 return self.process_error(doc, operation)
195
~\Anaconda3\lib\site-packages\zeep\wsdl\bindings\soap.py in process_error(self, doc, operation)
287 actor=None,
--> 288 detail=etree_to_string(doc))
289
Fault: Unknown fault occured
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
<ipython-input-16-991c0839fc99> in <module>()
----> 1 current_network = network_service.getCurrentNetwork()
~\Anaconda3\lib\site-packages\googleads\common.py in MakeSoapRequest(*args)
1385 if e.detail is not None:
1386 underlying_exception = e.detail.find(
-> 1387 '{%s}ApiExceptionFault' % self._GetBindingNamespace())
1388 fault_type = self.zeep_client.get_element(
1389 '{%s}ApiExceptionFault' % self._GetBindingNamespace())
TypeError: a bytes-like object is required, not 'str'
You are probably missing permissions with your configured service account. Make sure the account has access to ad-manager and scopes are configured properly.
I suggest to do it this way:
class Adx:
def __init__(self):
self.GOOGLEADS_YAML = 'googleads.yaml'
self.GOOGLEADS_VERSION = 'v202111'
self.google_keys = self.GOOGLEADS_YAML
def activate(self):
ad_manager_client = ad_manager.AdManagerClient.LoadFromStorage(self.google_keys)
I am attempting to run node2vec on a directed networkx network I have created. The network looks like this:
OutEdgeDataView([(7, 1, {'senderId': 7, 'weight': 273}), (7, 8, {'senderId': 7, 'weight': 319}), (7, 9, {'senderId': 7, 'weight': 137})....
With each node having an integer ID and a weight linking one node to another.
I am trying to use the node2vec module on this network as:
from node2vec import Node2Vec
node2vec = Node2Vec(mail_n_basic, dimensions=64, walk_length=30, num_walks=200, workers=4)
And am returned with this error, any help explaining the error would be much appreciated:
---------------------------------------------------------------------------
_RemoteTraceback Traceback (most recent call last)
_RemoteTraceback:
"""
Traceback (most recent call last):
File "C:\Users\Andrew\Anaconda3\lib\site-packages\joblib\externals\loky\process_executor.py", line 398, in _process_worker
r = call_item.fn(*call_item.args, **call_item.kwargs)
File "C:\Users\Andrew\Anaconda3\lib\site-packages\joblib\_parallel_backends.py", line 561, in __call__
return self.func(*args, **kwargs)
File "C:\Users\Andrew\Anaconda3\lib\site-packages\joblib\parallel.py", line 224, in __call__
for func, args, kwargs in self.items]
File "C:\Users\Andrew\Anaconda3\lib\site-packages\joblib\parallel.py", line 224, in <listcomp>
for func, args, kwargs in self.items]
File "C:\Users\Andrew\Anaconda3\lib\site-packages\node2vec\node2vec.py", line 51, in parallel_generate_walks
walk_to = np.random.choice(walk_options, size=1)[0]
File "mtrand.pyx", line 1126, in mtrand.RandomState.choice
ValueError: a must be non-empty
"""
The above exception was the direct cause of the following exception:
ValueError Traceback (most recent call last)
<ipython-input-58-3ac160061528> in <module>()
1
----> 2 node2vec = Node2Vec(mail_n_basic, dimensions=64, walk_length=30, num_walks=200, workers=4)
~\Anaconda3\lib\site-packages\node2vec\node2vec.py in __init__(self, graph, dimensions, walk_length, num_walks, p, q, weight_key, workers, sampling_strategy)
111
112 self.d_graph = self._precompute_probabilities()
--> 113 self.walks = self._generate_walks()
114
115 def _precompute_probabilities(self):
~\Anaconda3\lib\site-packages\node2vec\node2vec.py in _generate_walks(self)
178 self.NEIGHBORS_KEY,
179 self.PROBABILITIES_KEY) for idx, num_walks
--> 180 in enumerate(num_walks_lists, 1))
181
182 walks = flatten(walk_results)
~\Anaconda3\lib\site-packages\joblib\parallel.py in __call__(self, iterable)
960
961 with self._backend.retrieval_context():
--> 962 self.retrieve()
963 # Make sure that we get a last message telling us we are done
964 elapsed_time = time.time() - self._start_time
~\Anaconda3\lib\site-packages\joblib\parallel.py in retrieve(self)
863 try:
864 if getattr(self._backend, 'supports_timeout', False):
--> 865 self._output.extend(job.get(timeout=self.timeout))
866 else:
867 self._output.extend(job.get())
~\Anaconda3\lib\site-packages\joblib\_parallel_backends.py in wrap_future_result(future, timeout)
513 AsyncResults.get from multiprocessing."""
514 try:
--> 515 return future.result(timeout=timeout)
516 except LokyTimeoutError:
517 raise TimeoutError()
~\Anaconda3\lib\site-packages\joblib\externals\loky\_base.py in result(self, timeout)
429 raise CancelledError()
430 elif self._state == FINISHED:
--> 431 return self.__get_result()
432 else:
433 raise TimeoutError()
~\Anaconda3\lib\site-packages\joblib\externals\loky\_base.py in __get_result(self)
380 def __get_result(self):
381 if self._exception:
--> 382 raise self._exception
383 else:
384 return self._result
ValueError: a must be non-empty
I'm the author of this library.
If you are using Windows, parallel execution won't work because joblib and Windows issues.
Run the same code with the updated version pip install -U node2vec and when constructing the Node2Vec class, pass workers=1
From the classification example on the website of scikit-learn, I'm getting the following error after executing the part with optionparser:
Usage: __main__.py [options]
__main__.py: error: no such option: -f
An exception has occurred, use %tb to see the full traceback.
SystemExit: 2
To exit: use 'exit', 'quit', or Ctrl-D.
a %tb command gives the following output:
---------------------------------------------------------------------------
BadOptionError Traceback (most recent call last)
/Users/kevinoost/anaconda/lib/python3.5/optparse.py in parse_args(self, args, values)
1385 try:
-> 1386 stop = self._process_args(largs, rargs, values)
1387 except (BadOptionError, OptionValueError) as err:
/Users/kevinoost/anaconda/lib/python3.5/optparse.py in _process_args(self, largs, rargs, values)
1429 # value(s) for the last one only)
-> 1430 self._process_short_opts(rargs, values)
1431 elif self.allow_interspersed_args:
/Users/kevinoost/anaconda/lib/python3.5/optparse.py in _process_short_opts(self, rargs, values)
1511 if not option:
-> 1512 raise BadOptionError(opt)
1513 if option.takes_value():
BadOptionError: no such option: -f
During handling of the above exception, another exception occurred:
SystemExit Traceback (most recent call last)
<ipython-input-10-960f3b27132a> in <module>()
66 "headers, signatures, and quoting.")
67
---> 68 (opts, args) = op.parse_args()
69 if len(args) > 0:
70 op.error("this script takes no arguments.")
/Users/kevinoost/anaconda/lib/python3.5/optparse.py in parse_args(self, args, values)
1386 stop = self._process_args(largs, rargs, values)
1387 except (BadOptionError, OptionValueError) as err:
-> 1388 self.error(str(err))
1389
1390 args = largs + rargs
/Users/kevinoost/anaconda/lib/python3.5/optparse.py in error(self, msg)
1566 """
1567 self.print_usage(sys.stderr)
-> 1568 self.exit(2, "%s: error: %s\n" % (self.get_prog_name(), msg))
1569
1570 def get_usage(self):
/Users/kevinoost/anaconda/lib/python3.5/optparse.py in exit(self, status, msg)
1556 if msg:
1557 sys.stderr.write(msg)
-> 1558 sys.exit(status)
1559
1560 def error(self, msg):
SystemExit: 2
According to the docs, optparse was deprecated in version 2.7 of Python; and I am using Python 3.
What do I do to fix this?
Thank you,
Regards, Kevin