Azure / Azure-Data-Service-Notebook

Magic functions for using Jupyter Notebook with Azure Data Service
MIT License
6 stars 6 forks source link

Sample with txt file get error no separator #27

Closed jingyanjingyan closed 6 years ago

jingyanjingyan commented 6 years ago

Describe the bug Sample with txt file get error no separator.

To Reproduce Steps to reproduce the behavior:

  1. sample_data = %adl sample --account devtooltelemetryadls --file_path catest.txt --file_type txt --encoding utf-8 --row_number 500

Expected behavior show the content of the test txt file

Screenshots image

Desktop (please complete the following information): OS: Win10 Browser: chrome Jupyter Version: Python 3.6.2, Jupyter 4.4.0

Additional context

Sampling data lake store file 'catest.txt'...

ValueError Traceback (most recent call last)

in () ----> 1 sample_data = get_ipython().run_line_magic('adl', 'sample --account devtooltelemetryadls --file_path catest.txt --file_type txt --encoding utf-8 --row_number 500') c:\python36\lib\site-packages\IPython\core\interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth) 2129 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals 2130 with self.builtin_trap: -> 2131 result = fn(*args,**kwargs) 2132 return result 2133 in adl(self, line, cell) c:\python36\lib\site-packages\IPython\core\magic.py in (f, *a, **k) 185 # but it's overkill for just that one bit of state. 186 def magic_deco(arg): --> 187 call = lambda f, *a, **k: f(*a, **k) 188 189 if callable(arg): c:\python36\lib\site-packages\adlmagics\adlmagics_main.py in adl(self, line, cell) 65 66 magic = self.__magics[cmd] ---> 67 return magic.execute(arg_string, cell) 68 69 def __register_azure_magic(self, azure_magic_class): c:\python36\lib\site-packages\adlmagics\magics\adls\adls_file_sampling_magic.py in execute(self, arg_string, content_string) 21 self._write_line("Sampling data lake store file '%s'..." % (args.file_path)) 22 ---> 23 read_lines = self._adls_service.read_file(args.account, args.file_path, args.encoding, self.__fileTypeColumnSepMappings[args.file_type], args.row_number) 24 25 self._write_line("(%d) row(s) sampled." % (len(read_lines))) c:\python36\lib\site-packages\adlmagics\services\adls_service_sdk_impl.py in read_file(self, account, file_path, encoding, column_sep, to_be_read_line_count) 61 with adls_fs_client.open(file_path) as f: 62 for read_line in f: ---> 63 read_lines.append(read_line.decode(encoding).strip().split(column_sep)) 64 read_line_count += 1 65 if (read_line_count >= to_be_read_line_count): ValueError: empty separator
jingyanjingyan commented 6 years ago

Repro at 07-25-2018