LUCKYLUFFY的个人博客分享 http://blog.sciencenet.cn/u/LUCKYLUFFY

博文

windows max path导致的问题ValueError: source code string ...

已有 8702 次阅读 2018-3-2 11:33 |个人分类:Tip|系统分类:科研笔记| source, code, string, cannot, contain, source

【版权所有,转载请注明出处】

问题描述:运行python程序,在import语句部分出现:ValueError: source code string cannot contain null bytes

错误

网络搜索出来的结果:

解决方案:linux下面运行sed -i 's/\x0//g' <Filename>

测试方法:无效

 

问题回想:本机安装python 3的时候有一个

Disable path length limit的选项,但是服务器上安装的时候没有,所有猜测与这个有关。

查看系统配置:本机(Win 10 1709)服务器(Win10 1511

 

检索到的帖子:http://mspoweruser.com/ntfs-260-character-windows-10/

 

  1. Open Group Policy Editor (Press Windows      Key and type gpedit.msc and hit Enter key.

  2. Navigate      to the following directory:  Local      Computer Policy > Computer Configuration > Administrative Templates      > System > Filesystem > NTFS.

  3. Click Enable NTFS long paths option and      enable it.

 

来自 <http://mspoweruser.com/ntfs-260-character-windows-10/>

 

 

查看本机的配置【计算机配置-管理模板-文件系统】

1.png

2.png 


查看服务器的竟然没有这个

3.png

好吧,所以问题的解决方案来了。

 

想方设法把path(from module import * 中的module的路径)的长度改短一些(比如重命名,比如移动文件夹and so on)。果然,问题迎刃而解!




https://blog.sciencenet.cn/blog-3373964-1101916.html

上一篇:尾部的零
收藏 IP: 114.113.117.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-23 18:52

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部