what is the problem ?: application.connect() error - python

I am a beginner developer who started to study automation by using pywinauto.
An overflow error occurs when using application.connect () to connect to an already open program.
But application.start() works fine....
Please help me if someone know this part.
The source code and error contents are as follows.
Source code:
import pywinauto
app = pywinauto.application.Application()
app.connect(title_re='Calculator')
Error:
OverflowError Traceback (most recent call last)
in
1 import pywinauto
2 app = pywinauto.application.Application()
----> 3 app.connect(title_re='Calculator')
d:\Anaconda3\lib\site-packages\pywinauto\application.py in connect(self, **kwargs)
972 ).process_id
973 else:
--> 974 self.process = findwindows.find_element(**kwargs).process_id
975 connected = True
976
d:\Anaconda3\lib\site-packages\pywinauto\findwindows.py in find_element(**kwargs)
82 so please see :py:func:find_elements for the full parameters description.
83 """
---> 84 elements = find_elements(**kwargs)
85
86 if not elements:
d:\Anaconda3\lib\site-packages\pywinauto\findwindows.py in find_elements(class_name, class_name_re, parent, process, title, title_re, top_level_only, visible_only, enabled_only, best_match, handle, ctrl_index, found_index, predicate_func, active_only, control_id, control_type, auto_id, framework_id, backend, depth)
279 return title_regex.match(t)
280 return False
--> 281 elements = [elem for elem in elements if _title_match(elem)]
282
283 if visible_only:
d:\Anaconda3\lib\site-packages\pywinauto\findwindows.py in (.0)
279 return title_regex.match(t)
280 return False
--> 281 elements = [elem for elem in elements if _title_match(elem)]
282
283 if visible_only:
d:\Anaconda3\lib\site-packages\pywinauto\findwindows.py in _title_match(w)
275 def _title_match(w):
276 """Match a window title to the regexp"""
--> 277 t = w.rich_text
278 if t is not None:
279 return title_regex.match(t)
d:\Anaconda3\lib\site-packages\pywinauto\win32_element_info.py in rich_text(self)
81 def rich_text(self):
82 """Return the text of the window"""
---> 83 return handleprops.text(self.handle)
84
85 name = rich_text
d:\Anaconda3\lib\site-packages\pywinauto\handleprops.py in text(handle)
86 length += 1
87
---> 88 buffer_ = ctypes.create_unicode_buffer(length)
89
90 ret = win32functions.SendMessage(
d:\Anaconda3\lib\ctypes_init_.py in create_unicode_buffer(init, size)
286 return buf
287 elif isinstance(init, int):
--> 288 buftype = c_wchar * init
289 buf = buftype()
290 return buf
OverflowError: cannot fit 'int' into an index-sized integer

import pywinauto
app = pywinauto.Application(backend='uia').start('calc.exe')
try this if you are having problem you have to say the backennd is a uia it working fine for me.

Related

AttributeError: module 'PIL.TiffTags' has no attribute 'LONG8'

I am trying to open an image with skimage.io.imread but I have the error in title.
For example:
skimage.io.imread('myimage.png')
My environment; skimage:
import skimage
print(skimage.__version__)
0.19.2
and PIL:
import PIL
PIL.__version__
8.0.1
This is the entire traceback:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-52-1b9f5663f4c8> in <module>
----> 1 skimage.io.imread('qrcode-caracciolo.png')
/usr/local/lib/python3.9/site-packages/skimage/io/_io.py in imread(fname, as_gray, plugin, **plugin_args)
51
52 with file_or_url_context(fname) as fname:
---> 53 img = call_plugin('imread', fname, plugin=plugin, **plugin_args)
54
55 if not hasattr(img, 'ndim'):
/usr/local/lib/python3.9/site-packages/skimage/io/manage_plugins.py in call_plugin(kind, *args, **kwargs)
205 (plugin, kind))
206
--> 207 return func(*args, **kwargs)
208
209
/usr/local/lib/python3.9/site-packages/skimage/io/_plugins/imageio_plugin.py in imread(*args, **kwargs)
8 #wraps(imageio_imread)
9 def imread(*args, **kwargs):
---> 10 return np.asarray(imageio_imread(*args, **kwargs))
/usr/local/lib/python3.9/site-packages/imageio/__init__.py in imread(uri, format, **kwargs)
94 )
95
---> 96 return imread_v2(uri, format=format, **kwargs)
97
98
/usr/local/lib/python3.9/site-packages/imageio/v2.py in imread(uri, format, **kwargs)
199 imopen_args["legacy_mode"] = True
200
--> 201 with imopen(uri, "ri", **imopen_args) as file:
202 return file.read(index=0, **kwargs)
203
/usr/local/lib/python3.9/site-packages/imageio/core/imopen.py in imopen(uri, io_mode, plugin, format_hint, legacy_mode, **kwargs)
212
213 try:
--> 214 plugin_instance = candidate_plugin(request, **kwargs)
215 except InitializationError:
216 # file extension doesn't match file type
/usr/local/lib/python3.9/site-packages/imageio/config/plugins.py in partial_legacy_plugin(request)
106
107 def partial_legacy_plugin(request):
--> 108 return LegacyPlugin(request, legacy_plugin)
109
110 clazz = partial_legacy_plugin
/usr/local/lib/python3.9/site-packages/imageio/core/legacy_plugin_wrapper.py in __init__(self, request, legacy_plugin)
66 )
67 if self._request.mode.io_mode == IOMode.read:
---> 68 if not self._format.can_read(request):
69 raise InitializationError(
70 f"`{self._format.name}`" f" can not read `{source}`."
/usr/local/lib/python3.9/site-packages/imageio/core/format.py in can_read(self, request)
242 Get whether this format can read data from the specified uri.
243 """
--> 244 return self._can_read(request)
245
246 def can_write(self, request):
/usr/local/lib/python3.9/site-packages/imageio/plugins/pillow_legacy.py in _can_read(self, request)
262
263 def _can_read(self, request):
--> 264 Image = self._init_pillow()
265 if request.mode[1] in (self.modes + "?"):
266 if self.plugin_id in Image.OPEN:
/usr/local/lib/python3.9/site-packages/imageio/plugins/pillow_legacy.py in _init_pillow(self)
256
257 if self.plugin_id in ("PNG", "JPEG", "BMP", "GIF", "PPM"):
--> 258 Image.preinit()
259 else:
260 Image.init()
/usr/local/lib/python3.9/site-packages/PIL/Image.py in preinit()
365 assert JpegImagePlugin
366 except ImportError:
--> 367 pass
368 try:
369 from . import PpmImagePlugin
/usr/local/lib/python3.9/site-packages/PIL/JpegImagePlugin.py in <module>
42 import warnings
43
---> 44 from . import Image, ImageFile, TiffImagePlugin
45 from ._binary import i16be as i16
46 from ._binary import i32be as i32
/usr/local/lib/python3.9/site-packages/PIL/TiffImagePlugin.py in <module>
425
426
--> 427 class ImageFileDirectory_v2(MutableMapping):
428 """This class represents a TIFF tag directory. To speed things up, we
429 don't decode tags unless they're asked for.
/usr/local/lib/python3.9/site-packages/PIL/TiffImagePlugin.py in ImageFileDirectory_v2()
706 (TiffTags.DOUBLE, "d", "double"),
707 (TiffTags.IFD, "L", "long"),
--> 708 (TiffTags.LONG8, "Q", "long8"),
709 ],
710 )
AttributeError: module 'PIL.TiffTags' has no attribute 'LONG8'

Hvplot AttributeError: 'list' object has no attribute 'xy'

I have trouble making a interactive map with PySAL. I want to visualize the dutch 'gemeente' (Municipalities). You can download shape files from the dutch bureau of statistics: https://www.cbs.nl/nl-nl/dossier/nederland-regionaal/geografische-data/wijk-en-buurtkaart-2019
import geopandas as gpd
import hvplot.pandas
coords = gpd.read_file('gemeente_2019_v2.shp')
coords.hvplot(geo = True)
This raises an error that 'list' object has no attribute 'xy'.
I used PySAL 2.1.0 and tried upgrading to 2.4.0, but this made no difference.
Output:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
~\.conda\envs\jh-open\lib\site-packages\IPython\core\formatters.py in __call__(self, obj, include, exclude)
968
969 if method is not None:
--> 970 return method(include=include, exclude=exclude)
971 return None
972 else:
~\.conda\envs\jh-open\lib\site-packages\holoviews\core\dimension.py in _repr_mimebundle_(self, include, exclude)
1315 combined and returned.
1316 """
-> 1317 return Store.render(self)
1318
1319
~\.conda\envs\jh-open\lib\site-packages\holoviews\core\options.py in render(cls, obj)
1403 data, metadata = {}, {}
1404 for hook in hooks:
-> 1405 ret = hook(obj)
1406 if ret is None:
1407 continue
~\.conda\envs\jh-open\lib\site-packages\holoviews\ipython\display_hooks.py in pprint_display(obj)
280 if not ip.display_formatter.formatters['text/plain'].pprint:
281 return None
--> 282 return display(obj, raw_output=True)
283
284
~\.conda\envs\jh-open\lib\site-packages\holoviews\ipython\display_hooks.py in display(obj, raw_output, **kwargs)
250 elif isinstance(obj, (CompositeOverlay, ViewableElement)):
251 with option_state(obj):
--> 252 output = element_display(obj)
253 elif isinstance(obj, (Layout, NdLayout, AdjointLayout)):
254 with option_state(obj):
~\.conda\envs\jh-open\lib\site-packages\holoviews\ipython\display_hooks.py in wrapped(element)
144 try:
145 max_frames = OutputSettings.options['max_frames']
--> 146 mimebundle = fn(element, max_frames=max_frames)
147 if mimebundle is None:
148 return {}, {}
~\.conda\envs\jh-open\lib\site-packages\holoviews\ipython\display_hooks.py in element_display(element, max_frames)
190 return None
191
--> 192 return render(element)
193
194
~\.conda\envs\jh-open\lib\site-packages\holoviews\ipython\display_hooks.py in render(obj, **kwargs)
66 renderer = renderer.instance(fig='png')
67
---> 68 return renderer.components(obj, **kwargs)
69
70
~\.conda\envs\jh-open\lib\site-packages\holoviews\plotting\renderer.py in components(self, obj, fmt, comm, **kwargs)
408 doc = Document()
409 with config.set(embed=embed):
--> 410 model = plot.layout._render_model(doc, comm)
411 if embed:
412 return render_model(model, comm)
~\.conda\envs\jh-open\lib\site-packages\panel\viewable.py in _render_model(self, doc, comm)
425 if comm is None:
426 comm = state._comm_manager.get_server_comm()
--> 427 model = self.get_root(doc, comm)
428
429 if config.embed:
~\.conda\envs\jh-open\lib\site-packages\panel\viewable.py in get_root(self, doc, comm, preprocess)
482 """
483 doc = init_doc(doc)
--> 484 root = self._get_model(doc, comm=comm)
485 if preprocess:
486 self._preprocess(root)
~\.conda\envs\jh-open\lib\site-packages\panel\layout\base.py in _get_model(self, doc, root, parent, comm)
111 if root is None:
112 root = model
--> 113 objects = self._get_objects(model, [], doc, root, comm)
114 props = dict(self._init_params(), objects=objects)
115 model.update(**self._process_param_change(props))
~\.conda\envs\jh-open\lib\site-packages\panel\layout\base.py in _get_objects(self, model, old_objects, doc, root, comm)
101 else:
102 try:
--> 103 child = pane._get_model(doc, root, model, comm)
104 except RerenderError:
105 return self._get_objects(model, current_objects[:i], doc, root, comm)
~\.conda\envs\jh-open\lib\site-packages\panel\pane\holoviews.py in _get_model(self, doc, root, parent, comm)
237 plot = self.object
238 else:
--> 239 plot = self._render(doc, comm, root)
240
241 plot.pane = self
~\.conda\envs\jh-open\lib\site-packages\panel\pane\holoviews.py in _render(self, doc, comm, root)
302 kwargs['comm'] = comm
303
--> 304 return renderer.get_plot(self.object, **kwargs)
305
306 def _cleanup(self, root):
~\.conda\envs\jh-open\lib\site-packages\holoviews\plotting\bokeh\renderer.py in get_plot(self_or_cls, obj, doc, renderer, **kwargs)
71 combining the bokeh model with another plot.
72 """
---> 73 plot = super(BokehRenderer, self_or_cls).get_plot(obj, doc, renderer, **kwargs)
74 if plot.document is None:
75 plot.document = Document() if self_or_cls.notebook_context else curdoc()
~\.conda\envs\jh-open\lib\site-packages\holoviews\plotting\renderer.py in get_plot(self_or_cls, obj, doc, renderer, comm, **kwargs)
241 init_key = tuple(v if d is None else d for v, d in
242 zip(plot.keys[0], defaults))
--> 243 plot.update(init_key)
244 else:
245 plot = obj
~\.conda\envs\jh-open\lib\site-packages\holoviews\plotting\plot.py in update(self, key)
980 def update(self, key):
981 if len(self) == 1 and ((key == 0) or (key == self.keys[0])) and not self.drawn:
--> 982 return self.initialize_plot()
983 item = self.__getitem__(key)
984 self.traverse(lambda x: setattr(x, '_updated', True))
~\.conda\envs\jh-open\lib\site-packages\geoviews\plotting\bokeh\plot.py in initialize_plot(self, ranges, plot, plots, source)
111 def initialize_plot(self, ranges=None, plot=None, plots=None, source=None):
112 opts = {} if isinstance(self, HvOverlayPlot) else {'source': source}
--> 113 fig = super(GeoPlot, self).initialize_plot(ranges, plot, plots, **opts)
114 if self.geographic and self.show_bounds and not self.overlaid:
115 from . import GeoShapePlot
~\.conda\envs\jh-open\lib\site-packages\holoviews\plotting\bokeh\element.py in initialize_plot(self, ranges, plot, plots, source)
1394 # Initialize plot, source and glyph
1395 if plot is None:
-> 1396 plot = self._init_plot(key, style_element, ranges=ranges, plots=plots)
1397 self._init_axes(plot)
1398 else:
~\.conda\envs\jh-open\lib\site-packages\holoviews\plotting\bokeh\element.py in _init_plot(self, key, element, plots, ranges)
492 subplots = list(self.subplots.values()) if self.subplots else []
493
--> 494 axis_types, labels, plot_ranges = self._axes_props(plots, subplots, element, ranges)
495 xlabel, ylabel, _ = labels
496 x_axis_type, y_axis_type = axis_types
~\.conda\envs\jh-open\lib\site-packages\holoviews\plotting\bokeh\element.py in _axes_props(self, plots, subplots, element, ranges)
403 # Get the Element that determines the range and get_extents
404 range_el = el if self.batched and not isinstance(self, OverlayPlot) else element
--> 405 l, b, r, t = self.get_extents(range_el, ranges)
406 if self.invert_axes:
407 l, b, r, t = b, l, t, r
~\.conda\envs\jh-open\lib\site-packages\geoviews\plotting\plot.py in get_extents(self, element, ranges, range_type)
71 extents = None
72 else:
---> 73 extents = project_extents(extents, element.crs, proj)
74 return (np.NaN,)*4 if not extents else extents
~\.conda\envs\jh-open\lib\site-packages\geoviews\util.py in project_extents(extents, src_proj, dest_proj, tol)
95 geom_in_src_proj = geom_clipped_to_dest_proj
96 try:
---> 97 geom_in_crs = dest_proj.project_geometry(geom_in_src_proj, src_proj)
98 except ValueError:
99 src_name =type(src_proj).__name__
~\.conda\envs\jh-open\lib\site-packages\cartopy\crs.py in project_geometry(self, geometry, src_crs)
216 raise ValueError('Unsupported geometry '
217 'type {!r}'.format(geom_type))
--> 218 return getattr(self, method_name)(geometry, src_crs)
219
220 def _project_point(self, point, src_crs):
~\.conda\envs\jh-open\lib\site-packages\cartopy\crs.py in _project_polygon(self, polygon, src_crs)
352 is_ccw = True
353 else:
--> 354 is_ccw = polygon.exterior.is_ccw
355 # Project the polygon exterior/interior rings.
356 # Each source ring will result in either a ring, or one or more
~\.conda\envs\jh-open\lib\site-packages\shapely\geometry\polygon.py in is_ccw(self)
86 def is_ccw(self):
87 """True is the ring is oriented counter clock-wise"""
---> 88 return bool(self.impl['is_ccw'](self))
89
90 #property
~\.conda\envs\jh-open\lib\site-packages\shapely\algorithms\cga.py in is_ccw_op(ring)
12 """Predicate implementation"""
13 def is_ccw_op(ring):
---> 14 return signed_area(ring) >= 0.0
15 return is_ccw_op
16
~\.conda\envs\jh-open\lib\site-packages\shapely\algorithms\cga.py in signed_area(ring)
4 algorithm at: https://web.archive.org/web/20080209143651/http://cgafaq.info:80/wiki/Polygon_Area
5 """
----> 6 xs, ys = ring.coords.xy
7 xs.append(xs[1])
8 ys.append(ys[1])
AttributeError: 'list' object has no attribute 'xy'
:Polygons [Longitude,Latitude]
The issue is related to the Coordinate Reference System of the shapefile.
Looking at coords.crs shows EPSG:28992.
You can get hvplot to work with this:
from cartopy import crs
coords.hvplot(geo = True, crs=crs.epsg(28992))
I am not sure if this would be considered an issue or not. It may be worth reporting in the github repo.

pandas_profiling TypeError when using HTML format

I follow the pandas_profiling document script, but this problem always arises.
My dataset is the boston from sklearn.
I have the report, but without the features of an html version:
profile2 = ProfileReport(data, title="Relatório DATASET -data-", html={'style': {'full_width': True}}, sort="None")
The image below refers to this code:
from pandas_profiling import ProfileReport
profile = ProfileReport(data, title='Pandas Profiling Report', explorative=True)
[![enter image description here][1]][1]
My version of pandas_profiling
[![enter image description here][2]][2]
I don't have the problem related above if I use this code:
profile = ProfileReport (data)
UPDATE:
Uninstalled the previous version and got the new one (2.9.0), but this problems happens:
Summarize dataset: 75%
21/28 [00:07<00:02, 2.84it/s, Get scatter matrix]
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\formatters.py in __call__(self, obj)
343 method = get_real_method(obj, self.print_method)
344 if method is not None:
--> 345 return method()
346 return None
347 else:
C:\ProgramData\Anaconda3\lib\site-packages\pandas_profiling\profile_report.py in _repr_html_(self)
407 def _repr_html_(self):
408 """The ipython notebook widgets user interface gets called by the jupyter notebook."""
--> 409 self.to_notebook_iframe()
410
411 def __repr__(self):
C:\ProgramData\Anaconda3\lib\site-packages\pandas_profiling\profile_report.py in to_notebook_iframe(self)
387 with warnings.catch_warnings():
388 warnings.simplefilter("ignore")
--> 389 display(get_notebook_iframe(self))
390
391 def to_widgets(self):
C:\ProgramData\Anaconda3\lib\site-packages\pandas_profiling\report\presentation\flavours\widget\notebook.py in get_notebook_iframe(profile)
63 output = get_notebook_iframe_src(profile)
64 elif attribute == "srcdoc":
---> 65 output = get_notebook_iframe_srcdoc(profile)
66 else:
67 raise ValueError(
C:\ProgramData\Anaconda3\lib\site-packages\pandas_profiling\report\presentation\flavours\widget\notebook.py in get_notebook_iframe_srcdoc(profile)
21 width = config["notebook"]["iframe"]["width"].get(str)
22 height = config["notebook"]["iframe"]["height"].get(str)
---> 23 src = html.escape(profile.to_html())
24
25 iframe = f'<iframe width="{width}" height="{height}" srcdoc="{src}" frameborder="0" allowfullscreen></iframe>'
C:\ProgramData\Anaconda3\lib\site-packages\pandas_profiling\profile_report.py in to_html(self)
357
358 """
--> 359 return self.html
360
361 def to_json(self) -> str:
C:\ProgramData\Anaconda3\lib\site-packages\pandas_profiling\profile_report.py in html(self)
177 def html(self):
178 if self._html is None:
--> 179 self._html = self._render_html()
180 return self._html
181
C:\ProgramData\Anaconda3\lib\site-packages\pandas_profiling\profile_report.py in _render_html(self)
284 from pandas_profiling.report.presentation.flavours import HTMLReport
285
--> 286 report = self.report
287
288 disable_progress_bar = not config["progress_bar"].get(bool)
C:\ProgramData\Anaconda3\lib\site-packages\pandas_profiling\profile_report.py in report(self)
171 def report(self):
172 if self._report is None:
--> 173 self._report = get_report_structure(self.description_set)
174 return self._report
175
C:\ProgramData\Anaconda3\lib\site-packages\pandas_profiling\profile_report.py in description_set(self)
152 def description_set(self):
153 if self._description_set is None:
--> 154 self._description_set = describe_df(self.title, self.df, self._sample)
155 return self._description_set
156
C:\ProgramData\Anaconda3\lib\site-packages\pandas_profiling\model\describe.py in describe(title, df, sample)
100 # Scatter matrix
101 pbar.set_postfix_str("Get scatter matrix")
--> 102 scatter_matrix = get_scatter_matrix(df, variables)
103 pbar.update()
104
C:\ProgramData\Anaconda3\lib\site-packages\pandas_profiling\model\summary.py in get_scatter_matrix(df, variables)
696 for y in continuous_variables:
697 if x in continuous_variables:
--> 698 scatter_matrix[x][y] = scatter_pairwise(df[x], df[y], x, y)
699 else:
700 scatter_matrix = {}
C:\ProgramData\Anaconda3\lib\contextlib.py in inner(*args, **kwds)
71 #wraps(func)
72 def inner(*args, **kwds):
---> 73 with self._recreate_cm():
74 return func(*args, **kwds)
75 return inner
C:\ProgramData\Anaconda3\lib\contextlib.py in __enter__(self)
110 del self.args, self.kwds, self.func
111 try:
--> 112 return next(self.gen)
113 except StopIteration:
114 raise RuntimeError("generator didn't yield") from None
C:\ProgramData\Anaconda3\lib\site-packages\pandas_profiling\visualisation\context.py in manage_matplotlib_context()
77 register_matplotlib_converters()
78 matplotlib.rcParams.update(customRcParams)
---> 79 sns.set_style(style="white")
80 yield
81 finally:
AttributeError: module 'seaborn' has no attribute 'set_style'
The solution was unistall / reinstall the Anaconda and the pandas-profiling. Probably some version issue as suggested by Paul H on the comments.

Accessing Shared Mailbox Using Exchangelib — Python

Trying to Access a Shared Folder using the following code :
credentials = Credentials(username = user_name, password = "secret")
config = Configuration(server ='outlook.office365.com', credentials = credentials, auth_type=NTLM)
account = Account(primary_smtp_address = 'shared_mail#domain.com', credentials = credentials, autodiscover = False, config = config, access_type = DELEGATE,)
The above three lines of Code work perfectly but we are unable to get the root,
the following code : account.root.tree() or account.root throws the following error:
KeyError Traceback (most recent call last)
~\anaconda3\lib\site-packages\cached_property.py in __get__(self, obj, cls)
68 # check if the value was computed before the lock was acquired
---> 69 return obj_dict[name]
70
KeyError: 'root'
During handling of the above exception, another exception occurred:
ErrorNonExistentMailbox Traceback (most recent call last)
<ipython-input-46-a90a4f76ca21> in <module>
2 logging.basicConfig(level=logging.DEBUG)
3
----> 4 account.root.tree()
~\anaconda3\lib\site-packages\cached_property.py in __get__(self, obj, cls)
71 except KeyError:
72 # if not, do the calculation and release the lock
---> 73 return obj_dict.setdefault(name, self.func(obj))
74
75
~\anaconda3\lib\site-packages\exchangelib\account.py in root(self)
268 #threaded_cached_property
269 def root(self):
--> 270 return Root.get_distinguished(account=self)
271
272 #threaded_cached_property
~\anaconda3\lib\site-packages\exchangelib\folders\roots.py in get_distinguished(cls, account)
107 return cls.resolve(
108 account=account,
--> 109 folder=cls(account=account, name=cls.DISTINGUISHED_FOLDER_ID, is_distinguished=True)
110 )
111 except ErrorFolderNotFound:
~\anaconda3\lib\site-packages\exchangelib\folders\base.py in resolve(cls, account, folder)
485 def resolve(cls, account, folder):
486 # Resolve a single folder
--> 487 folders = list(FolderCollection(account=account, folders=[folder]).resolve())
488 if not folders:
489 raise ErrorFolderNotFound('Could not find folder %r' % folder)
~\anaconda3\lib\site-packages\exchangelib\folders\collections.py in resolve(self)
254 additional_fields = self.get_folder_fields(target_cls=self._get_target_cls(), is_complex=None)
255 for f in self.__class__(account=self.account, folders=resolveable_folders).get_folders(
--> 256 additional_fields=additional_fields
257 ):
258 yield f
~\anaconda3\lib\site-packages\exchangelib\folders\collections.py in get_folders(self, additional_fields)
317 folders=self.folders,
318 additional_fields=additional_fields,
--> 319 shape=ID_ONLY,
320 ):
321 yield f
~\anaconda3\lib\site-packages\exchangelib\services\get_folder.py in call(self, folders, additional_fields, shape)
32 **dict(
33 additional_fields=additional_fields,
---> 34 shape=shape,
35 )
36 )):
~\anaconda3\lib\site-packages\exchangelib\services\common.py in _pool_requests(self, payload_func, items, **kwargs)
538 for i, chunk in enumerate(chunkify(items, self.chunk_size), start=1):
539 log.debug('Processing %s chunk %s containing %s items', self.__class__.__name__, i, len(chunk))
--> 540 for elem in self._get_elements(payload=payload_func(chunk, **kwargs)):
541 yield elem
542
~\anaconda3\lib\site-packages\exchangelib\services\common.py in _get_elements_in_response(self, response)
401 def _get_elements_in_response(self, response):
402 for msg in response:
--> 403 container_or_exc = self._get_element_container(message=msg, name=self.element_container_name)
404 if isinstance(container_or_exc, (bool, Exception)):
405 yield container_or_exc
~\anaconda3\lib\site-packages\exchangelib\services\common.py in _get_element_container(self, message, response_message, name)
360 # rspclass == 'Error', or 'Success' and not 'NoError'
361 try:
--> 362 raise self._get_exception(code=response_code, text=msg_text, msg_xml=msg_xml)
363 except self.ERRORS_TO_CATCH_IN_RESPONSE as e:
364 return e
ErrorNonExistentMailbox: Mailbox does not exist.
The same code seems to be working here : https://medium.com/#theamazingexposure/accessing-shared-mailbox-using-exchangelib-python-f020e71a96ab
Also checked this thread https://github.com/ecederstrand/exchangelib/issues/391 and tried almost all the solutions but facing the same error.

UnsupportedOperation: not writabl, in python while counting coins in chainsaw

What I'm trying to do is to print ot the total number of coins in blockchain.
I'm working with the examples from the Chainscan manual
Here is my code so far:
from chainscan import iter_blocks
total_btc = 0
for block in iter_blocks(show_progressbar = True):
coinbase_tx = next(iter(block.txs)) # the first tx is coinbase
total_btc += coinbase_tx.get_total_output_value()
print('Total %d satoshis (up to block height %d)' % (total_btc, block.height))
The Problem is that I get an UnsupportedOperation error. Here is the traceback:
UnsupportedOperation Traceback (most recent call last)
<ipython-input-3-2b54aca19755> in <module>()
1 total_btc = 0
----> 2 for block in iter_blocks(show_progressbar = True):
3 coinbase_tx = next(iter(block.txs)) # the first tx is coinbase
4 total_btc += coinbase_tx.get_total_output_value()
5 print('Total %d satoshis (up to block height %d)' % (total_btc, block.height))
/usr/local/lib/python3.5/dist-packages/chainscan/utils.py in iter_blocks(block_iter, **kwargs)
23 """
24 if block_iter is None:
---> 25 block_iter = LongestChainBlockIterator(**kwargs)
26 return block_iter
27
/usr/local/lib/python3.5/dist-packages/chainscan/scan.py in __init__(self, block_iter, height_safety_margin, block_filter, **kwargs)
322 """
323 if block_iter is None:
--> 324 block_iter = TopologicalBlockIterator(**kwargs)
325 self.block_iter = block_iter
326 if height_safety_margin is None:
/usr/local/lib/python3.5/dist-packages/chainscan/scan.py in __init__(self, rawfile_block_iter, **kwargs)
230 """
231 if rawfile_block_iter is None:
--> 232 rawfile_block_iter = RawFileBlockIterator(**kwargs)
233 self.rawfile_block_iter = rawfile_block_iter
234
/usr/local/lib/python3.5/dist-packages/chainscan/scan.py in __init__(self, raw_data_iter, **kwargs)
155 """
156 if raw_data_iter is None:
--> 157 raw_data_iter = RawDataIterator(**kwargs)
158 self.raw_data_iter = raw_data_iter
159
/usr/local/lib/python3.5/dist-packages/chainscan/rawfiles.py in __init__(self, raw_files_iter, use_mmap, **kwargs)
115 """
116 if raw_files_iter is None:
--> 117 raw_files_iter = RawFilesIterator(**kwargs)
118 self.raw_files_iter = raw_files_iter
119 self.use_mmap = use_mmap
.
/usr/local/lib/python3.5/dist-packages/click/utils.py in echo(message, file, nl, err, color)
257
258 if message:
--> 259 file.write(message)
260 file.flush()
261
UnsupportedOperation: not writable
Any ideas?
Thanks in advance.

Categories

Resources