昨天,我的代码非常好。一切都在运行……而且进展顺利。突然出现这个错误:
TypeError: __new__() got an unexpected keyword argument 'deny_new'
Run Code Online (Sandbox Code Playgroud)
在我的 PyCharm 控制台中弹出。我在互联网上查过它,但我只找到了一个类似的问题,但答案为零。我希望 stackoverflow 社区能够帮助我。我没有更改我的代码,我所做的只是尝试在 heroku 上托管我的机器人,但进展并不顺利。在我最初的几次尝试之后,我放弃了。但是,我发现我的机器人开始发疯了,我无法再运行它了:<。有没有其他人经历过这个并知道如何解决它? 更新 我刚刚发现由于某种原因,它只能在我的测试服务器上运行,而不能在任何其他服务器上运行。
Traceback (most recent call last):
File "C:/Users/danie/PyCharmProjects/skybot/skybotgaming.py", line 21, in <module>
client.run('TOKEN')
File "C:\Users\danie\anaconda3\envs\discordbottest\lib\site-packages\discord\client.py", line 640, in run
return future.result()
File "C:\Users\danie\anaconda3\envs\discordbottest\lib\site-packages\discord\client.py", line 621, in runner
await self.start(*args, **kwargs)
File "C:\Users\danie\anaconda3\envs\discordbottest\lib\site-packages\discord\client.py", line 585, in start
await self.connect(reconnect=reconnect)
File "C:\Users\danie\anaconda3\envs\discordbottest\lib\site-packages\discord\client.py", line 499, in connect
await self._connect()
File "C:\Users\danie\anaconda3\envs\discordbottest\lib\site-packages\discord\client.py", line 463, in _connect
await self.ws.poll_event()
File "C:\Users\danie\anaconda3\envs\discordbottest\lib\site-packages\discord\gateway.py", line 471, in poll_event
await self.received_message(msg)
File …Run Code Online (Sandbox Code Playgroud) 我正在开发一个项目,但今天构建不再有效。错误如下:
检查AAR元数据时发现2个问题:
依赖项“androidx.core:core:1.12.0-alpha01”需要依赖它的库和应用程序根据 Android API 的代号“UpsideDownCake”进行编译。
:app 目前是针对 android-33 编译的。
建议的操作:使用不同版本的依赖项“androidx.core:core:1.12.0-alpha01”,或者如果您打算尝试该预览版 SDK,则在 build.gradle 文件中将compileSdkPreview 设置为“UpsideDownCake”。
依赖项“androidx.core:core-ktx:1.12.0-alpha01”需要依赖它的库和应用程序根据 Android API 的代号“UpsideDownCake”进行编译。
:app 目前是针对 android-33 编译的。
建议的操作:使用不同版本的依赖项“androidx.core:core-ktx:1.12.0-alpha01”,或者如果您打算尝试该预览版 SDK,则在 build.gradle 文件中将compileSdkPreview 设置为“UpsideDownCake”。
根据我的研究,我了解到根据官方文档,错误消息的版本是昨天发布的。
以下是项目正在使用的 build.gradle 脚本。在我的 build.gradle 中,我有implementation 'androidx.core:core-ktx:1.9.0'. 我不明白为什么在构建阶段添加另一个版本以及为什么androidx.core:core:1.12.0-alpha01添加。
构建.gradle:
buildscript {
apply from: './dependencies.gradle'
repositories {
google()
mavenCentral()
jcenter()
gradlePluginPortal()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.0'
classpath 'com.google.gms:google-services:4.3.14'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlin_version"
classpath "com.google.dagger:hilt-android-gradle-plugin:$versions.hilt_android"
}
}
allprojects {
repositories {
google()
mavenCentral()
jcenter()
maven { url "https://maven.google.com" …Run Code Online (Sandbox Code Playgroud) 我有一个非常简单的片段:
\n{-# LANGUAGE LinearTypes #-}\n\nmodule Lib where\n\ndata Peer st = Peer { data :: String } deriving Show\n\ndata Idle\ndata Busy\n\nsendToPeer :: Peer Idle %1-> Int -> IO (Peer Busy)\nsendToPeer c n = case c of Peer d -> pure $ Peer d\nRun Code Online (Sandbox Code Playgroud)\n我在resolver: ghc-9.0.1.
从文档中:
\n\n\n函数 f 是线性的,如果:当其结果仅被消耗一次时,\n则其参数仅被消耗一次。直观上,这意味着在 f 定义的每个分支中,其参数 x 必须仅使用一次。可以通过以下方式完成
\n\n
\n- 返回未修改的 x
\n- 将 x 传递给线性函数
\n- 对 x 进行模式匹配并以相同的方式仅使用每个参数一次。
\n- 将其作为函数调用并以相同的方式仅使用一次结果。
\n
我的函数sendToPeer …
我已经写了代码:
int x = 18;
x *= 0.90;
System.out.println(x);
Run Code Online (Sandbox Code Playgroud)
这段代码打印出来16
然而,当我写下
int x = 18;
x = x * 0.90;
System.out.println(x);
Run Code Online (Sandbox Code Playgroud)
它给了我以下错误:incompatible types: possible lossy conversion from double to int
我预计这两个代码示例都会导致与 相同的错误x *= y;,x = x * y;但x *= 0.90;不知何故有效,但x = x * 0.90;无效。为什么会这样呢?
考虑:
def my_max(*a):
n = len(a)
max_v = a[0]
for i in range (1,n):
if a[i] > max_v:
max_v = a[i]
return max_v
def my_min(*a):
n = len(a)
min_v = a[0]
for i in range (1,n):
if a[i] < min_v:
min_v = a[i]
return min_v
test = [7, 4, 2, 6, 8]
assert max(test) == my_max(test) and min(test) == my_min(test)
assert max(7, 4, 2, 5) == my_max(7, 4, 2, 5) and min(7, 4, 2, 5)
== my_min(7, 4, 2, 5) …Run Code Online (Sandbox Code Playgroud) 我正在尝试连接到https://apis.digital.gob.cl/fl/feriados/2020requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',)) ,但在与其他 URL 完美配合的脚本上出现错误。
代码:
import requests
response = requests.get('https://apis.digital.gob.cl/fl/feriados/2020')
print(response.status_code)
Run Code Online (Sandbox Code Playgroud) 我使用的是 MacOS 10.15.7 Catalina,目前使用的是 Python 3.8.4 和 Pip 21.1.1
\n无论出于何种原因,当我尝试运行时,我不断收到错误python -m pip install xmlsec
文本形式错误:
\n\xe2\x9e\x9c python -m pip install xmlsec \nCollecting xmlsec\n Using cached xmlsec-1.3.10.tar.gz (62 kB)\n Installing build dependencies ... done\n Getting requirements to build wheel ... done\n Installing backend dependencies ... done\n Preparing wheel metadata ... done\nRequirement already satisfied: lxml>=3.8 in /Users/rsheikh/.pyenv/versions/3.8.4/lib/python3.8/site-packages (from xmlsec) (4.6.3)\nBuilding wheels for collected packages: xmlsec\n Building wheel for xmlsec (PEP 517) ... error\n ERROR: Command errored out with …Run Code Online (Sandbox Code Playgroud) 我已经制作了这个 React 应用程序,但我不断收到此错误:
未捕获的错误:createRoot(...):目标容器不是 DOM 元素。
有人能帮助我吗?这是我的index.html 和index.js。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";
import reportWebVitals from "./reportWebVitals";
ReactDOM.createRoot(
<React.StrictMode> …Run Code Online (Sandbox Code Playgroud) #include <type_traits>
template<typename T>
struct IsComplete final
: std::bool_constant<requires{sizeof(T);}>
{};
int main()
{
struct A;
static_assert(!IsComplete<A>::value); // ok
struct A{};
static_assert(IsComplete<A>::value); // error
}
Run Code Online (Sandbox Code Playgroud)
我预计第二个static_assert应该是真的,因为 A 现在是一个完整的类型。
为什么 C++20 的要求表达式的行为不符合预期?
我尝试在 Disney+ 网络应用程序上截取电影的屏幕截图,但发现当我尝试使用截图工具截取新屏幕截图时,视频会变黑。当我尝试对 OBS 和 Discord 流执行相同的操作时,我看到了相同的效果。
有趣的是,这只适用于我机器上的 Chrome(我也尝试过 Firefox 和 Edge,它们只是让我录制屏幕)。
当我看到这个时,我很好奇他们是如何实现这一目标的。有谁知道如何为我自己的网络项目重新创建它?
python ×4
javascript ×2
python-3.x ×2
aar ×1
android ×1
androidx ×1
api ×1
c++ ×1
c++20 ×1
discord ×1
discord.py ×1
double ×1
haskell ×1
homebrew ×1
integer ×1
java ×1
kotlin ×1
linear-types ×1
macos ×1
pip ×1
reactjs ×1
response ×1
screenshot ×1
sfinae ×1
templates ×1
type-traits ×1
xmlsec1 ×1