'NoneType' object has no attribute 'decode'

Issue #20 new
Scott Rappoport created an issue

Hi,

I am trying to run the sas7bdat_to_csv script to convert a SAS file to csv at the command line. Here is what I am running, along with the error stack:

d:\Test_Data>python D:\sas7bdat-2.0.6\scripts\sas7bdat_to_csv CCRCancer_test.sas7bdat [CCRCancer_test.sas7bdat] magic number mismatch [CCRCancer_test.sas7bdat] Failed to read a meta data page from file Traceback (most recent call last): File "D:\sas7bdat-2.0.6\scripts\sas7bdat_to_csv", line 97, in <module> main(options, args) File "D:\sas7bdat-2.0.6\scripts\sas7bdat_to_csv", line 38, in main with SAS7BDAT(in_files[i], log_level=log_level, **opts) as f: File "C:\Program Files (x86)\Python 3.5\lib\site-packages\sas7bdat.py", line 4 47, in init self.logger.debug('\n%s', str(self.header)) File "C:\Program Files (x86)\Python 3.5\lib\site-packages\sas7bdat.py", line 1 486, in repr self.properties.name.decode(self.parent.encoding, AttributeError: 'NoneType' object has no attribute 'decode'

I installed six and sas7bdat earlier; Here are the success messages: C:\Program Files (x86)\Python 3.5>pip install six Collecting six Downloading six-1.10.0-py2.py3-none-any.whl Installing collected packages: six Successfully installed six-1.10.0

C:\Program Files (x86)\Python 3.5>python D:\sas7bdat-2.0.6\scripts\sas7bdat_to_csv M:\Test_Data\CCRCancer_test.sas7bdat Traceback (most recent call last): File "D:\sas7bdat-2.0.6\scripts\sas7bdat_to_csv", line 11, in <module> from sas7bdat import SAS7BDAT ImportError: No module named 'sas7bdat'

C:\Program Files (x86)\Python 3.5>pip install sas7bdat Collecting sas7bdat Downloading sas7bdat-2.0.6.tar.gz Requirement already satisfied (use --upgrade to upgrade): six>=1.8.0 in c:\progr am files (x86)\python 3.5\lib\site-packages (from sas7bdat) Installing collected packages: sas7bdat Running setup.py install for sas7bdat Successfully installed sas7bdat-2.0.6

d:\Test_Data>pip install sas7bdat --upgrade Requirement already up-to-date: sas7bdat in c:\program files (x86)\python 3.5\li b\site-packages Requirement already up-to-date: six>=1.8.0 in c:\program files (x86)\python 3.5\ lib\site-packages (from sas7bdat)

The only thing I could think of was that the files were in the wrong place. Microsoft installed to the User\AppData\Local\VirtualStore\Program Files (x86)\Python 3.5\Lib\site-packages directory. I moved the files to their requisite places under the C:\Program Files (x86)\Python 3.5 directories. Still the same error.

Thoughts?

Thank you,

Scott Rappoport

Comments (1)

  1. Scott Rappoport reporter

    Actually, I should search first and ask questions later... :)

    I see from a different post that "Magic number mismatch means the file is not a sas7bdat file or the file was corrupted somehow."

    Hmmmm.... Back to the providers of Source data after I qualify things some more.

    Again, Thank you for having such a great site.

    Best,

    Scott

  2. Log in to comment