Skip to content

Instantly share code, notes, and snippets.

@Mgregchi
Created June 19, 2023 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mgregchi/2728abcc6f499ba7b215011c9844d64c to your computer and use it in GitHub Desktop.
Save Mgregchi/2728abcc6f499ba7b215011c9844d64c to your computer and use it in GitHub Desktop.
Ckeditor_uploader ValueError: source code string cannot contain null bytes

I struggled a whole day trying to solve the error below with no success.

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "C:\Users\USER-PC\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "C:\Users\USER-PC\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\USER-PC\Documents\ALX\vpnprobe\Lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\USER-PC\Documents\ALX\vpnprobe\Lib\site-packages\django\core\management\commands\runserver.py", line 125, in inner_run
    autoreload.raise_last_exception()
  File "C:\Users\USER-PC\Documents\ALX\vpnprobe\Lib\site-packages\django\utils\autoreload.py", line 87, in raise_last_exception
    raise _exception[1]
  File "C:\Users\USER-PC\Documents\ALX\vpnprobe\Lib\site-packages\django\core\management\__init__.py", line 394, in execute
    autoreload.check_errors(django.setup)()
  File "C:\Users\USER-PC\Documents\ALX\vpnprobe\Lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\USER-PC\Documents\ALX\vpnprobe\Lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Users\USER-PC\Documents\ALX\vpnprobe\Lib\site-packages\django\apps\registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\USER-PC\Documents\ALX\vpnprobe\Lib\site-packages\django\apps\config.py", line 193, in create
    import_module(entry)
  File "C:\Users\USER-PC\AppData\Local\Programs\Python\Python311\Lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 936, in exec_module
  File "<frozen importlib._bootstrap_external>", line 1074, in get_code
  File "<frozen importlib._bootstrap_external>", line 1004, in source_to_code
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
ValueError: source code string cannot contain null bytes

I created a fresh django project, started typing in the codes instead of pasting the existing because I wasn't sure what is going on. I already tried check for null bytes in my codes but found none.

Then I noticed that after I added this line:

INSTALLED_APPS = [

'ckeditor',
'ckeditor_uploader',
...

ckeditor_uploader specifically, and run the local server, the said error pops up, leading me to confirm and it sure was the source of the error. The version is django-ckeditor 6.5.1

I am wondering what is going on with the package. Is it a known issues? I doubt tho b'cause I used this same lib few months ago.

@ckeditor

@Mgregchi
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment