Jython-将模块路径配置为jython脚本 [英] Jython - Configuring modules path into a jython script

查看:118
本文介绍了Jython-将模块路径配置为jython脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

函数os.chdir()不适用于Jython,是否有另一种方法可以在Jython脚本中切换工作目录?

Looks like function os.chdir() does not works for Jython, is there another way to switch of working directory in a Jython script ?

(运行我的脚本时出现以下错误:OSError:Java不支持[Errno 0] chdir)

(Get the following error while running my script: OSError: [Errno 0] chdir not supported in Java)

预先感谢您提供任何解决方案.

Thanks in advance for any solution.

问题标题已更新,以匹配解决方案.标签也是如此.

Question title updated to match the solution. Tags too.

推荐答案

格里米(Grimmy)提出的问题使我对原来的问题有所不同(感谢您)

What Grimmy asked make me think different about my original problem (thanks to you)

我的目标是(是)定义一条路径以找到本地jython模块.因此正确的方法是更新"sys.path".

My goal is (was) to define a path to find local jython modules. And so the correct way is to update 'sys.path'.

示例:

sys.path.append(workingDirectory)

问题已解决.再次感谢Grimmy.

Problem solved. Thanks again Grimmy.

这篇关于Jython-将模块路径配置为jython脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