RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-340817

DiHASTRO's questions

Martin Hope
DiHASTRO
Asked: 2022-07-18 02:15:05 +0000 UTC

构建Linux内核时的符号信息

  • 0

收到了关于如何在有和没有符号信息的情况下编译 Linux 内核的作业。然后找出符号信息本身的数量。

但是,无论我在互联网上翻了多少遍,我都没有找到至少一些关于这个的有意义的信息(而且在英语中我不知道同样的“象征性信息”被称为什么)。

您能推荐任何有关此的文章或信息吗?(当然,在大多数情况下,我对如何打开/关闭符号信息、了解它的音量以及这个符号信息一般是什么感兴趣;但是,我将非常感谢任何信息)


先感谢您!

linux
  • 1 个回答
  • 10 Views
Martin Hope
DiHASTRO
Asked: 2022-06-16 00:43:45 +0000 UTC

C++ 在结构本身声明之后立即创建结构的实例。是否有必要?

  • 0

朋友们!我正在学习 C++,最近遇到了这个问题:

有这个代码:

#include <iostream>

struct Point {
    Point(int xin, int yin) { x = xin; y = yin; }
    int x;
    int y;
} s(3, 4);

int main() {
    std::cout << s.x << std::endl;
}

因此,正如我们所看到的,这里是在结构本身声明之后立即声明结构实例。问题是:为什么要这样做?我应该使用这个还是单独写更好

Point s(3, 4);

在同一个全局范围内?

就可读编程而言,这样做很好吗?


先感谢您!

c++
  • 1 个回答
  • 10 Views
Martin Hope
DiHASTRO
Asked: 2022-05-13 00:13:44 +0000 UTC

C++ 转换函数和重载的索引接受器冲突

  • 2

再会!

有这样一个问题:需要创建一个String支持获取索引(返回char)并且可以隐式转换为 type的自写类char*。

当一切都井井有条并且我尝试获取索引时,问题就出现了。它给出以下消息(编译器错误):

существует несколько операторов "[]", соответствующих этим операндам:
    встроенный оператор "pointer-to-object[integer]"
    функцию "String::operator[](size_t index) const"

    типы операндов: String [ int ]

据我了解,他看到了两种尝试获取索引下元素的方法:

  1. 隐式转换String到char*它已经在某个索引下获取一个元素

  2. 使用重载运算符

请告诉我,如何使它在获取索引时明确使用特别重载的索引operator[]

这是类代码(不完整,因为类很大,但我向你保证,问题出在这些行中):

字符串.h:

#ifndef CLASS_STRING
#define CLASS_STRING


class String {
public:
    String(const char* str);
    char& operator[](size_t index) const;
    operator char* () const;
private:
    size_t size_;
    size_t capacity_;
    char* pointer_;
};

#endif

字符串.cpp:

#include "String.h"
#include <iostream>

String::String(const char* str)
{
    size_ = 0;
    while (str[size_] != '\0') {
        ++size_;
    }
    capacity_ = size_ + 1;
    pointer_ = new char[capacity_];
    
    for (unsigned int i = 0; i < capacity_; ++i) {
        pointer_[i] = str[i];
    }
}

char& String::operator[](size_t index) const
{
    if (index >= size_) {
        throw std::out_of_range("IndexError: String index out of range");
    }
    return pointer_[index];
}

String::operator char* () const
{
    return pointer_;
}

主.cpp:

#include <iostream>
#include "String.h"

int main() {
    String name = "123";
    std::cout << name[0] << std::endl;
}

先感谢您


PS 上的屏幕截图主要 Pets.cpp 文件是旧项目的回声

有错误的屏幕截图 - 主文件 有错误的屏幕截图 - 头文件

c++
  • 1 个回答
  • 10 Views
Martin Hope
DiHASTRO
Asked: 2020-07-22 19:18:33 +0000 UTC

kivy 没有时间启动就崩溃了。在电脑上

  • 0

你好!有这样的问题。我注意到我的 kivy 应用程序只是在没有时间启动的情况下崩溃。我决定编写一个简单的代码,检查它是否可以工作,但它也不起作用,kivy 应用程序只是崩溃了。

编码:

from kivy.app import App
from kivy.uix.button import Button

class MainApp(App):
    def build(self):
        return Button(text="hhh")

MainApp().run()

基维粉碎(

PS 是的,起初我在命令行上很愚蠢,但后来我修复了它,如您所见,它仍然无法正常工作(

先感谢您!


  • Windows 10 企业版;
  • Python 3.6.3
  • 基维 1.11.1

一切顺利,海狸!

python-3.x
  • 1 个回答
  • 10 Views
Martin Hope
DiHASTRO
Asked: 2020-07-11 17:27:29 +0000 UTC

在 django 中自定义注册表单

  • 0

需要在 django 中自由更改登录名和密码输入字段。偶然发现一个问题:django 中的登录输入被描述为{{form.username}},然后由 django 自己转换成 html 标签<input>。由于这会转换 django 本身,因此无法直接更改它。添加类以转换为 css 也失败。

问题:如何自由定制{{form.username}}?(如果自定义很重要,那么我需要在输入字段中添加灰色 - 提示 - 文本,如图所示)

提前致谢!

帮助文本

django 版本:2.2.2

蟒蛇版本:3.6.3

python
  • 2 个回答
  • 10 Views
Martin Hope
DiHASTRO
Asked: 2020-05-03 14:25:22 +0000 UTC

启动 django 服务器时出错

  • 0

今天刚开始学习django,报错。

在 settings.py 文件中:

INSTALLED_APPS = [
    'webexample',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]

在 urls.py 文件中:

from django.contrib import admin
from django.urls import include, path
urlpatterns = [
    path('admin/', admin.site.urls),
    path('webexample/', include('webexample.urls'))
]

webexample 应用程序已创建。

启动服务器时:

python manage.py runserver

给出错误消息:

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\threading.py", line 916, in _bootstrap_inner
    self.run()
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\commands\runserver.py", line 117, in inner_run
    self.check(display_num_errors=True)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\base.py", line 390, in check
    include_deployment_checks=include_deployment_checks,
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\base.py", line 377, in _run_checks
    return checks.run_checks(**kwargs)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\checks\registry.py", line 72, in run_checks
    new_errors = check(app_configs=app_configs)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\checks\urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver
    return check_method()
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\urls\resolvers.py", line 398, in check
    for pattern in self.url_patterns:
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\functional.py", line 80, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\urls\resolvers.py", line 579, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\functional.py", line 80, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\urls\resolvers.py", line 572, in urlconf_module
    return import_module(self.urlconf_name)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "D:\разработка\Сайты\Сайт_1\site_1\site_1\urls.py", line 20, in <module>
    path('webexample/', include('webexample.urls'))
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\urls\conf.py", line 34, in include
    urlconf_module = import_module(urlconf_module)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'webexample.urls'

Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\commands\runserver.py", line 60, in execute
    super().execute(*args, **options)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\commands\runserver.py", line 95, in handle
    self.run(**options)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\commands\runserver.py", line 102, in run
    autoreload.run_with_reloader(self.inner_run, **options)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\autoreload.py", line 585, in run_with_reloader
    start_django(reloader, main_func, *args, **kwargs)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\autoreload.py", line 570, in start_django
    reloader.run(django_main_thread)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\autoreload.py", line 288, in run
    self.run_loop()
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\autoreload.py", line 294, in run_loop
    next(ticker)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\autoreload.py", line 334, in tick
    for filepath, mtime in self.snapshot_files():
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\autoreload.py", line 350, in snapshot_files
    for file in self.watched_files():
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\autoreload.py", line 249, in watched_files
    yield from iter_all_python_module_files()
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\autoreload.py", line 103, in iter_all_python_module_files
    return iter_modules_and_files(modules, frozenset(_error_files))
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\autoreload.py", line 136, in iter_modules_and_files
    if not path.exists():
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\pathlib.py", line 1314, in exists
    self.stat()
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\pathlib.py", line 1136, in stat
    return self._accessor.stat(self)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\pathlib.py", line 387, in wrapped
    return strfunc(str(pathobj), *args)
OSError: [WinError 123] Синтаксическая ошибка в имени файла, имени папки или метке тома: '<frozen importlib._bootstrap>'

该怎么办?


蟒蛇版本:3.6.3

django 版本:2.2.2

提前致谢!

python
  • 1 个回答
  • 10 Views
Martin Hope
DiHASTRO
Asked: 2020-02-08 22:05:44 +0000 UTC

不编译为 .apk python kivy linux

  • 0

.apk 中的代码无法通过 buildozer 与 linux ubuntu x64 一起编译

输出:

build
running build
running build_ext
Traceback (most recent call last):
File "/home/soulhunter/Документы/Coder/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/python3-libffi-openssl-sqlite3/armeabi-v7a__ndk_target_21/python3/setup.py", line 2364, in <module>
main()
File "/home/soulhunter/Документы/Coder/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/python3-libffi-openssl-sqlite3/armeabi-v7a__ndk_target_21/python3/setup.py", line 2359, in main
"Tools/scripts/2to3", "Tools/scripts/pyvenv"]
File "/home/soulhunter/Документы/Coder/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/python3-libffi-openssl-sqlite3/armeabi-v7a__ndk_target_21/python3/Lib/distutils/core.py", line 148, in setup
dist.run_commands()
File "/home/soulhunter/Документы/Coder/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/python3-libffi-openssl-sqlite3/armeabi-v7a__ndk_target_21/python3/Lib/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/home/soulhunter/Документы/Coder/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/python3-libffi-openssl-sqlite3/armeabi-v7a__ndk_target_21/python3/Lib/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/soulhunter/Документы/Coder/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/python3-libffi-openssl-sqlite3/armeabi-v7a__ndk_target_21/python3/Lib/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/home/soulhunter/Документы/Coder/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/python3-libffi-openssl-sqlite3/armeabi-v7a__ndk_target_21/python3/Lib/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/home/soulhunter/Документы/Coder/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/python3-libffi-openssl-sqlite3/armeabi-v7a__ndk_target_21/python3/Lib/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/soulhunter/Документы/Coder/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/python3-libffi-openssl-sqlite3/armeabi-v7a__ndk_target_21/python3/Lib/distutils/command/build_ext.py", line 339, in run
self.build_extensions()
File "/home/soulhunter/Документы/Coder/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/python3-libffi-openssl-sqlite3/armeabi-v7a__ndk_target_21/python3/setup.py", line 228, in build_extensions
missing = self.detect_modules()
File "/home/soulhunter/Документы/Coder/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/python3-libffi-openssl-sqlite3/armeabi-v7a__ndk_target_21/python3/setup.py", line 1562, in detect_modules
self.detect_ctypes(inc_dirs, lib_dirs)
File "/home/soulhunter/Документы/Coder/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/python3-libffi-openssl-sqlite3/armeabi-v7a__ndk_target_21/python3/setup.py", line 1992, in detect_ctypes
print('Header file {} does not exist'.format(ffi_h))
UnicodeEncodeError: 'utf-8' codec can't encode character '\udcd0' in position 30: surrogates not allowed
Makefile:618: recipe for target 'sharedmods' failed
make: *** [sharedmods] Error 1

STDERR:

# Command failed: /usr/bin/python3 -m pythonforandroid.toolchain create —dist_name=myapp —bootstrap=sdl2 —requirements=python3,kivy —arch armeabi-v7a —copy-libs —color=always —storage-dir="/home/soulhunter/Документы/Coder/.buildozer/android/platform/build-armeabi-v7a" —ndk-api=21
# ENVIRONMENT:
# CLUTTER_IM_MODULE = 'xim'
# LS_COLORS =
Custom Domain by Bitly
bitly.com

'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:'
# LC_MEASUREMENT = 'kk_KZ.UTF-8'
# LESSCLOSE = '/usr/bin/lesspipe %s %s'
# LC_PAPER = 'kk_KZ.UTF-8'
# LC_MONETARY = 'kk_KZ.UTF-8'
# XDG_MENU_PREFIX = 'gnome-'
# LANG = 'ru_RU.UTF-8'
# MANAGERPID = '784'
# DISPLAY = ':0'
# INVOCATION_ID = 'f904150187854263bf5f4ea3faa6591a'
# GNOME_SHELL_SESSION_MODE = 'ubuntu'
# COLORTERM = 'truecolor'
# USERNAME = 'soulhunter'
# XDG_VTNR = '1'
# SSH_AUTH_SOCK = '/run/user/1000/keyring/ssh'
# LC_NAME = 'kk_KZ.UTF-8'
# XDG_SESSION_ID = '1'
# USER = 'soulhunter'
# DESKTOP_SESSION = 'ubuntu'
# QT4_IM_MODULE = 'xim'
# TEXTDOMAINDIR = '/usr/share/locale/'
# GNOME_TERMINAL_SCREEN = '/org/gnome/Terminal/screen/4feb41c9_f538_4cbf_a04c_451a134b62b2'
# PWD = '/home/soulhunter/Документы/Coder'
# HOME = '/home/soulhunter'
# JOURNAL_STREAM = '9:19138'
# TEXTDOMAIN = 'im-config'
# SSH_AGENT_PID = '1002'
# QT_ACCESSIBILITY = '1'
# XDG_SESSION_TYPE = 'x11'
# XDG_DATA_DIRS = '/usr/share/ubuntu:/usr/local/share:/usr/share:/var/lib/snapd/desktop'
# XDG_SESSION_DESKTOP = 'ubuntu'
# LC_ADDRESS = 'kk_KZ.UTF-8'
# DBUS_STARTER_ADDRESS = 'unix:path=/run/user/1000/bus,guid=8162507702b8ce20e38a127a5e3ea93c'
# LC_NUMERIC = 'kk_KZ.UTF-8'
# GTK_MODULES = 'gail:atk-bridge'
# WINDOWPATH = '1'
# TERM = 'xterm-256color'
# VTE_VERSION = '5202'
# SHELL = '/bin/bash'
# QT_IM_MODULE = 'xim'
# XMODIFIERS = '@im=ibus'
# IM_CONFIG_PHASE = '2'
# DBUS_STARTER_BUS_TYPE = 'session'
# XDG_CURRENT_DESKTOP = 'ubuntu:GNOME'
# GPG_AGENT_INFO = '/run/user/1000/gnupg/S.gpg-agent:0:1'
# GNOME_TERMINAL_SERVICE = ':1.84'
# SHLVL = '1'
# XDG_SEAT = 'seat0'
# LC_TELEPHONE = 'kk_KZ.UTF-8'
# GDMSESSION = 'ubuntu'
# GNOME_DESKTOP_SESSION_ID = 'this-is-deprecated'
# LOGNAME = 'soulhunter'
# DBUS_SESSION_BUS_ADDRESS = 'unix:path=/run/user/1000/bus,guid=8162507702b8ce20e38a127a5e3ea93c'
# XDG_RUNTIME_DIR = '/run/user/1000'
# XAUTHORITY = '/run/user/1000/gdm/Xauthority'
# XDG_CONFIG_DIRS = '/etc/xdg/xdg-ubuntu:/etc/xdg'
# PATH = '/home/soulhunter/.buildozer/android/platform/apache-ant-1.9.4/bin:/home/soulhunter/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin'
# LC_IDENTIFICATION = 'kk_KZ.UTF-8'
# SESSION_MANAGER = 'local/soulhunter-VirtualBox:@/tmp/.ICE-unix/906,unix/soulhunter-VirtualBox:/tmp/.ICE-unix/906'
# LESSOPEN = '| /usr/bin/lesspipe %s'
# GTK_IM_MODULE = 'ibus'
# LC_TIME = 'kk_KZ.UTF-8'
# _ = '/home/soulhunter/.local/bin/buildozer'
# PACKAGES_PATH = '/home/soulhunter/.buildozer/android/packages'
# ANDROIDSDK = '/home/soulhunter/.buildozer/android/platform/android-sdk'
# ANDROIDNDK =

'/home/soulhunter/.buildozer/android/platform/android-ndk-r19b'
# ANDROIDAPI = '27'
# ANDROIDMINAPI = '21'
#
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2

抱歉写了这么多信,只是我在 Linux 中不像是茶壶,而是烧焦的茶炊。

先感谢您。

python-3.x
  • 1 个回答
  • 10 Views
Martin Hope
DiHASTRO
Asked: 2020-10-27 02:52:22 +0000 UTC

基维。Linux Ubuntu。蟒蛇 3

  • 0

Linux(虚拟机)上有一段用python写的代码:

#!/usr/bin/python

from kivy.app import App
from kivy.uix.button import Button

class MyApp(App):
    def build(self):
        return Button

if __name__ == '__main__':
    MyApp().run()

结果,错误:

Traceback (most recent call last):
File "testfile.py", line 11, in <module>
MyApp().run()
File "/usr/lib/python3/dist-packages/kivy/app.py", line 835, in run
raise Exception('Invalid instance in App.root')
Exception: Invalid instance in App.root

我在哪里犯了罪,我该如何征服这只企鹅?

提前致谢。

python-3.x
  • 1 个回答
  • 10 Views
Martin Hope
DiHASTRO
Asked: 2020-09-23 23:27:56 +0000 UTC

从 webdriver 类型的变量中获取 HTML 代码。硒

  • 0

我有代码:

from selenium import webdriver

driver = webdriver.Chrome()

driver.get("https://ru.wikipedia.org/wiki/%D0%97%D0%B0%D0%B3%D0%BB%D0%B0%D0%B2%D0%BD%D0%B0%D1%8F_%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0")
search_filed = driver.find_element_by_id("searchInput")
search_filed.send_keys("Круг")

search_button = driver.find_element_by_id("searchButton")
search_button.click()

如何从驱动程序变量中获取 html 代码?翻遍了一半的互联网- 没有找到。

先感谢您。

html
  • 1 个回答
  • 10 Views
Martin Hope
DiHASTRO
Asked: 2020-08-20 02:13:17 +0000 UTC

C++。一切都有问题。视觉工作室代码

  • 0

我刚开始用 C++ 编程,最后我什么都不懂。我尝试在 Visual Studio Code 上同时安装 C++ 和代码运行程序,结果我编写了一个简单的程序:

输入:

#include <iostream>

using namespace std;

int main()
{
    cout << "Hello world bitsdsdsches!";
    return 0;
}

输出:

[Running] cd "c:\Users\User\Desktop\разработка\C++\Коды\" && g++ beginning.cpp -o beginning && "c:\Users\User\Desktop\разработка\C++\Коды\"beginning
"g++" �� ���� ����७��� ��� ���譥�
��������, �ᯮ��塞�� �ணࠬ��� ��� ������ 䠩���.

[Done] exited with code=1 in 0.046 seconds

无论我在 cout 中写什么,一切都是一样的,只是程序执行时间发生了变化。该怎么办?

提前致谢。

c++
  • 2 个回答
  • 10 Views
Martin Hope
DiHASTRO
Asked: 2020-08-19 16:29:43 +0000 UTC

Python 3. VLC 模块问题

  • 0

我正在尝试导入 vlc 模块,结果出现错误:

输入:

>>> import vlc

输出:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\vlc.py", line 207, in <module>
    dll, plugin_path  = find_lib()
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\vlc.py", line 167, in find_lib
    dll = ctypes.CDLL(libname)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\ctypes\__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] Не найден указанный модуль

