ValueError: source code string cannot contain null bytes

ValueError: source code string cannot contain null bytes

john-Erik.eriksson
Community Visitor Community Visitor
1,396 Views
2 Replies
Message 1 of 3

ValueError: source code string cannot contain null bytes

john-Erik.eriksson
Community Visitor
Community Visitor

Plant3D have not specified which script the error occurs in but i still get this when i type plantregistercustomscripts
Command: PLANTREGISTERCUSTOMSCRIPTS
Command: Traceback (most recent call last):
File "<string>", line 1, in <module>
File "varmain\custom.pyc", line 372, in dumpAll
File "varmain\custom.pyc", line 326, in dumpAll
File "varmain\custom.pyc", line 307, in dumpFile
File "<frozen importlib._bootstrap_external>", line 407, in _check_name_wrapper
File "<frozen importlib._bootstrap_external>", line 907, in load_module
File "<frozen importlib._bootstrap_external>", line 732, in load_module
File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
File "<frozen importlib._bootstrap>", line 696, in _load
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 724, in exec_module
File "<frozen importlib._bootstrap_external>", line 860, in get_code
File "<frozen importlib._bootstrap_external>", line 791, in source_to_code
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ValueError: source code string cannot contain null bytes

 

I have tried remove all scripts from the folder and even created a new CustomScript folder but still getting this error.

Is there a way to solve this without reinstall plant3D

0 Likes
1,397 Views
2 Replies
Replies (2)
Message 2 of 3

h_eger
Mentor
Mentor

Have you already considered the file "custom.pyc"?

-

If my reply was helpful, please give a "Kudo" or click the "Accept as Solution" button below (or both).

Hartmut Eger
Senior Engineer
Anlagenplanung + Elektotechnik
XING | LinkedIn

EESignature



0 Likes
Message 3 of 3

quan_hm
Collaborator
Collaborator

I happen to occur the same issue with my client, the root cause is your CustomScripts folder contain invalid scripts (because he install Axelerator plug in and these scripts are broken).

First you need to check where is your current content folder in spec editor: 

minhquanqttb_0-1716743703910.png

Now you check your customscripts folder at: your_content_folder/CPak Common/CustomScripts.

check there and remove all the scripts and add again with try and error to see which one is the culprit.

Another option is just to set your content folder (in spec editor) at different location.

 

Hope that help.

Hoang Minh Quan - Piping design engineer
Autodesk Store for Python Catalog
0 Likes