chunksize = 10 ** 6
with pd.read_csv(filename, chunksize=chunksize) as reader:
for chunk in reader:
process(chunk)
Помогает бороться с MemoryError
chunksize = 10 ** 6
with pd.read_csv(filename, chunksize=chunksize) as reader:
for chunk in reader:
process(chunk)
Помогает бороться с MemoryError
в postgresql.conf добавить listen_addresses = '*'
в pg_hba.conf добавить
host all all 192.168.1.1/16 md5
перезапустить службу
service postgresql restart
Если надо, внести изменения в настройки файрвола
def log_debug_decorator(func):
def wrapper(*args, **kwargs):
logger.log_debug("%s started" % func.__name__)
out = func(*args, **kwargs)
logger.log_debug("%s finished" % func.__name__)
return out
return wrapper
@log_debug_decorator
def empty_function():
"""!@brief ничего не делать
Заглушка для новых элементов управления
"""
import time
time.sleep(3) # Сон в 3 секунды
os.startfile(r'test.png')
https://pypi.org/project/dearpygui/
https://hoffstadt.github.io/DearPyGui/api_dearpygui.html#dearpygui.dearpygui.draw_line
https://habr.com/ru/company/skillfactory/blog/576912/ Быстрый, мощный интерфейс на Python
https://github.com/hoffstadt/DearPyGui/wiki/Logging
https://dearpygui.readthedocs.io/en/stable_08/api-reference/item-creation-runtime.html — документация для 0.8
Уже вышла версия 1.0
В версии 0.8…. работало так:
# 0.8
import dearpygui.dearpygui as dpg
from dearpygui.demo import show_demo
show_demo()
dpg.start_dearpygui()
В версии 1.3.1 код выше вылетает с ошибкой сегментации (Ubuntu LTS). Демка вернулась к жизни в 1.3.1 в следующем виде:
# 1.3.1
import dearpygui.dearpygui as dpg
from dearpygui.demo import show_demo
dpg.create_context()
dpg.create_viewport()
dpg.setup_dearpygui()
show_demo()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
import dearpygui.dearpygui as dpg
def show_info(title, message, selection_callback):
# guarantee these commands happen in the same frame
with dpg.mutex():
viewport_width = dpg.get_viewport_client_width()
viewport_height = dpg.get_viewport_client_height()
with dpg.window(label=title, modal=True, no_close=True) as modal_id:
dpg.add_text(message)
dpg.add_button(label="Ok", width=75, user_data=(modal_id, True), callback=selection_callback)
dpg.add_same_line()
dpg.add_button(label="Cancel", width=75, user_data=(modal_id, False), callback=selection_callback)
# guarantee these commands happen in another frame
dpg.split_frame()
width = dpg.get_item_width(modal_id)
height = dpg.get_item_height(modal_id)
dpg.set_item_pos(modal_id, [viewport_width // 2 - width // 2, viewport_height // 2 - height // 2])
def on_selection(sender, unused, user_data):
if user_data[1]:
print("User selected 'Ok'")
else:
print("User selected 'Cancel'")
# delete window
dpg.delete_item(user_data[0])
dpg.create_context()
dpg.create_viewport()
dpg.setup_dearpygui()
dpg.show_viewport()
with dpg.window(label="Example"):
dpg.add_button(label="Open Messagebox", callback=lambda:show_info("Message Box", "Do you wish to proceed?", on_selection))
dpg.start_dearpygui()
dpg.add_button(label="Apply 4", callback=lambda a, b, c: print("a: %s, b: %s, c: %s" % (a, b, c)), user_data="Some More Data")
dpg.set_global_font_scale(1.0)
with dpg.font_registry():
#
# dpg.add_font(
#
# )
with dpg.font(r"c:\windows\fonts\cour.ttf",
40,
default_font=True
):
#dpg.add_font_range_hint(dpg.mvFontRangeHint_Default)
dpg.add_font_range_hint(dpg.mvFontRangeHint_Cyrillic)
with dpg.window(
label="My label",
pos=(620, 20),
width=560,
height=760,
id="window_test"
) as pipeline_window:
dpg.add_button(
label="My Button",
callback=my_callback
)
dpg.setup_viewport()
dpg.set_viewport_title('qwe')
dpg.set_viewport_width(800)
dpg.set_viewport_height(800)
dpg.set_viewport_resizable(False)
dpg.set_viewport_clear_color([204, 204, 204])
dpg.start_dearpygui()
Ссылка на исходник самой демки со всеми примерами: https://github.com/hoffstadt/DearPyGui/blob/master/DearPyGui/dearpygui/demo.py
import datetime
TIME_START = datetime.datetime.now()
...
plt_target_dir += TIME_START.strftime(
"%Y.%m.%d_%H.%M"
)
sudo apt install gcc
sudo apt install g++a
user@comp:~/test/cpp$ g++ test.cpp
user@comp:~/test/cpp$ ls
a.out test.cpp
user@comp:~/test/cpp$ ./a.out
test message
user@comp:~/test/cpp$
>>> import pyodbc
>>> pyodbc.drivers()
['SQL Server', 'Microsoft Access Driver (*.mdb, *.accdb)', 'Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)', 'Microsoft Access Text Driver (*.txt, *.csv)', 'SQL Server Native Client 11.0', 'ODBC Driver 17 for SQL Server', 'SQL Server Native Client RDA 11.0', 'PostgreSQL ANSI(x64)', 'PostgreSQL Unicode(x64)', 'PostgreSQL ANSI', 'PostgreSQL Unicode']
>>>
https://ftp.postgresql.org/pub/odbc/versions/msi/psqlodbc_13_01_0000-x64.zip