我必须马上说:vlc 已安装,我查看了库。我无法确切地弄清楚我的风筝找不到哪个模块或到底出了什么问题。该怎么办?

提前致谢

python
  • 1 个回答
  • 10 Views
Martin Hope
DiHASTRO
Asked: 2020-08-06 02:54:21 +0000 UTC

脚本在后台。蟒蛇 3

  • 0

需要在后台运行脚本。我无法在互联网上找到我需要的确切内容。有一个代码:

power = str(2**10000000)
file = open('calculated.txt','w')
file.write(power)
file.close()

(无需问为什么:D)如果我只是运行脚本并切换到另一个窗口(而不是控制台),那么脚本将暂停其执行(即计算)并仅在我切换到控制台时启动又是窗口。我需要它在后台运行。希望控制台窗口甚至不出现,而是消失,但我认为这可以在编译期间解决。

提前感谢您的回复

python-3.x
  • 2 个回答
  • 10 Views
Martin Hope
DiHASTRO
Asked: 2020-07-22 23:29:53 +0000 UTC

蛇没有苹果。游戏。蟒蛇 3

  • 1

您好,代码如下:

import pygame
import random

win = pygame.display.set_mode((500, 500))

pygame.display.set_caption('Змейка')

clock = pygame.time.Clock()

x = 250
y = 250

appleWidth = 10
appleHeight = 10

width = 7
height = 7
speed = 7

direction = "right"

parts = []
apple = {}
snake = ''
isApple = False

def drawWindow():
    part = []
    win.fill((0, 0, 0))
    snake = pygame.draw.rect(win, (255, 0, 0), (x, y, width, height))
    part.append(snake)
    part.append(x)
    part.append(y)
    parts.append(part)
    pygame.display.update()

def move():
    global x, y

    if direction == 'right':
        x += speed
    elif direction == 'left':
        x -= speed
    elif direction == 'up':
        y -= speed
    elif direction == 'down':
        y += speed

    if x < 0:
        x = 500
    elif x > 500:
        x = 0
    if y < 0:
        y = 500
    elif y > 500:
        y = 0

def create_apple():
    global isApple 
    global apple

    xApple = random.randint(0, 500)
    yApple = random.randint(0, 500)
    for part in parts:
        if parts[part][1] == x and parts[part][2] == y:
            create_apple()
            break

    pygame.draw.rect(win, (0, 255, 0), (xApple, yApple, appleWidth, appleHeight))
    isApple = True
    apple['x'] = x
    apple['y'] = y

run = True
while run:
    pygame.time.delay(30)
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            run = False

    if isApple == False:
        create_apple()

    keys = pygame.key.get_pressed()

    move()

    if direction == 'right' or direction == 'left':
        if keys[pygame.K_w]:
            direction = "up"
        elif keys[pygame.K_s]:
            direction = "down"
    else:
        if keys[pygame.K_a]:
            direction = "left"
        elif keys[pygame.K_d]:
            direction = "right"


    drawWindow()

底线是:这些是我创造一条蛇的尝试。我正在尝试通过 create_apple() 函数创建一个蛇苹果。我运行代码,但苹果没有出现。可能是什么问题呢?如何解决?

python-3.x
  • 1 个回答
  • 10 Views
Martin Hope
DiHASTRO
Asked: 2020-07-19 23:11:47 +0000 UTC

元组索引超出范围但我没有创建元组

  • 0

有一个代码:

class Rubik:
    def __init__(self,Red=['r','r','r','r','r','r','r','r','r'],Blue=['b','b','b','b','b','b','b','b','b'],
                 Orange=['o','o','o','o','o','o','o','o','o'],Green=['g','g','g','g','g','g','g','g','g'],
                 White=['w','w','w','w','w','w','w','w','w'],Yellow=['y','y','y','y','y','y','y','y','y']):
        self.red = Red
        self.blue = Blue
        self.orange = Orange
        self.green = Green
        self.white = White
        self.yellow = Yellow

    def show_red(self):
        total = f"""{self.red[0]} {self.red[1]} {self.red[2]}\n
                   {self.red[3]} {self.red[4]} {self.red[5]}\n
                   {self.red[6]} {self.red[7]} {self.red[8]}"""
        return total

    def show_blue(self):
        total =  f"""{self.blue[0]} {self.blue[1]} {self.blue[2]}\n
                   {self.blue[3]} {self.blue[4]} {self.blue[5]}\n
                   {self.blue[6]} {self.blue[7]} {self.blue[8]}"""
        return total

    def show_orange(self):
        total = f"""{self.orange[0]} {self.orange[1]} {self.orange[2]}\n
                   {self.orange[3]} {self.orange[4]} {self.orange[5]}\n
                   {self.orange[6]} {self.orange[7]} {self.orange[8]}"""
        return total

    def show_green(self):
        total =  f"""{self.green[0]} {self.green[1]} {self.green[2]}\n
                     {self.green[3]} {self.green[4]} {self.green[5]}\n
                     {self.green[6]} {self.green[7]} {self.green[8]}"""
        return total

    def show_white(self):
        total =  f"""{self.white[0]} {self.white[1]} {self.white[2]}\n
                     {self.white[3]} {self.white[4]} {self.white[5]}\n
                     {self.white[6]} {self.white[7]} {self.white[8]}"""
        return total

    def show_yellow(self):
        total =  f"""{self.yellow[0]} {self.yellow[1]} {self.yellow[2]}\n
                     {self.yellow[3]} {self.yellow[4]} {self.yellow[5]}\n
                     {self.yellow[6]} {self.yellow[7]} {self.yellow[8]}"""
        return total

    def __str__(self):
        total = f"""
                {self.white[0]} {self.white[1]} {self.white[2]}
                {self.white[3]} {self.white[4]} {self.white[5]}
                {self.white[6]} {self.white[7]} {self.white[8]}\n
{self.red[0]} {self.red[1]} {self.red[2]}   {self.blue[0]} {self.blue[1]} {self.blue[2]}   \
{self.orange[0]} {self.orange[1]} {self.orange[2]}   {self.green[0]} {self.green[1]} {self.green[2]}
{self.red[3]} {self.red[4]} {self.red[5]}   {self.blue[3]} {self.blue[4]} {self.blue[5]}   \
{self.orange[3]} {self.orange[4]} {self.orange[5]}   {self.green[3]} {self.green[4]} {self.green[5]}
{self.red[6]} {self.red[7]} {self.red[8]}   {self.blue[6]} {self.blue[7]} {self.blue[8]}   \
{self.orange[6]} {self.orange[7]} {self.orange[8]}   {self.green[6]} {self.green[7]} {self.green[8]}\n
                {self.yellow[0]} {self.yellow[1]} {self.yellow[2]}
                {self.yellow[3]} {self.yellow[4]} {self.yellow[5]}
                {self.yellow[6]} {self.yellow[7]} {self.yellow[8]}"""
        return total

    def U(self, move=None):
        memory = [x for x in range(9)]
        red_list=['r','r','r','r','r','r','r','r','r']
        blue_list=['b','b','b','b','b','b','b','b','b']
        orange_list=['o','o','o','o','o','o','o','o','o']
        green_list=['g','g','g','g','g','g','g','g','g'],
        white_list=['w','w','w','w','w','w','w','w','w']
        yellow_list=['y','y','y','y','y','y','y','y','y']
        if move == None:
            memory[2] = 'w'
            memory[5] = 'w'
            memory[8] = 'w'

            white_list[2] = orange_list[2]
            white_list[5] = orange_list[5]
            white_list[8] = orange_list[8]

            orange_list[2] = yellow_list[2]
            orange_list[5] = yellow_list[5]
            orange_list[8] = yellow_list[8]

            yellow_list[2] = red_list[2]
            yellow_list[5] = red_list[5]
            yellow_list[8] = red_list[8]

            red_list[2] = memory[2]
            red_list[5] = memory[5]
            red_list[8] = memory[8]

        total = Rubik(red_list, blue_list, orange_list, green_list, white_list, yellow_list)
        return total


#==================================================================================================================================================
x = Rubik()
print(x.U())

出现异常:

IndexError
tuple index out of range
  File "C:\Users\User\Desktop\разработка\Проекты\проект rubiks_cube\rubiks_cube.py", line 57, in __str__
    {self.yellow[6]} {self.yellow[7]} {self.yellow[8]}"""
  File "C:\Users\User\Desktop\разработка\Проекты\проект rubiks_cube\rubiks_cube.py", line 95, in <module>
    print(x.U())

与元组相关的错误,虽然我没有创建元组......至少是故意的。值得注意的是,没有 U() 函数一切正常。请解释错误是什么以及如何解决。

或者,也许我错误地编写了init函数并且错误地输入了列表?

先感谢您。

Ps 试图“玩弄” str函数,或者更确切地说是总变量。出现线条时发生错误

{self.orange[0]} {self.orange[1]} {self.orange[2]}   {self.green[0]} {self.green[1]} {self.green[2]}
python
  • 1 个回答
  • 10 Views
Martin Hope
DiHASTRO
Asked: 2020-07-11 21:08:20 +0000 UTC

在 Python 3 函数中不使用所有参数

  • 2

可用代码:

class Fractional:
    #create fractional
    def __init__(self, integer, numerator, denominator):
        if integer == None:
            self.integer = 0
        else:
            self.integer = integer

        if numerator == None:
            self.numerator = 0
        elif numerator < 0 and integer != 0:
            raise TypeError('Numerator must be more than 0') 
        else:
            self.numerator = numerator

        if denominator == None and numerator != None:
            raise TypeError('You must enter denominator')
        elif denominator == None and numerator == None:
            return integer
        elif denominator <= 0:
            raise TypeError('Denominator must be more than 0')
        else:
            self.denominator = denominator

最初,我认为没有传递给函数的参数会得到值 None,因此,我这样做了 if / elif / else。但最后,如果我只传递一个参数(它是整数)(例如Fractional(2):),那么代码会像这样发誓:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __init__() missing 2 required positional arguments: 'numerator' and 'denominator'

据我了解,您不能像那样摆脱 None 。我试着用同样的方式写作is,但显然,这是来自另一个草原,也没有帮助我。告诉我如何解决这个问题,这样你就可以在函数中只输入一个参数而忽略另外两个。

提前致谢。

python
  • 2 个回答
  • 10 Views
Martin Hope
DiHASTRO
Asked: 2020-06-22 00:16:57 +0000 UTC

tkinter python 3 中与绑定和函数自调用相关的错误

  • 0

底线:我将 python 3 与 tkinter 一起使用。有一个函数通过after(). 第一次调用后,它被中断并发生错误(我通过s键盘和方法调用bind)。这是代码的有问题的片段(如果我忘记了什么,我将尝试推送此处使用的所有导入并推送其他命令 - 不要怪我):

form tkinter import *

def stopwatch(event):
    global test, after_id, milisec, sec, min, hour, x, y, z

    if sec > 59:
        sec = 0
        min += 1

    if min>59:
        min = 0
        hour += 1

    if hour>23:
        sec = 0
        min = 0
        hour = 0

    if sec < 10:
        x = '0'+str(sec)
    else:
        x = str(sec)

    if min < 10:
        y = '0'+str(min)
    else:
        y = str(min)

    if hour < 10:
        z = '0'+str(hour)
    else:
        z = str(hour)

    after_id = window.after(1000, stopwatch)
    label1.configure(text=str(z+':'+y+':'+x))

window = Tk()

window.bind("<s>",stopwatch)

label1 = Label(window, text='')
label1.config(font=('Ubuntu',20)
label1.grid()

window.mainloop()

这是错误:

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\tkinter\__init__.py", line 1699, in __call__
    return self.func(*args)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\tkinter\__init__.py", line 745, in callit
    func(*args)
TypeError: stopwatch() missing 1 required positional argument: 'event'


 Что делать?
python
  • 1 个回答
  • 10 Views
Martin Hope
DiHASTRO
Asked: 2020-06-10 13:14:42 +0000 UTC

俄语文件名和 playsound 模块

  • 0

我对python比较陌生。我需要打开一个文件,但有些文件的名称是俄语,类似于

playsound('C:/Users/User/Documents/Audacity/Секретный звук.wav') 

在这里它给了我一个错误

File "C:\Users\User\Desktop\Неизвестный.py", line 9, in <module>
playsound('C:/Users/User/Documents/Audacity/Секретный звук.wav')
File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\playsound.py", line 35, in _playsoundWin
winCommand('open "' + sound + '" alias', alias)
File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\playsound.py", line 30, in winCommand
'\n    ' + errorBuffer.value.decode())
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc4 in position 0: invalid continuation byte

我知道您可以将此音频与代码一起放入同一个文件夹并将其重命名为英语和数字,但仍然如何在文件路径中使用俄语中的 python 中的文件本身的名称?提前致谢。

python
  • 2 个回答
  • 10 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5