मुख्य सामग्री पर जाएँ

Glasswall library लोड करना

पूर्वापेक्षाएँ

सामान्य

  • Python >= 3.6
  • सामान्य OS-विशिष्ट आवश्यकताओं और environment set up के लिए Installation देखें।

Glasswall Python Wrapper इंस्टॉलेशन

ऑनलाइन इंस्टॉलेशन

pip install --upgrade glasswall

ऑफ़लाइन इंस्टॉलेशन

ऑफ़लाइन इंस्टॉलेशन फ़ाइलों वाली directory के भीतर निम्न commands चलाएँ।

pip install --upgrade --no-index --find-links=. glasswall

नोट: ऑफ़लाइन इंस्टॉलेशन के लिए उपलब्ध wheels में उनके संबंधित packages के लिए सभी आवश्यक dependencies शामिल हैं और इन्हें amazonlinux.2023, rockylinux.8.9, और ubuntu.22.04 environments पर परीक्षण किया गया है।

Glasswall library लोड करना

Editor

Libraries initialization पर लोड की जाती हैं और इनमें एक आवश्यक argument होता है: library_path, जो किसी file या directory का path हो सकता है। यदि कोई directory निर्दिष्ट की जाती है, तो उसमें recursively खोज की जाती है और सबसे नवीन change time वाली library लोड की जाएगी।

import glasswall


# Load the Glasswall Editor library
editor = glasswall.Editor(r"C:\gwpw\libraries\10.0")
>>> 2025-03-15 12:27:42.337 glasswall INFO     __init__     Loaded Glasswall Editor version 2.1464.1 from C:\gwpw\libraries\10.0\glasswall_core2.dll

WordSearch

WordSearch की निर्भरता Editor libraries पर है। WordSearch लोड करते समय, सुनिश्चित करें कि WordSearch और Editor libraries एक ही working directory में स्थित हों।

import glasswall


# Load the Glasswall WordSearch library
word_search = glasswall.WordSearch(r"C:\gwpw\libraries\10.0")
>>> 2025-06-03 11:19:09.223 glasswall.config.logging  INFO    __init__    Loaded Glasswall WordSearch version 1.249.0 from from C:\gwpw\libraries\10.0\glasswall.word.search.dll

लाइसेंस प्रदान करना

By default, the Editor class expects a valid licence file to be located in the same directory as the library_path. You can also specify a different path to a gwkey.lic licence file using the licence argument.

import glasswall


# Load the Glasswall Editor library with a specified licence file
editor = glasswall.Editor(r"C:\gwpw\libraries\10.0", licence=r"C:\gwpw\licence\gwkey.lic")

वैकल्पिक रूप से, आप licence data को in-memory रूप में bytes, bytearray, या io.BytesIO object के रूप में पास कर सकते हैं।

import glasswall


# Alternatively, load the licence from in-memory bytes or bytearray
with open(r"C:\gwpw\licence\gwkey.lic", "rb") as f:
licence_data = f.read()

editor = glasswall.Editor(
r"C:\gwpw\libraries\10.0",
licence=licence_data # In-memory licence data
)