我正在尝试使用 PythonNet 在 Jupyter Notebook python 脚本中使用 .NET Core 库。最近添加了对 .NET Core 的支持(请参阅https://github.com/pythonnet/pythonnet/issues/984#issuecomment-778786164),但我仍然收到No module named 'TestAppCore'错误。
我在 PythonNet 中使用 .NET Framework 库没有问题,只有 .NET Core 没有问题。任何有关诊断和解决问题的帮助将不胜感激。
我尝试使用的 C# 库是一个简单的类库项目,根本没有依赖项。下面是完整的代码:
namespace TestAppCore
{
public class Foo
{
public int ID { get; set; }
public Foo(int id)
{
ID = id;
}
public int Add(int a, int b)
{
return a + b;
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是 python 脚本:
from clr_loader import get_coreclr
from pythonnet import set_runtime
rt …Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个用于创建其他 .xlsm 工作簿的工作簿,但无法弄清楚如何获取我需要的模块,以便我可以添加它们。
我的代码如下(根据此处给出的答案进行修改:如何以编程方式添加 excel 2010 宏)
我需要帮助的地方是在 ImportModules 子中,通过注释'LIST MODULES HERE
如何获取当前工作簿中的模块数组?
Private Sub SVAmaker_Click()
Dim file As String
file = InputBox("SVA Planner file name", "Name", "Name")
Application.DefaultSaveFormat = xlOpenXMLWorkbookMacroEnabled
Workbooks.Add
ActiveWorkbook.SaveAs filename:=file
Dim WB As Workbook
WB = ActiveWorkbook
Call ImportModules(VBA.CStr(WB))
End Sub
Sub ImportModules(sWorkbookname As String)
Dim cmpComponents As VBIDE.VBComponents
Dim wbkTarget As Excel.Workbook
Set wbkTarget = Workbooks.Open(sWorkbookname)
If wbkTarget.VBProject.Protection = 1 Then
Debug.Print wbkTarget.Name & " has a protected project, cannot import module" …Run Code Online (Sandbox Code Playgroud) 我有两个分支,master 和turtles,turtles 领先于master 一项提交:“我喜欢turtles”。
在 GitLab 中,我有以下.yml文件,每当创建合并请求或通过推送分支进行合并来更新该请求时,该文件都会运行:
update-doc:
stage: deploy
script:
- echo $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
- 'echo $(git log --abbrev-commit remotes/origin/master)'
- 'echo $(git log --abbrev-commit remotes/origin/master..remotes/origin/${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME})'
- 'echo $(git cherry -v remotes/origin/master remotes/origin/turtles --abbrev=1)'
only:
- merge_requests
Run Code Online (Sandbox Code Playgroud)
在我的 Windows 计算机和我们托管 GitLab 的 Linux 虚拟机上运行Git Bashgit log --abbrev-commit remotes/origin/master..remotes/origin/turtles或在 Git Bash 中会返回提交消息“我喜欢海龟”,正如预期的那样。git cherry -v remotes/origin/master remotes/origin/turtles但是当.yml文件运行时,它找不到分支remotes/origin/turtles,我得到以下输出:
$ echo $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
海龟
$ echo $(git log --abbrev-commit remotes/origin/master)
8406e4d 更新 .gitlab-ci.yml
$ echo …
我现在正在做一个课程,一个任务是创建一个程序,通过修改他们提供的一些代码(简单地复制图像)来调整24位位图图像的大小.调整大小本身不是问题,但是当我使用Valgrind运行内存泄漏检查时,我会继续收到以下消息.我不能为我的生活弄清楚我哪里出错了,并会欣赏一些关于漏洞在哪里的指针(双关语绝对有意),但仅此而已.
另外,如果你能让我知道我的代码有多好,或者我在编程方面有所改进,那将非常感激.
这是我的代码:
#include <stdio.h>
#include <stdlib.h>
#include "bmp.h"
int main(int argc, char* argv[])
{
// ensure proper usage
if (argc != 4)
{
printf("Usage: ./copy n infile outfile\n");
return 1;
}
// remember factor and filenames
int n = atoi(argv[1]);
char* infile = argv[2];
char* outfile = argv[3];
// check if scale factor is valid (i.e. between 1 and 100)
if ((n < 1) || (n > 100))
{
printf("Invalid scale factor, enter value between 1 and 100 inclusive\n"); …Run Code Online (Sandbox Code Playgroud)