Skip to content

Logging fails to create output file in Windows #544

Closed

Description

@drewaogle

From a user on ApertureDB Slack:

Cell In[18], line 4
   1 from langchain_community.vectorstores import ApertureDB
   2 import logging
----> 4 vector_db = ApertureDB.from_documents(documents, embeddings)
File RAG Anywhere\.venv\Lib\site-packages\langchain_community\vectorstores\aperturedb.py:421, in ApertureDB.from_documents(cls, documents, embedding, **kwargs)
  405 @classmethod
  406 @override
  407 def from_documents(
  (...)
  411  **kwargs: Any,
  412 ) -> ApertureDB:
  413  """Creates a new vectorstore from a list of documents
  414
  415  Args:
  (...)
  419    kwargs: Additional arguments to pass to the constructor
  420  """
--> 421  store = cls(embeddings=embedding, **kwargs)
  422  store.add_documents(documents)
  423  return store
File RAG Anywhere\.venv\Lib\site-packages\langchain_community\vectorstores\aperturedb.py:98, in ApertureDB.__init__(self, embeddings, descriptor_set, dimensions, engine, metric, log_level, properties, **kwargs)
   92  self.logger.exception(
   93    "ApertureDB is not installed. Please install it using "
   94    "'pip install aperturedb'"
   95  )
   96  raise
---> 98 self.connection = create_connector()
   99 self.utils = Utils(self.connection)
  100 try:
File RAG Anywhere\.venv\Lib\site-packages\aperturedb\Utils.py:910, in create_connector()
  908 def create_connector():
  909  from aperturedb.CommonLibrary import create_connector, issue_deprecation_warning
--> 910  issue_deprecation_warning("Utils.create_connector",
  911               "CommonLibrary.create_connector")
  912  return create_connector()
File RAG Anywhere\.venv\Lib\site-packages\aperturedb\CommonLibrary.py:347, in issue_deprecation_warning(old_name, new_name)
  343 def issue_deprecation_warning(old_name, new_name):
  344  """
  345  Issue a deprecation warning for a function and class.
  346  """
--> 347  logger.warning(
  348    f"{old_name} is deprecated and will be removed in a future release. Use {new_name} instead.")
File ~\AppData\Local\Programs\Python\Python312\Lib\logging\__init__.py:1551, in Logger.warning(self, msg, *args, **kwargs)
  1542 """
  1543 Log 'msg % args' with severity 'WARNING'.
  1544
  (...)
  1548 logger.warning("Houston, we have a %s", "bit of a problem", exc_info=True)
  1549 """
  1550 if self.isEnabledFor(WARNING):
-> 1551  self._log(WARNING, msg, args, **kwargs)
File ~\AppData\Local\Programs\Python\Python312\Lib\logging\__init__.py:1684, in Logger._log(self, level, msg, args, exc_info, extra, stack_info, stacklevel)
  1681    exc_info = sys.exc_info()
  1682 record = self.makeRecord(self.name, level, fn, lno, msg, args,
  1683             exc_info, func, extra, sinfo)
-> 1684 self.handle(record)
File ~\AppData\Local\Programs\Python\Python312\Lib\logging\__init__.py:1700, in Logger.handle(self, record)
  1698 if isinstance(maybe_record, LogRecord):
  1699  record = maybe_record
-> 1700 self.callHandlers(record)
File ~\AppData\Local\Programs\Python\Python312\Lib\logging\__init__.py:1762, in Logger.callHandlers(self, record)
  1760  found = found + 1
  1761  if record.levelno >= hdlr.level:
-> 1762    hdlr.handle(record)
  1763 if not c.propagate:
  1764  c = None  #break out
File ~\AppData\Local\Programs\Python\Python312\Lib\logging\__init__.py:1028, in Handler.handle(self, record)
  1026 self.acquire()
  1027 try:
-> 1028  self.emit(record)
  1029 finally:
  1030  self.release()
File ~\AppData\Local\Programs\Python\Python312\Lib\logging\__init__.py:1278, in FileHandler.emit(self, record)
  1276 if self.stream is None:
  1277  if self.mode != 'w' or not self._closed:
-> 1278    self.stream = self._open()
  1279 if self.stream:
  1280  StreamHandler.emit(self, record)
File ~\AppData\Local\Programs\Python\Python312\Lib\logging\__init__.py:1263, in FileHandler._open(self)
  1258 """
  1259 Open the current base file with the (original) mode and encoding.
  1260 Return the resulting stream.
  1261 """
  1262 open_func = self._builtin_open
-> 1263 return open_func(self.baseFilename, self.mode,
  1264         encoding=self.encoding, errors=self.errors)
OSError: [Errno 22] Invalid argument: 'RAG Anywhere\\error.2024-12-30T14:39:53.758405.log'

Activity

  1. drewaogle commented on Jan 6, 2025

    @drewaogle
    ContributorAuthor

    After debugging we realized the issue was that windows doesn't support ':' in filenames.

  2. self-assigned this
    on Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions