Вопросы по Python
-
- Уже с Приветом
- Posts: 10604
- Joined: 18 Mar 2004 15:11
- Location: New York -> FL
Вопросы по Python
Нужда вынудила учить Python. Суки из Европы кинули нам проект исправлять 17ти летней давности Мы в Питоне никто ни в зуб ногой. Разбираемся..
Вопрос. Есть Windows Service написаный на Python (2.7). Открываем его в VS Code, нажимаю на F5, чтобы запустить в дебаге. Выдает ошибку
Exception has occurred: ImportError
DLL load failed: %1 is not a valid Win32 application.
File "C:\JobDaemon\jobdaemon.py", line 4, in <module>
import win32serviceutil
Питон установили через ActivePython инсталлятор. Он поставил сам Python и другие либы тоже. Кастомер пользуется версией 2.7 поэтому приходится исправлять все в этой версии Питона.
Вопрос. Есть Windows Service написаный на Python (2.7). Открываем его в VS Code, нажимаю на F5, чтобы запустить в дебаге. Выдает ошибку
Exception has occurred: ImportError
DLL load failed: %1 is not a valid Win32 application.
File "C:\JobDaemon\jobdaemon.py", line 4, in <module>
import win32serviceutil
Питон установили через ActivePython инсталлятор. Он поставил сам Python и другие либы тоже. Кастомер пользуется версией 2.7 поэтому приходится исправлять все в этой версии Питона.
-
- Уже с Приветом
- Posts: 8629
- Joined: 05 Aug 2003 21:39
- Location: CA
Re: Вопросы по Python
Такие вещи лучше спросить у ясеня Chat GPT. (и/или у Google Bard)
Copy paste весь стеэк ошибки - и пусть разбирается
Copy paste весь стеэк ошибки - и пусть разбирается
-
- Уже с Приветом
- Posts: 10604
- Joined: 18 Mar 2004 15:11
- Location: New York -> FL
-
- Уже с Приветом
- Posts: 11311
- Joined: 03 Oct 2019 17:06
Re: Вопросы по Python
У меня есть Вордпресс сайты.
Может вы часом знаете где информацию найти как код плагина(plugin) к Вордпрессу (Wordpress) написать?
Сейчас я использую готовые плагины и могу их код посмотреть но хотелось бы знать основы написания кода для плагинов.
Я уже этот вопрос на форуме спрашивала но никто не ответил.
В Гоогле есть инфо об этом но её много и надо бы больше конкретики.
Спасибо.
-
- Уже с Приветом
- Posts: 17361
- Joined: 01 Mar 2008 15:14
Re: Вопросы по Python
спросите у gpt - он часто отвечает неплохо и по теме
-
- Уже с Приветом
- Posts: 11311
- Joined: 03 Oct 2019 17:06
Re: Вопросы по Python
gpt -?
А какой линк чтоб спросить?
Вообще то есть форумы на Wordpress.org or Wordpress.com чтоб спросить вопросы связанные с Wordpress но там не ответят о том как создать свой плагин.
А какой линк чтоб спросить?
Вообще то есть форумы на Wordpress.org or Wordpress.com чтоб спросить вопросы связанные с Wordpress но там не ответят о том как создать свой плагин.
-
- Уже с Приветом
- Posts: 8629
- Joined: 05 Aug 2003 21:39
- Location: CA
Re: Вопросы по Python
https://chat.openai.com
"I am a beginner in coding. Please give me step by step instruction how to write a wordpress plugin"
-
- Уже с Приветом
- Posts: 8629
- Joined: 05 Aug 2003 21:39
- Location: CA
Re: Вопросы по Python
Creating a WordPress plugin involves several steps. Here's a step-by-step guide to help you get started:
Step 1: Set Up Your Development Environment
Before you begin, make sure you have the following set up:
A local development environment (using tools like XAMPP, MAMP, or a local server).
WordPress installed on your local server.
A code editor like Visual Studio Code, Sublime Text, or PhpStorm.
Step 2: Plan Your Plugin
Determine the purpose and functionality of your plugin. What problem does it solve, and what features will it have? Create a plan and outline the main components of your plugin.
Step 3: Create a Plugin Folder
In your WordPress installation directory, navigate to the wp-content/plugins folder. Create a new folder for your plugin, and give it a unique, lowercase name (e.g., my-plugin).
Step 4: Create the Main PHP File
Inside your plugin folder, create a main PHP file. This file should have the same name as your folder with a .php extension (e.g., my-plugin.php). This file will serve as the entry point for your plugin.
Step 5: Write the Plugin Header
In your main PHP file, add a plugin header comment. This comment provides essential information about your plugin and is required for WordPress to recognize it. Here's a basic example:
php
Step 6: Define Plugin Functionality
Write the code that defines your plugin's functionality. This may include adding custom post types, widgets, shortcodes, or hooks into WordPress core functions. You can use WordPress APIs and functions to interact with the database and modify the behavior of your site.
Step 7: Test Your Plugin
Test your plugin thoroughly on your local development environment. Make sure it works as expected and doesn't cause conflicts with other plugins or themes.
Step 8: Add CSS and JavaScript (If Needed)
If your plugin requires custom styles or JavaScript, you can enqueue these files using WordPress functions like wp_enqueue_style and wp_enqueue_script.
Step 9: Create Activation and Deactivation Hooks (Optional)
You can add activation and deactivation hooks to perform specific actions when your plugin is activated or deactivated. For example, you might create custom database tables during activation and remove them during deactivation.
Step 10: Document Your Plugin
Write documentation for your plugin, including usage instructions and any configuration options. Clear documentation makes it easier for others to use your plugin.
Step 11: Prepare for Distribution
If you plan to distribute your plugin publicly, consider the following:
Create a README.txt file with usage instructions and information about your plugin.
Create a WordPress.org account and submit your plugin to the WordPress Plugin Repository if you want to share it with the WordPress community.
Package your plugin into a ZIP file for distribution.
Step 12: Publish and Share
Upload your plugin to your WordPress site or share it with others by distributing the ZIP file. You can also publish it in the WordPress Plugin Repository for broader exposure.
Step 13: Maintain and Update
Regularly update and maintain your plugin to ensure compatibility with new versions of WordPress and address any issues or security vulnerabilities that may arise.
Creating a WordPress plugin can be a rewarding experience, and it allows you to extend the functionality of your WordPress site or share your custom solutions with others. Be sure to refer to the official WordPress Plugin Handbook (https://developer.wordpress.org/plugins/) for detailed documentation and best practices.
Step 1: Set Up Your Development Environment
Before you begin, make sure you have the following set up:
A local development environment (using tools like XAMPP, MAMP, or a local server).
WordPress installed on your local server.
A code editor like Visual Studio Code, Sublime Text, or PhpStorm.
Step 2: Plan Your Plugin
Determine the purpose and functionality of your plugin. What problem does it solve, and what features will it have? Create a plan and outline the main components of your plugin.
Step 3: Create a Plugin Folder
In your WordPress installation directory, navigate to the wp-content/plugins folder. Create a new folder for your plugin, and give it a unique, lowercase name (e.g., my-plugin).
Step 4: Create the Main PHP File
Inside your plugin folder, create a main PHP file. This file should have the same name as your folder with a .php extension (e.g., my-plugin.php). This file will serve as the entry point for your plugin.
Step 5: Write the Plugin Header
In your main PHP file, add a plugin header comment. This comment provides essential information about your plugin and is required for WordPress to recognize it. Here's a basic example:
php
Code: Select all
<?php
/**
* Plugin Name: My WordPress Plugin
* Description: This is a custom WordPress plugin.
* Version: 1.0
* Author: Your Name
*/
Write the code that defines your plugin's functionality. This may include adding custom post types, widgets, shortcodes, or hooks into WordPress core functions. You can use WordPress APIs and functions to interact with the database and modify the behavior of your site.
Step 7: Test Your Plugin
Test your plugin thoroughly on your local development environment. Make sure it works as expected and doesn't cause conflicts with other plugins or themes.
Step 8: Add CSS and JavaScript (If Needed)
If your plugin requires custom styles or JavaScript, you can enqueue these files using WordPress functions like wp_enqueue_style and wp_enqueue_script.
Step 9: Create Activation and Deactivation Hooks (Optional)
You can add activation and deactivation hooks to perform specific actions when your plugin is activated or deactivated. For example, you might create custom database tables during activation and remove them during deactivation.
Step 10: Document Your Plugin
Write documentation for your plugin, including usage instructions and any configuration options. Clear documentation makes it easier for others to use your plugin.
Step 11: Prepare for Distribution
If you plan to distribute your plugin publicly, consider the following:
Create a README.txt file with usage instructions and information about your plugin.
Create a WordPress.org account and submit your plugin to the WordPress Plugin Repository if you want to share it with the WordPress community.
Package your plugin into a ZIP file for distribution.
Step 12: Publish and Share
Upload your plugin to your WordPress site or share it with others by distributing the ZIP file. You can also publish it in the WordPress Plugin Repository for broader exposure.
Step 13: Maintain and Update
Regularly update and maintain your plugin to ensure compatibility with new versions of WordPress and address any issues or security vulnerabilities that may arise.
Creating a WordPress plugin can be a rewarding experience, and it allows you to extend the functionality of your WordPress site or share your custom solutions with others. Be sure to refer to the official WordPress Plugin Handbook (https://developer.wordpress.org/plugins/) for detailed documentation and best practices.
-
- Уже с Приветом
- Posts: 8629
- Joined: 05 Aug 2003 21:39
- Location: CA
Re: Вопросы по Python
Q: create a hello world php code as a plugin
A:
Certainly! Here's a simple "Hello World" plugin written in PHP for WordPress:
Create a new folder in your WordPress plugins directory (usually wp-content/plugins) and name it something like hello-world-plugin.
Inside the hello-world-plugin folder, create a PHP file named hello-world.php.
Add the following code to hello-world.php:
Save the file.
Now, log in to your WordPress admin dashboard.
Go to the "Plugins" section, find the "Hello World Plugin," and click "Activate."
Visit any page on your WordPress site, and you should see "Hello, World!" displayed in the footer.
This is a basic example of a WordPress plugin. It adds a "Hello, World!" message to the footer of your site using the wp_footer action hook.
You can modify this plugin to add more complex functionality or interact with WordPress in different ways depending on your needs.
A:
Certainly! Here's a simple "Hello World" plugin written in PHP for WordPress:
Create a new folder in your WordPress plugins directory (usually wp-content/plugins) and name it something like hello-world-plugin.
Inside the hello-world-plugin folder, create a PHP file named hello-world.php.
Add the following code to hello-world.php:
Code: Select all
<?php
/*
Plugin Name: Hello World Plugin
Description: A simple "Hello World" plugin for WordPress.
Version: 1.0
Author: Your Name
*/
// Hook a function to the 'wp_footer' action
function hello_world() {
echo '<p>Hello, World!</p>';
}
add_action('wp_footer', 'hello_world');
Now, log in to your WordPress admin dashboard.
Go to the "Plugins" section, find the "Hello World Plugin," and click "Activate."
Visit any page on your WordPress site, and you should see "Hello, World!" displayed in the footer.
This is a basic example of a WordPress plugin. It adds a "Hello, World!" message to the footer of your site using the wp_footer action hook.
You can modify this plugin to add more complex functionality or interact with WordPress in different ways depending on your needs.
-
- Уже с Приветом
- Posts: 8629
- Joined: 05 Aug 2003 21:39
- Location: CA
Re: Вопросы по Python
Отсылка к Chat GPT наше время - это типа отсылки "гугл в помощь" в прошлом.
Учитесь пользоваться Chat GPT - он сохраняет дискуссию, позволяет задавать follow up вопросы типа "explain in details item 1 from your list". Или "re-write your example code with emphasis to ..."
Учитесь пользоваться Chat GPT - он сохраняет дискуссию, позволяет задавать follow up вопросы типа "explain in details item 1 from your list". Или "re-write your example code with emphasis to ..."
-
- Уже с Приветом
- Posts: 8629
- Joined: 05 Aug 2003 21:39
- Location: CA
Re: Вопросы по Python
Это развнозначно спрашиванию у ясеня "где моя любимая?"
"Гоогле" - для старперов и/или потребителей проплаченной рекламы
-
- Уже с Приветом
- Posts: 8629
- Joined: 05 Aug 2003 21:39
- Location: CA
Re: Вопросы по Python
ЗЫ У меня платный экаунт (GPT 4), но у меня есть резоны его иметь.
Бесплатный GPT 3.5 - более чем достаточно для большинства вопросов
Бесплатный GPT 3.5 - более чем достаточно для большинства вопросов
-
- Уже с Приветом
- Posts: 8629
- Joined: 05 Aug 2003 21:39
- Location: CA
Re: Вопросы по Python
С ним можно еще и за жизнь поговорить. Но без экстрима, разумеется
-
- Уже с Приветом
- Posts: 11311
- Joined: 03 Oct 2019 17:06
Re: Вопросы по Python
Ну3DD wrote: ↑30 Sep 2023 17:35https://chat.openai.com
"I am a beginner in coding. Please give me step by step instruction how to write a wordpress plugin"
вероятно по аналогии можно спросить почему я не могу backup(ошибки неясные)
одну из даже не из самых больших вебсайтов и как быстро сделать debag?
Крутится на 87% долго и со временем может backup как раньше было.
"Ну раз пошла такая пьянка" ещё вопросы.
Люди просят чтоб я им сделала аналогичные моим вебсайты: хотят купить т.к им нравится что выглядит лучше чем на Facebook.
1.Как патент заиметь чтоб не стырили идею?
Мне неохота updait ихние плагины и/т.д. т.е я бы сделала вебсайты но не хочу постоянно курировать и обновлять их.
2.Можно сделать вебсайт на раз:
с фотками/галлереями чтоб ничего не изменять без всяких плагинов?
3. Можно ли продать идею Facebook если я использую plugins, themes что сзма не создавала?
Спасибо.
-
- Уже с Приветом
- Posts: 10604
- Joined: 18 Mar 2004 15:11
- Location: New York -> FL
Re: Вопросы по Python
более того этот Chat GPT еще и по русски понимает
-
- Уже с Приветом
- Posts: 11311
- Joined: 03 Oct 2019 17:06
Re: Вопросы по Python
С backup нормально.solution wrote: ↑30 Sep 2023 18:55Ну3DD wrote: ↑30 Sep 2023 17:35https://chat.openai.com
"I am a beginner in coding. Please give me step by step instruction how to write a wordpress plugin"
вероятно по аналогии можно спросить почему я не могу backup(ошибки неясные)
одну из даже не из самых больших вебсайтов и как быстро сделать debag?
Крутится на 87% долго и со временем может backup как раньше было.
"Ну раз пошла такая пьянка" ещё вопросы.
Люди просят чтоб я им сделала аналогичные моим вебсайты: хотят купить т.к им нравится что выглядит лучше чем на Facebook.
1.Как патент заиметь чтоб не стырили идею?
Мне неохота updait ихние плагины и/т.д. т.е я бы сделала вебсайты но не хочу постоянно курировать и обновлять их.
2.Можно сделать вебсайт на раз:
с фотками/галлереями чтоб ничего не изменять без всяких плагинов?
3. Можно ли продать идею Facebook если я использую plugins, themes что сзма не создавала?
Спасибо.
Ошибки ушли после как отсоединила и заново присоединила к k GoogleDrive и кое что ещё изменила.
Вероятно плагин галлереи надо самой разработать
на примерах что есть.
-
- Уже с Приветом
- Posts: 11311
- Joined: 03 Oct 2019 17:06
Re: Вопросы по Python
А может вы знаете курсы(онлайн предпочтительно) где учат плагины создавать?
Самой потребуется дольше времени и результат может быть проблематичен.
Я брала курс Вордпресс и по емайлу ещё инструктору вопросы задавала.
Он потом ответил что уже не знает ответов т.к в данном случае ученик учителя перегнал.
И вообще предмет легче изучать если можно обсудить с кем то аспекты которые связаны с этим.
-
- Уже с Приветом
- Posts: 1422
- Joined: 28 Nov 2008 17:50
Re: Вопросы по Python
WP самая популярная CMS на планете, если у вас не получается найти столь базовое инфо по самой популярной CMS, наверно стоит сдаться. программирование не для вас.solution wrote: ↑30 Sep 2023 06:58 Может вы часом знаете где информацию найти как код плагина(plugin) к Вордпрессу (Wordpress) написать?
Сейчас я использую готовые плагины и могу их код посмотреть но хотелось бы знать основы написания кода для плагинов.
Я уже этот вопрос на форуме спрашивала но никто не ответил.
"отсоединила и заново присоединила к k GoogleDrive" - истинно говорю, не для вас.
-
- Уже с Приветом
- Posts: 11311
- Joined: 03 Oct 2019 17:06
Re: Вопросы по Python
Вы читали мой вопрос?iDesperado wrote: ↑01 Oct 2023 21:17WP самая популярная CMS на планете, если у вас не получается найти столь базовое инфо по самой популярной CMS, наверно стоит сдаться. программирование не для вас.solution wrote: ↑30 Sep 2023 06:58 Может вы часом знаете где информацию найти как код плагина(plugin) к Вордпрессу (Wordpress) написать?
Сейчас я использую готовые плагины и могу их код посмотреть но хотелось бы знать основы написания кода для плагинов.
Я уже этот вопрос на форуме спрашивала но никто не ответил.
"отсоединила и заново присоединила к k GoogleDrive" - истинно говорю, не для вас.
Если нет то ещё раз прочитайте и попытайтесь понять.
У меня около 7 действующих Вордпресс сайтов
обычно много пользователей когда новую
страницу создашь т.к я умею делать
Фотки и их компоновать.
Вопрос был о курсах где плагины учат создавать.
Я по русски и коротко попыталась выразить:
To fix error that happened during backup, I followed next steps:
Need to check:
Setting - Google Drive to make sure that Google Drive used
then go to
UpdraftPlus Backup/Restore - Advanced Tools - Wipe Setting
since need to delete the old setting to fix error.
Therefore I've deleted the old setting and created the new ones.
Просветите как по русски и коротко это обозначить если знаете.
-
- Уже с Приветом
- Posts: 163
- Joined: 25 Aug 2004 22:00
- Location: Tampa Bay
Re: Вопросы по Python
а если его спросить про а и б сидели на трубе?
-
- Уже с Приветом
- Posts: 11311
- Joined: 03 Oct 2019 17:06
Re: Вопросы по Python
а и б сидели на трубе
а упало б пропало
кто остался на трубе?
программистом так не стать:
утвержденья выдавать
и вопросы задавать
но решений их не знать.
а упало б пропало
кто остался на трубе?
программистом так не стать:
утвержденья выдавать
и вопросы задавать
но решений их не знать.
-
- Уже с Приветом
- Posts: 1422
- Joined: 28 Nov 2008 17:50
Re: Вопросы по Python
простите, но ваша речь на уровне ребенка 5 лет, которому сложно сконцентрироваться на одной вещи. вопрос про бэкап или где учат плагины делать ? и не важно какой из них, нафига эти вопросы пихать в каждую тему тут, если полно специализированных ресурсов ?
где учат плагины делать ответит гугл
по бэкапу - какой нафиг google drive на сервере ? UpdraftPlus как я понимаю левый плагин, кто доверяет бэкапы левым плагинам ?
судя по вот этому там как и везде надо скопировать пхп скрипты и дамп базы данных. все стандартно и делается баш скриптом в пять строк.
-
- Уже с Приветом
- Posts: 11311
- Joined: 03 Oct 2019 17:06
Re: Вопросы по Python
Как раз взрослый и разумный человек может переключаться с одной темы на другую но для умственно неполноценного человека( Asperger) это большая трудность.iDesperado wrote: ↑02 Oct 2023 08:17простите, но ваша речь на уровне ребенка 5 лет, которому сложно сконцентрироваться на одной вещи. вопрос про бэкап или где учат плагины делать ? и не важно какой из них, нафига эти вопросы пихать в каждую тему тут, если полно специализированных ресурсов ?
где учат плагины делать ответит гугл
по бэкапу - какой нафиг google drive на сервере ? UpdraftPlus как я понимаю левый плагин, кто доверяет бэкапы левым плагинам ?
судя по вот этому там как и везде надо скопировать пхп скрипты и дамп базы данных. все стандартно и делается баш скриптом в пять строк.
Один из
Signs of Asperger's in adults
Difficulty with change.
Ну и много других как то нетерпимость, грубость и т.д и т.п.
В общем у вас классический набор т.к вместо того вникнуть и переспросить если непонятно вы начинаете вешать ярлыки и выдавать ложную информацию.
Как то вы безаляпиционно и неправильно заявляете о плагине updraftplus
"UpdraftPlus is the world’s highest ranking and most popular scheduled backup and migration plugin. Backup to your preferred storage location and restore in just three clicks.
инфо внизу".
https://wordpress.org/plugins/updraftplus/
Если вы перечитаете мой ранний пост опять
(или несколько раз или сколько это требуется)
то поймёте что вопрос с бэкап уже снят т.к я исправила ошибку и бэкап уже не проблема.
В Гоогле много разноречивой инфо потому люди спрашивают на форуме.
Если у вас нечего прибавить об том
где можно взять курсы изучения плагинов то я не собираюсь продолжать с вами бесполезную дискуссию.
-
- Уже с Приветом
- Posts: 1422
- Joined: 28 Nov 2008 17:50
Re: Вопросы по Python
во первых взрослый человек не стал бы выплескивать в тему про питон ерунду с неким индюшачьим адоном на пхп, на минутку это нарушение правил.
во вторых взрослый бы так и заявил - проблема с левым аддоном, а не бэкапом. левый аддон и дамп в google drive напрямик - самое глупое сочетание, что можно придумать.
хотите об этом поговорить - создайте отдельную тему, не надо гадить в рандомных топиках.
-
- Уже с Приветом
- Posts: 744
- Joined: 17 Dec 2009 11:27
Re: Вопросы по Python
Если не секрет - в чем резон использовать платный аккаунт?
Ладно админу или девопсу- периодически проектики из разных областей поддерживаемой инфраструктуры вылазят.
Чем он так хорош в обычной программистской жизни?