<jupyter_start><jupyter_text>In this example Petrel is assumed to run on the same computer (localhost) as this Python script is run.The port number must match the number selected for the Python API server.<jupyter_code>port_number = 40129
petrel = PetrelConnection(port_number)
print(petrel)<jupyter_output>version: 1.0.7
host: localhost
port: 40129
is open: False<jupyter_text>Open the pettrellink. An exception is thrown if the connection is not successfully created<jupyter_code>petrel.open()<jupyter_output><empty_output><jupyter_text>Get the name of the currently running Petrel project<jupyter_code>project_name = petrel.get_current_project_name()
print(f'Name of currently active Petrel project is "{project_name}"')<jupyter_output>Name of currently active Petrel project is "PetrelDemoProject.pet"
{'fraction_non_alphanumeric': 0.07080745341614907, 'fraction_numerical': 0.016149068322981366, 'mean_word_length': 7.857142857142857, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '337928', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 258, 'n_tokens_neox': 245, 'n_words': 80, 'path': 'Notebooks/example_open_connection.ipynb', 'repo_name': 'cegaldev/Cegal-Python-Tool-Pro', 'size': '805'}