python - 使用 python 子进程调用时如何让 GAP 识别 Read("filename.g")
问题描述
我正在研究计算数论,我使用一个名为 GAP(组、代数和编程)的软件包。我想建立一个系统,我可以在其中调用 python 脚本来为我执行所有设置,以便我可以在一夜之间运行多个计算。
为此,我将需要定义的函数放入一些 .g 文件中。在 GAP 中调用这些函数的命令很简单:
Read("prelimcode1.g");
当我在间隙环境中尝试此操作时,它会为我执行设置。但是,当我尝试使用 python 读取这些文件时,我的 GAP 环境中出现了一个奇怪的错误。
我尝试的大多数修复都涉及重新组织我调用 Read("file"); 的方式。陈述。
def gapCaller():
GAPpath = r'C:\gap-4.10.1\bin\gap.bat'
deltasets= r'C:\Users\Dan\Desktop\deltasetfunctions\deltasetsinit.g'
sp.Popen([GAPpath,deltasets])
我的预期结果是 GAP 会简单地读取文件。但是,我收到以下错误消息
>Syntax error: expression expected in
C:\Users\Dan\Desktop\deltasetfunctions\deltasetsinit.g:1
>Read("prelimcode1.g");
>Read("prelimcode2.g");
>Read("prelimcode3.g");
>Read("prelimcode4.g");
带有指向第一个 R 的指示符。
解决方案
推荐阅读
- typescript - 为什么 switchMap(forkJoin) 失败但 switchMap(arr=>forkJoin(arr)) 工作正常?
- list - 如何使用列表
- > 在 Spring Boot 类实体中?
- java - 如何从 quarkus 应用程序中将墓碑消息正确发布到压缩的 kafka 主题?
- python - Google Earth Engine 上是否有覆盖或按几何连接选项?
- ios - 我有一个可选值,它被分配了一个值,打印成功,但是当我检查它时它是 nil
- javascript - axios CDN 链接被拒绝加载
- python - fig.canvas.tostring_rgb() 输出错误的长度字节,但仅在 Windows 上
- python - 将保持寄存器解码为二进制格式
- google-sheets - 如何使用谷歌财务API计算谷歌表格中每日收益的月度标准偏差
- mysql - 在 MySQL 5.7 中获取 Innodb 锁定线程 ID?