Open ericdill opened 5 years ago
After a bit more digging, it seems that some of the sparkmagic files have \ufeff
characters at the beginning of them:
bad_file = '/home/ericdill/dev/sparkmagic/hdijupyterutils/hdijupyterutils/log.py'
with open(bad_file, 'r', encoding='utf-8') as f:
content = f.read()
print(content)
Shows:
'\ufeff# Distributed under the terms of the Modified BSD License.\n\nfrom __future__ import print_function\nimport logging\nimport logging.config\n\nfrom .constants import LOGGING_CONFIG_CLASS_NAME\n\n\nclass Log(object):\n """Logger for magics. A small wrapper class around the configured logger described in the configuration file"""\n def __init__(self, logger_name, logging_config, caller_name):\n logging.config.dictConfig(logging_config)\n \n assert caller_name is not None\n self._caller_name = caller_name\n self.logger_name = logger_name\n self._getLogger()\n\n def debug(self, message):\n self.logger.debug(self._transform_log_message(message))\n\n def error(self, message):\n self.logger.error(self._transform_log_message(message))\n\n def info(self, message):\n self.logger.info(self._transform_log_message(message))\n\n def _getLogger(self):\n self.logger = logging.getLogger(self.logger_name)\n\n def _transform_log_message(self, message):\n return u\'{}\\t{}\'.format(self._caller_name, message)\n\n\ndef logging_config():\n return {\n u"version": 1,\n u"formatters": {\n u"magicsFormatter": {\n u"format": u"%(asctime)s\\t%(levelname)s\\t%(message)s",\n u"datefmt": u""\n }\n },\n u"handlers": {\n u"magicsHandler": {\n u"class": LOGGING_CONFIG_CLASS_NAME,\n u"formatter": u"magicsFormatter",\n u"home_path": "~/.hdijupyterutils"\n }\n },\n u"loggers": {\n u"magicsLogger": {\n u"handlers": [u"magicsHandler"],\n u"level": u"DEBUG",\n u"propagate": 0\n }\n }\n } \n'
Not quite sure yet how to fix this issue
@CJ-Wright is this similar to that issue you encountered with adal
?
Yes I think this is fixed now?
Did we fix this in depfinder?
I think so, I think this was the same weird starting character that I was running into before. I did not run the test though, so reopening.
What in the world is going on here. @ocefpaf @CJ-Wright @tonyfast anyone have cycles to help me figure out what's going on?
hub clone jupyter-incubator/sparkmagic
)hdijupyterutils
subdir (depfinder ./hdijupyterutils
)I edited my local install of depfinder to print out the files it was parsing:
So it seems like these files have some invalid characters in them, but i've got no idea how to find out which characters are "invalid". Also this seems insane because the library clearly works... help!