bw_processing.datapackage.fs.close()
uses grp
(which is not available in Pyodide)
#38
Labels
bw_processing.datapackage.fs.close()
uses grp
(which is not available in Pyodide)
#38
Running
in https://live.brightway.dev/ returns the error:
Full Output
``` --------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) Cell In[5], line 1 ----> 1 bw2io.add_example_database(searchable=False)File /lib/python3.11/site-packages/bw2io/data/init.py:471, in add_example_database(overwrite, searchable)
469 importer.apply_strategies()
470 importer.match_database(fields=["name"])
--> 471 importer.write_database(activate_parameters=True, searchable=searchable)
473 group = "Mobility exchanges"
474 Group.delete().where(Group.name == group).execute()
File /lib/python3.11/site-packages/bw2io/importers/excel.py:282, in ExcelImporter.write_database(self, **kwargs)
280 """Same as base
write_database
method, butactivate_parameters
is True by default."""281 kwargs["activate_parameters"] = kwargs.get("activate_parameters", True)
--> 282 super(ExcelImporter, self).write_database(**kwargs)
File /lib/python3.11/site-packages/bw2io/importers/base_lci.py:273, in LCIImporter.write_database(self, data, delete_existing, backend, activate_parameters, db_name, searchable, **kwargs)
271 warnings.simplefilter("ignore")
272 db = Database(db_name, backend=backend)
--> 273 db.register(**self.metadata)
275 self.write_database_parameters(activate_parameters, delete_existing)
277 existing.update(data)
File /lib/python3.11/site-packages/bw2data/backends/base.py:220, in SQLiteBackend.register(self, write_empty, **kwargs)
218 super().register(**kwargs)
219 if write_empty:
--> 220 self.write({}, searchable=False)
File /lib/python3.11/site-packages/bw2data/project.py:432, in writable_project(wrapped, instance, args, kwargs)
429 @wrapt.decorator
430 def writable_project(wrapped, instance, args, kwargs):
431 warnings.warn("
writable_project
is obsolete and does nothing", DeprecationWarning)--> 432 return wrapped(*args, **kwargs)
File /lib/python3.11/site-packages/bw2data/backends/base.py:535, in SQLiteBackend.write(self, data, process, searchable)
532 self.make_searchable(reset=True)
534 if process:
--> 535 self.process()
File /lib/python3.11/site-packages/bw2data/backends/base.py:826, in SQLiteBackend.process(self, csv)
813 df = pandas.DataFrame([get_csv_data_dict(ds) for ds in self])
814 dp.add_csv_metadata(
815 dataframe=df,
816 valid_for=[
(...)
823 name=clean_datapackage_name(self.name + " activity metadata"),
824 )
--> 826 dp.finalize_serialization()
828 self.metadata["depends"] = sorted(dependents)
829 self.metadata["dirty"] = False
File /lib/python3.11/site-packages/bw_processing/datapackage.py:382, in Datapackage.finalize_serialization(self)
374 self._check_length_consistency()
376 file_writer(
377 data=self.metadata,
378 fs=self.fs,
379 resource="datapackage.json",
380 mimetype="application/json",
381 )
--> 382 self.fs.close()
File /lib/python3.11/site-packages/fs/zipfs.py:297, in WriteZipFS.close(self)
295 if not self.isclosed():
296 try:
--> 297 self.write_zip()
298 finally:
299 self._temp_fs.close()
File /lib/python3.11/site-packages/fs/zipfs.py:325, in WriteZipFS.write_zip(self, file, compression, encoding)
309 """Write zip to a file.
310
311 Arguments:
(...)
322
323 """
324 if not self.isclosed():
--> 325 write_zip(
326 self._temp_fs,
327 file or self._file,
328 compression=compression or self.compression,
329 encoding=encoding or self.encoding,
330 )
File /lib/python3.11/site-packages/fs/compress.py:60, in write_zip(src_fs, file, compression, encoding, walker)
58 with _zip:
59 gen_walk = walker.info(src_fs, namespaces=["details", "stat", "access"])
---> 60 for path, info in gen_walk:
61 # Zip names must be relative, directory names must end
62 # with a slash.
63 zip_name = relpath(path + "/" if info.is_dir else path)
64 if not six.PY3:
65 # Python2 expects bytes filenames
File /lib/python3.11/site-packages/fs/walk.py:400, in Walker.info(self, fs, path, namespaces)
398 _combine = combine
399 _walk = self._iter_walk(fs, path=path, namespaces=namespaces)
--> 400 for _path, info in _walk:
401 if info is not None:
402 yield _combine(_path, info.name), info
File /lib/python3.11/site-packages/fs/walk.py:427, in Walker._walk_breadth(self, fs, path, namespaces)
425 while queue:
426 dir_path = pop()
--> 427 for info in _scan(fs, dir_path, namespaces=namespaces):
428 if info.is_dir:
429 _depth = _calculate_depth(dir_path) - depth + 1
File /lib/python3.11/site-packages/fs/walk.py:287, in Walker._scan(self, fs, dir_path, namespaces)
273 """Get an iterator of
Info
objects for a directory path.274
275 Arguments:
(...)
284
285 """
286 try:
--> 287 for info in fs.scandir(dir_path, namespaces=namespaces):
288 yield info
289 except FSError as error:
File /lib/python3.11/site-packages/fs/osfs.py:511, in OSFS.scandir(self, path, namespaces)
505 info["stat"] = {
506 k: getattr(stat_result, k)
507 for k in dir(stat_result)
508 if k.startswith("st")
509 }
510 if "access" in namespaces:
--> 511 info["access"] = self._make_access_from_stat(
512 stat_result
513 )
514 if "lstat" in namespaces:
515 lstat_result = dir_entry.stat(follow_symlinks=False)
File /lib/python3.11/site-packages/fs/osfs.py:226, in OSFS._make_access_from_stat(cls, stat_result)
224 access["uid"] = uid = stat_result.st_uid
225 if not _WINDOWS_PLATFORM:
--> 226 import grp
227 import pwd
229 try:
ModuleNotFoundError: The module 'grp' is removed from the Python standard library in the Pyodide distribution due to browser limitations.
See https://pyodide.org/en/stable/usage/loading-packages.html for more details.
The text was updated successfully, but these errors were encountered: