0

I am currently working with python and Sublime to work on a project with to retrieve Tweets. this is the code I am trying to complete, but I am unable to finish importing datafreeze.

import datafreeze
import dataset

db = dataset.connect("sqlite:///tweets.db")
result = db["tweets"].all()

datafreeze.freeze(result, format='csv', filename='twittertweets.csv')
print('ding')

This is the message I receive:

Traceback (most recent call last):
  File "C:\Users\NAME\Documents\Capstone\Archive\Archive\read_database.py", line 2, in <module>
    import datafreeze
  File "C:\Users\NAME\AppData\Local\Programs\Python\Python38-32\lib\site-packages\datafreeze\__init__.py", line 1, in <module>
    from datafreeze.app import freeze
  File "C:\Users\NAME\AppData\Local\Programs\Python\Python38-32\lib\site-packages\datafreeze\app.py", line 4, in <module>
    import dataset
  File "C:\Users\NAME\AppData\Local\Programs\Python\Python38-32\lib\site-packages\dataset\__init__.py", line 3, in <module>
    from dataset.database import Database
  File "C:\Users\NAME\AppData\Local\Programs\Python\Python38-32\lib\site-packages\dataset\database.py", line 11, in <module>
    from alembic.migration import MigrationContext
ValueError: source code string cannot contain null bytes

Im not sure how to fix the source code string cannot contain null bytes. I have imputed datafreeze through the command prompt, but can't get past this.

OdatNurd
  • 21,371
  • 3
  • 50
  • 68

1 Answers1

0

The error says: You have passed null bytes

this is a different library usecase but the error explanation is correct for your case also i guess

You have to remove the null bytes from your database using code (or manually) as the module is not able to.

divyam
  • 26
  • 7