问:
how can i add QtLocation plugin in pyside project to use Map in qml? - SOLVED
i created an app in qt creator that displays a simple map and i want to do the same in pyside project without using webengine.
this is my code in qml:

```<code>import QtQuick 2.0
import QtPositioning 5.5
import QtLocation 5.6
import QtQuick.Controls 2.0

Item
{
id: root
visible: true

Plugin
{
    id: osmPlug
    name: "osm"

    PluginParameter
    {
        name: "osm.mapping.providersrepository.disabled"
        value: "true"
    }
    PluginParameter
    {
        name: "osm.mapping.providersrepository.address"
        value: "http://maps-redirect.qt.io/osm/5.6/"
    }
}

Map
{
    id: map
    anchors.fill: parent
    plugin: osmPlug
    center: QtPositioning.coordinate(59.91, 10.75) // Oslo
    zoomLevel: 3
    copyrightsVisible: false
    fieldOfView: 15
}
}
</code>```

this code in a pyside project ( in qtcreator ) returns this error:
module "QtLocation" is not installed

python code:

```<code># This Python file uses the following encoding: utf-8
import sys
from pathlib import Path

from PySide6.QtGui import QGuiApplication
from PySide6.QtQml import QQmlApplicationEngine

if __name__ == "__main__":
app = QGuiApplication(sys.argv)
engine = QQmlApplicationEngine()
qml_file = Path(__file__).resolve().parent / "main.qml"
engine.load(qml_file)
if not engine.rootObjects():
    sys.exit(-1)
sys.exit(app.exec())
</code>```

how can i solve this problem?

Thanks in advance

EDIT:

''' answer in comments '''

Body:
i created an app in qt creator that displays a simple map and i want to do the same in pyside project without using webengine.
this is my code in qml:

import QtQuick 2.0
import QtPositioning 5.5
import QtLocation 5.6
import QtQuick.Controls 2.0

Item
{
id: root
visible: true

Plugin
{
    id: osmPlug
    name: "osm"

    PluginParameter
    {
        name: "osm.mapping.providersrepository.disabled"
        value: "true"
    }
    PluginParameter
    {
        name: "osm.mapping.providersrepository.address"
        value: "http://maps-redirect.qt.io/osm/5.6/"
    }
}

Map
{
    id: map
    anchors.fill: parent
    plugin: osmPlug
    center: QtPositioning.coordinate(59.91, 10.75) // Oslo
    zoomLevel: 3
    copyrightsVisible: false
    fieldOfView: 15
}
}

this code in a pyside project ( in qtcreator ) returns this error:
module "QtLocation" is not installed

python code:

# This Python file uses the following encoding: utf-8
import sys
from pathlib import Path

from PySide6.QtGui import QGuiApplication
from PySide6.QtQml import QQmlApplicationEngine

if __name__ == "__main__":
app = QGuiApplication(sys.argv)
engine = QQmlApplicationEngine()
qml_file = Path(__file__).resolve().parent / "main.qml"
engine.load(qml_file)
if not engine.rootObjects():
    sys.exit(-1)
sys.exit(app.exec())

how can i solve this problem?

Thanks in advance

EDIT:

''' answer in comments '''


来源: stackexchange

问:
Creating a second website tree inside a typo3 backend for test purpose?
I have a typo3 backend with a page tree.

I want to future change the structure of that website. For that purpose i want to copy&paste the existing page tree and make changes there for testing purpose. And if everything works out, i want to replace the existing page tree with the new one.

How do i do that?

I did try to just copy the existing page. But the copy option doesnt show up.

ContentLicense: CC BY-SA 4.0


问:
How to import all the tables from a database to jupyter notebook via python?
I am trying to import or copy all the tables from postgress database to the jupyter notebook via python. I have tried using the below code, however could not generate all the tables with its records in the notebook. Below is the code for your reference:</p>
```<code>import psycopg2
import pandas as pd
import numpy as np

connection = psycopg2.connect(database="postgres", user="postgres", password="%%%%%%%%", host="localhost", port=54@@)
cursor = connection.cursor()

cursor.execute("""SELECT relname FROM pg_class WHERE relkind='r'
                  AND relname !~ '^(pg_|sql_)';""") # "rel" is short for relation.

tables = [i[0] for i in cursor.fetchall()] # A list() of tables.

for table_name in tables:
    table_name = table_name[0]
    # Read the table into a pandas DataFrame
    df = pd.read_sql_query("SELECT * FROM %s" % table_name, connection)

DatabaseError: Execution failed on sql 'SELECT * FROM e': relation "e" does not exist
LINE 1: SELECT * FROM e
                  ^
</code>```

Body:
I am trying to import or copy all the tables from postgress database to the jupyter notebook via python. I have tried using the below code, however could not generate all the tables with its records in the notebook. Below is the code for your reference:

import psycopg2
import pandas as pd
import numpy as np

connection = psycopg2.connect(database="postgres", user="postgres", password="%%%%%%%%", host="localhost", port=54@@)
cursor = connection.cursor()

cursor.execute("""SELECT relname FROM pg_class WHERE relkind='r'
                  AND relname !~ '^(pg_|sql_)';""") # "rel" is short for relation.

tables = [i[0] for i in cursor.fetchall()] # A list() of tables.

for table_name in tables:
    table_name = table_name[0]
    # Read the table into a pandas DataFrame
    df = pd.read_sql_query("SELECT * FROM %s" % table_name, connection)

DatabaseError: Execution failed on sql 'SELECT * FROM e': relation "e" does not exist
LINE 1: SELECT * FROM e
                  ^


问:
Spring cloud stream rabbitmq binder failed with schema registry as byte array returned
I am new to spring cloud stream rabbitmq binder and tried to integrate rabbitmq binder of spring cloud stream but not able to find any specific properties so not sure about Avro message converter part as it my response is in byte array.

I have tried to follow same like this one -> https://github.com/spring-cloud/spring-cloud-stream-samples/tree/main/schema-registry-samples/schema-registry-vanilla-rabbit-binder
but not working in my case as,

my-application.yml

above configs are not working and displaying my message in bytes only,

I am using 2.7.6 spring boot version version with JDK 8 for the same.

```<code>@Bean
public MessageConverter jsonMessageConverter() {

    ObjectMapper objectMapper = new ObjectMapper();
    return new Jackson2JsonMessageConverter(objectMapper);
}
</code>```

Above bean is used in rabbitmq listener as below,

```<code>SimpleRabbitListenerContainerFactory sf = new ...()
sf.setMessageConverter(jsonMessageConverter());
</code>```

and the message converter here is of amqp package not of spring package.

Body:
I am new to spring cloud stream rabbitmq binder and tried to integrate rabbitmq binder of spring cloud stream but not able to find any specific properties so not sure about Avro message converter part as it my response is in byte array.

I have tried to follow same like this one -> https://github.com/spring-cloud/spring-cloud-stream-samples/tree/main/schema-registry-samples/schema-registry-vanilla-rabbit-binder
but not working in my case as,

my-application.yml

above configs are not working and displaying my message in bytes only,

I am using 2.7.6 spring boot version version with JDK 8 for the same.

@Bean
public MessageConverter jsonMessageConverter() {

    ObjectMapper objectMapper = new ObjectMapper();
    return new Jackson2JsonMessageConverter(objectMapper);
}

Above bean is used in rabbitmq listener as below,

SimpleRabbitListenerContainerFactory sf = new ...()
sf.setMessageConverter(jsonMessageConverter());

and the message converter here is of amqp package not of spring package.


问:
How to reload TabMenu after filling model to refresh scroll icons
What I want to do: I'm trying to fill a p-tabmenu with items created from values in a database. And refresh the component to show scroll icons.

Here is the original example of PrimeNG Original PrimeNG Stackblitz

To show the problem I forked the example of primeng on Stackblitz: My fork of the example with the problem

What I did: First I want to call a webservice in the ngOnInit() method. To simulate this I put a delayed filling method in the example.

Note: I didn't initialize the model of the TabMenu. After the delay the tabs are created accordingly to the model. But there are no scroll icons on the left or right to navigate to items in the back.

The Problem: If I set the model with a delay witout initializing it first it won't be scrollable.

If I initialize the model beforehand with a for loop with many tabs and then change the model it works.

Question: Is there a way to reload the tabMenu component after I set the model (and after the user changes the window size) so the scrollbars appear only if the tabs are bigger than the screen?


问:
Converting Huggingface transformer model to PyTorch nn.Module
I have located a Transformer model I am interested in refurbishing for online learning via the river-torch library; however, river-torch requires to make models as extended from PyTorch's nn.Module class - and I fear that HuggingFace's models do not conform easily to allow for actual online training.

I have witnessed answered questions about converting a nn.Module into a Transformer pretrained model. Is there any way to do the reverse?


问:
How to connect pycharm to an existing docker container which is running?
When I use docker as interpreter, it takes an image and starts the container from from scratch.
I am looking for an option where I can connect directly to an existing container which is running.

Not able to figure out a way to do this with pycharm. Meanwhile VSCode seems to have this feature, and it works like a charm.

A deeper question is, why can't pycharm offer this feature yet, are there some technical challenges? If so, curious to know how vscode is doing this currently.

Tried the docker option under interpretors in pycharm. It starts a container from scratch, whereas I want to connect to the interpreter of an existing container which is running.


问:
how can i add private function to pywin32 windows service install method
I have a python script I want to wrap in a windows service, I'm using PyWin32 for this, and pyinstaller for compiling the script to an exe file.
I'm trying to detect the directory that the user installing from, so I just want to add a get current wd to the installation(only once, while installing the service) and save it once.
here is an example:</p>
```<code>class MyServiceFramework(win32serviceutil.ServiceFramework):

 """"???"""
 def SvcInstall(self):
     """add to the installation process some private configuration"""
     """???"""

 def SvcStop(self):
     """Stop the service"""
     self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
     self.running = False
     self.ReportServiceStatus(win32service.SERVICE_STOPPED)

 def SvcDoRun(self):
     """Start the service; does not return until stopped"""
     self.ReportServiceStatus(win32service.SERVICE_START_PENDING)
     self.service_impl = Main()
     self.ReportServiceStatus(win32service.SERVICE_RUNNING)
     # Run the service
     self.service_impl.run()
</code>```

Body:
I have a python script I want to wrap in a windows service, I'm using PyWin32 for this, and pyinstaller for compiling the script to an exe file.
I'm trying to detect the directory that the user installing from, so I just want to add a get current wd to the installation(only once, while installing the service) and save it once.
here is an example:

class MyServiceFramework(win32serviceutil.ServiceFramework):

 """"???"""
 def SvcInstall(self):
     """add to the installation process some private configuration"""
     """???"""

 def SvcStop(self):
     """Stop the service"""
     self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
     self.running = False
     self.ReportServiceStatus(win32service.SERVICE_STOPPED)

 def SvcDoRun(self):
     """Start the service; does not return until stopped"""
     self.ReportServiceStatus(win32service.SERVICE_START_PENDING)
     self.service_impl = Main()
     self.ReportServiceStatus(win32service.SERVICE_RUNNING)
     # Run the service
     self.service_impl.run()


问:
This site can’t be reached during cypress configuration
I am a newbie to cypress and trying to install cypress on my local machine but while doing configuration through UI I am getting the below issue. I already use the below command to install cypress:

```<code>npm install cypress --save-dev
</code>```

Step 1: Select chrome browser and click start E2E testing in Chrome

Sep 2: Getting the below issue after launching the chrome browser

Log:

```cypress:launcher:browsers launching browser { browser: { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '108.0.5359.98', path: 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe', minSupportedVersion: 64, majorVersion: '108', isHeaded: true, isHeadless: false }, url: 'about:blank' } +0ms
  cypress:launcher:browsers spawning browser with args { args: [ 'about:blank', '--test-type', '--ignore-certificate-errors', '--start-maximized', '--silent-debugger-extension-api', '--no-default-browser-check', '--no-first-run', '--noerrdialogs', '--enable-fixed-layout', '--disable-popup-blocking', '--disable-password-generation', '--disable-single-click-autofill', '--disable-prompt-on-repos', '--disable-background-timer-throttling', '--disable-renderer-backgrounding', '--disable-renderer-throttling', '--disable-backgrounding-occluded-windows', '--disable-restore-session-state', '--disable-new-profile-management', '--disable-new-avatar-menu', '--allow-insecure-localhost', '--reduce-security-for-testing', '--enable-automation', '--disable-print-preview', '--disable-device-discovery-notifications', '--autoplay-policy=no-user-gesture-required', '--disable-site-isolation-trials', '--metrics-recording-only', '--disable-prompt-on-repost', '--disable-hang-monitor', '--disable-sync', '--disable-web-resources', '--safebrowsing-disable-download-protection', '--disable-client-side-phishing-detection', '--disable-component-update', "--simulate-outdated-no-au='Tue, 31 Dec 2099 23:59:59 GMT'", '--disable-default-apps', '--use-fake-ui-for-media-stream', '--use-fake-device-for-media-stream', '--disable-ipc-flooding-protection', '--disable-backgrounding-occluded-window', '--disable-breakpad', '--password-store=basic', '--use-mock-keychain', '--disable-dev-shm-usage', '--proxy-server=http://localhost:58163', '--proxy-bypass-list=<-loopback>', '--remote-debugging-port=58175', '--remote-debugging-address=127.0.0.1', '--load-extension=C:\\Users\\dipak.bachhav\\AppData\\Roaming\\Cypress\\cy\\production\\browsers\\chrome-stable\\interactive\\CypressExtension,C:\\Users\\dipak.bachhav\\AppData\\Local\\Cypress\\Cache\\12.0.1\\Cypress\\resources\\app\\packages\\extension\\theme', '--user-data-dir=C:\\Users\\dipak.bachhav\\AppData\\Roaming\\Cypress\\cy\\production\\browsers\\chrome-stable\\interactive', '--disk-cache-dir=C:\\Users\\dipak.bachhav\\AppData\\Roaming\\Cypress\\cy\\production\\browsers\\chrome-stable\\interactive\\CypressCache' ] } +0ms
  cypress:launcher:browsers spawning browser with environment { env: { ALLUSERSPROFILE: 'C:\\ProgramData', APPDATA: 'C:\\Users\\dipak.bachhav\\AppData\\Roaming', BPPDOMAIN_MANAGER_ASM: 'EdrDotNet, Version=56.0.0.0, Culture=neutral, PublicKeyToken=da1b3922653ea916', BPPDOMAIN_MANAGER_TYPE: 'EdrDotNet.EdrAppDomainManager', COLOR: '1', CommonProgramFiles: 'C:\\Program Files\\Common Files', 'CommonProgramFiles(x86)': 'C:\\Program Files (x86)\\Common Files', CommonProgramW6432: 'C:\\Program Files\\Common Files', COMPUTERNAME: 'UKC-DSEV023991', ComSpec: 'C:\\WINDOWS\\system32\\cmd.exe', CYPRESS: 'true', CYPRESS_INTERNAL_ENV: 'production', DEBUG: 'cypress:*', DEBUG_COLORS: '1', DriverData: 'C:\\Windows\\System32\\Drivers\\DriverData', EDITOR: 'notepad.exe', FORCE_COLOR: '1', FORCE_STDERR_TTY: '1', FORCE_STDIN_TTY: '1', FORCE_STDOUT_TTY: '1', FPS_BROWSER_APP_PROFILE_STRING: 'Internet Explorer', FPS_BROWSER_USER_PROFILE_STRING: 'Default', GRADLE: 'C:\\Users\\dipak.bachhav\\Downloads\\gradle-6.9.1-bin\\gradle-6.9.1\\bin', HOME: 'C:\\Users\\dipak.bachhav', HOMEDRIVE: 'C:', HOMEPATH: '\\Users\\dipak.bachhav', INIT_CWD: 'C:\\Users\\dipak.bachhav\\CypressFramework', 'IntelliJ IDEA Community Edition': 'C:\\Users\\dipak.bachhav\\AppData\\Local\\JetBrains\\IntelliJ IDEA Community Edition 2022.1.2\\bin;', JAVA_HOME: 'C:\\Program Files\\Java\\jdk1.8.0_281', LOCALAPPDATA: 'C:\\Users\\dipak.bachhav\\AppData\\Local', LOGONSERVER: '\\\\UKC-DSEV023991', MAVEN_HOME: 'C:\\Users\\dipak.bachhav\\Downloads\\apache-maven-3.8.4\\bin', MOCHA_COLORS: '1', NODE: 'C:\\Tools\\nodejs\\node.exe', NODE_EXE: 'C:\\Tools\\nodejs\\\\node.exe', NODE_TLS_REJECT_UNAUTHORIZED: '0', NO_PROXY: '127.0.0.1,::1,localhost', NPM_CLI_JS: 'C:\\Tools\\nodejs\\\\node_modules\\npm\\bin\\npm-cli.js', npm_command: 'exec', npm_config_cache: 'C:\\Users\\dipak.bachhav\\AppData\\Local\\npm-cache', npm_config_globalconfig: 'C:\\Tools\\nodejs\\etc\\npmrc', npm_config_global_prefix: 'C:\\Tools\\nodejs', npm_config_init_module: 'C:\\Users\\dipak.bachhav\\.npm-init.js', npm_config_legacy_peer_deps: 'true', npm_config_local_prefix: 'C:\\Users\\dipak.bachhav\\CypressFramework', npm_config_metrics_registry: 'https://registry.npmjs.org/', npm_config_node_gyp: 'C:\\Tools\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js', npm_config_noproxy: '', npm_config_prefix: 'C:\\Tools\\nodejs', npm_config_userconfig: 'C:\\Users\\dipak.bachhav\\.npmrc', npm_config_user_agent: 'npm/8.19.2 node/v18.12.1 win32 x64 workspaces/false', npm_execpath: 'C:\\Tools\\nodejs\\node_modules\\npm\\bin\\npx-cli.js', npm_lifecycle_event: 'npx', npm_lifecycle_script: 'cypress', npm_node_execpath: 'C:\\Tools\\nodejs\\node.exe', npm_package_json: 'C:\\Users\\dipak.bachhav\\CypressFramework\\package.json', npm_package_name: 'cypressframework', npm_package_version: '1.0.0', NPM_PREFIX_NPX_CLI_JS: 'C:\\Tools\\nodejs\\node_modules\\npm\\bin\\npx-cli.js', NPX_CLI_JS: 'C:\\Tools\\nodejs\\node_modules\\npm\\bin\\npx-cli.js', NUMBER_OF_PROCESSORS: '4', OneDrive: 'C:\\Users\\dipak.bachhav\\OneDrive - Specsavers', OneDriveCommercial: 'C:\\Users\\dipak.bachhav\\OneDrive - Specsavers', ORIGINAL_NODE_OPTIONS: ' --openssl-legacy-provider', ORIGINAL_XDG_CURRENT_DESKTOP: 'undefined', OS: 'Windows_NT', Path: 'C:\\Users\\dipak.bachhav\\CypressFramework\\node_modules\\.bin;C:\\Users\\dipak.bachhav\\CypressFramework\\node_modules\\.bin;C:\\Users\\dipak.bachhav\\node_modules\\.bin;C:\\Users\\node_modules\\.bin;C:\\node_modules\\.bin;C:\\Tools\\nodejs\\node_modules\\npm\\node_modules\\@npmcli\\run-script\\lib\\node-gyp-bin;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\windows\\system32;C:\\windows;C:\\windows\\System32\\Wbem;C:\\windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\windows\\System32\\OpenSSH\\;C:\\Program Files\\WindowsPowerShell\\Scripts;C:\\Program Files\\Amazon\\AWSCLIV2\\;%SystemRoot%\\system32;%SystemRoot%;%SystemRoot%\\System32\\Wbem;%SYSTEMROOT%\\System32\\WindowsPowerShell\\v1.0\\;%SYSTEMROOT%\\System32\\OpenSSH\\;C:\\Users\\dipak.bachhav\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\dipak.bachhav\\AppData\\Local\\JetBrains\\IntelliJ IDEA Community Edition 2022.1.2\\bin;;C:\\Program Files\\Java\\jdk1.8.0_281;C:\\Users\\dipak.bachhav\\Downloads\\mongodb-windows-x86_64-5.0.2\\mongodb-win32-x86_64-windows-5.0.2\\bin;C:\\Users\\dipak.bachhav\\Downloads\\gradle-6.9.1-bin\\gradle-6.9.1\\bin;C:\\Users\\dipak.bachhav\\Downloads\\apache-maven-3.8.4\\bin;C:\\Users\\dipak.bachhav\\AppData\\Local\\Programs\\Git\\cmd;C:\\Users\\dipak.bachhav\\AppData\\Local\\Programs\\Python\\Python310;C:\\Users\\dipak.bachhav\\AppData\\Local\\Programs\\Python\\Python310\\Scripts;C:\\Tools\\nodejs;;C:\\Users\\dipak.bachhav\\AppData\\Local\\Programs\\Microsoft VS Code\\bin', PATHEXT: '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC', PROCESSOR_ARCHITECTURE: 'AMD64', PROCESSOR_IDENTIFIER: 'Intel64 Family 6 Model 78 Stepping 3, GenuineIntel', PROCESSOR_LEVEL: '6', PROCESSOR_REVISION: '4e03', ProgramData: 'C:\\ProgramData', ProgramFiles: 'C:\\Program Files', 'ProgramFiles(x86)': 'C:\\Program Files (x86)', ProgramW6432: 'C:\\Program Files', PROJECT_BASE_DIR: 'C:\\Users\\dipak.bachhav\\AppData\\Local\\Cypress\\Cache\\12.0.1\\Cypress\\resources\\app', PROMPT: '$P$G', PSModulePath: 'C:\\Program Files\\WindowsPowerShell\\Modules;C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules', PUBLIC: 'C:\\Users\\Public', SESSIONNAME: 'Console', snow_agent: 'C:\\Program Files\\Snow Software\\Inventory\\Agent', SystemDrive: 'C:', SystemRoot: 'C:\\WINDOWS', TEMP: 'C:\\Users\\DIPAK~1.BAC\\AppData\\Local\\Temp', TMP: 'C:\\Users\\DIPAK~1.BAC\\AppData\\Local\\Temp', USERDNSDOMAIN: 'ad.Specsavers.com', USERDOMAIN: 'ROOT', USERDOMAIN_ROAMINGPROFILE: 'ROOT', USERNAME: 'dipak.bachhav', USERPROFILE: 'C:\\Users\\dipak.bachhav', UV_THREADPOOL_SIZE: '128', windir: 'C:\\WINDOWS' } } +2ms
  cypress:network:connect received error on connect, retrying { iteration: 0, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:58175     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 58175 } } +20s
  cypress:network:connect received error on connect, retrying { iteration: 1, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:58175     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 58175 } } +103ms
  cypress:network:connect received error on connect, retrying { iteration: 2, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:58175     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 58175 } } +108ms
  cypress:network:connect received error on connect, retrying { iteration: 3, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:58175     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 58175 } } +116ms
  cypress:network:connect received error on connect, retrying { iteration: 4, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:58175     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 58175 } } +112ms
  cypress:network:connect received error on connect, retrying { iteration: 5, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:58175     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 58175 } } +132ms
  cypress:network:connect received error on connect, retrying { iteration: 6, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:58175     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 58175 } } +135ms
  cypress:network:connect received error on connect, retrying { iteration: 7, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:58175     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 58175 } } +125ms
  cypress:network:connect received error on connect, retrying { iteration: 8, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:58175     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 58175 } } +113ms
  cypress:network:connect received error on connect, retrying { iteration: 9, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:58175     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 58175 } } +113ms
  cypress:network:connect received error on connect, retrying { iteration: 10, delay: 500, err: Error: connect ECONNREFUSED 127.0.0.1:58175     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 58175 } } +112ms
  cypress:network:connect received error on connect, retrying { iteration: 11, delay: 500, err: Error: connect ECONNREFUSED 127.0.0.1:58175     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 58175 } } +551ms
  cypress:launcher:browsers chrome stderr: DevTools listening on ws://127.0.0.1:58175/devtools/browser/7e36c6be-5f03-448f-b778-3bb16a60f1c9 +2s
  cypress:network:connect successfully connected { opts: { host: '127.0.0.1', port: 58175, getDelayMsForRetry: [Function: getDelayMsForRetry] }, iteration: 12 } +516ms
  cypress:server:browsers:cri-client connecting { target: 'ws://127.0.0.1:58175/devtools/browser/7e36c6be-5f03-448f-b778-3bb16a60f1c9' } +0ms
  cypress:server:browsers:browser-cri-client Attaching to target url about:blank +0ms
  cypress:server:browsers:cri-client connecting { target: '8FF8DFB3A6DAD300EF9853759F387E8B' } +150ms
  cypress:server:browsers:cri-client registering CDP on event { eventName: 'Inspector.targetCrashed' } +13ms
  cypress:server:browsers:chrome attaching listeners to chrome { url: 'http://localhost:58163/__/', options: { browser: { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '108.0.5359.98', path: 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe', minSupportedVersion: 64, majorVersion: '108', isHeaded: true, isHeadless: false }, url: 'http://localhost:58163/__/', browsers: [ [Object], [Object], [Object] ], userAgent: null, proxyUrl: 'http://localhost:58163', proxyServer: 'http://localhost:58163', socketIoRoute: '/__socket', chromeWebSecurity: true, isTextTerminal: false, downloadsFolder: 'C:\\Users\\dipak.bachhav\\CypressFramework\\cypress\\downloads', experimentalModifyObstructiveThirdPartyCode: false, experimentalWebKitSupport: false, onBrowserClose: [Function (anonymous)], onError: [Function: onError], relaunchBrowser: [AsyncFunction (anonymous)], onBrowserOpen: [Function: onBrowserOpen] } } +3s
  cypress:server:browsers:cri-client registering CDP on event { eventName: 'Network.requestWillBeSent' } +1ms
  cypress:server:browsers:cri-client registering CDP on event { eventName: 'Network.responseReceived' } +1ms
  cypress:launcher:browsers chrome stderr: [9984:11536:1208/135124.795:ERROR:scoped_file_writer.cc(16)] Could not open pak file for writing: The process cannot access the file because it is being used by another process. (0x20) +828ms
  cypress:server:browsers:cri-client registering CDP on event { eventName: 'Page.downloadWillBegin' } +441ms
  cypress:server:browsers:cri-client registering CDP on event { eventName: 'Page.downloadProgress' } +0ms
  cypress:server:browsers:chrome received CRI client +450ms
  cypress:server:browsers:chrome navigating to page http://localhost:58163/__/ +0ms
  cypress:server:browsers:cri-client registering CDP on event { eventName: 'Fetch.requestPaused' } +572ms
  cypress:server:browsers:chrome listen for frame tree changes +565ms
  cypress:server:browsers:cri-client registering CDP on event { eventName: 'Page.frameAttached' } +1ms
  cypress:server:browsers:cri-client registering CDP on event { eventName: 'Page.frameDetached' } +0ms
  cypress:server:browsers browser opened +4s
  cypress:launcher:browsers chrome stderr: [9984:9040:1208/135128.366:ERROR:device_event_log_impl.cc(215)] [13:51:28.372] USB: usb_device_handle_win.cc:1045 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F) +4s
  cypress:launcher:browsers chrome stderr: [9984:9040:1208/135128.377:ERROR:device_event_log_impl.cc(215)] [13:51:28.377] USB: usb_device_handle_win.cc:1045 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
[9984:9040:1208/135128.377:ERROR:device_event_log_impl.cc(215)] [13:51:28.377] USB: usb_device_handle_win.cc:1045 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F) +5ms
  cypress:server:util:process_profiler current & mean memory and CPU usage by process group:
  cypress:server:util:process_profiler ┌─────────┬───────────┬──────────────┬─────────────────────────────────────────────────────────┬────────────┬────────────────┬──────────┬──────────────┬─────────────┐
  cypress:server:util:process_profiler │ (index) │   group   │ processCount │                          pids                           │ cpuPercent │ meanCpuPercent │ memRssMb │ meanMemRssMb │ maxMemRssMb │
  cypress:server:util:process_profiler ├─────────┼───────────┼──────────────┼─────────────────────────────────────────────────────────┼────────────┼────────────────┼──────────┼──────────────┼─────────────┤
  cypress:server:util:process_profiler │    0    │ 'Chrome'  │      8       │ '9984, 8772, 6004, 13368, 9076, 15556 ... 2 more items' │    0.07    │      0.07      │  372.75  │    372.75    │   372.75    │
  cypress:server:util:process_profiler │    1    │ 'cypress' │      1       │                         '8648'                          │    3.31    │      6.86      │  330.57  │    296.42    │   330.57    │
  cypress:server:util:process_profiler │    2    │  'other'  │      6       │        '6688, 17712, 10992, 13048, 3460, 17504'         │    3.48    │      2.96      │  241.91  │    206.43    │   262.01    │
  cypress:server:util:process_profiler │    3    │ 'plugin'  │      2       │                      '9872, 10916'                      │     0      │      0.16      │  80.52   │     79.6     │    80.52    │
  cypress:server:util:process_profiler │    4    │  'TOTAL'  │      17      │                           '-'                           │    6.86    │      9.96      │ 1025.75  │    655.74    │   1025.75   │
  cypress:server:util:process_profiler └─────────┴───────────┴──────────────┴─────────────────────────────────────────────────────────┴────────────┴────────────────┴──────────┴──────────────┴─────────────┘ +11s
  cypress:server:util:process_profiler current & mean memory and CPU usage by process group:
  cypress:server:util:process_profiler ┌─────────┬───────────┬──────────────┬─────────────────────────────────────────────────────────┬────────────┬────────────────┬──────────┬──────────────┬─────────────┐
  cypress:server:util:process_profiler │ (index) │   group   │ processCount │                          pids                           │ cpuPercent │ meanCpuPercent │ memRssMb │ meanMemRssMb │ maxMemRssMb │
  cypress:server:util:process_profiler ├─────────┼───────────┼──────────────┼─────────────────────────────────────────────────────────┼────────────┼────────────────┼──────────┼──────────────┼─────────────┤
  cypress:server:util:process_profiler │    0    │ 'Chrome'  │      8       │ '9984, 8772, 6004, 13368, 9076, 15556 ... 2 more items' │    4.68    │      2.37      │  384.62  │    378.68    │   384.62    │
  cypress:server:util:process_profiler │    1    │ 'cypress' │      1       │                         '8648'                          │    1.56    │      5.8       │  325.21  │    302.18    │   330.57    │
  cypress:server:util:process_profiler │    2    │  'other'  │      6       │         '6688, 17712, 10992, 1488, 16900, 2224'         │    0.82    │      2.53      │  209.05  │    206.95    │   262.01    │
  cypress:server:util:process_profiler │    3    │ 'plugin'  │      2       │                      '9872, 10916'                      │     0      │      0.12      │  80.52   │    79.83     │    80.52    │
  cypress:server:util:process_profiler │    4    │  'TOTAL'  │      17      │                           '-'                           │    7.06    │      9.38      │  999.39  │    724.47    │   1025.75   │
  cypress:server:util:process_profiler └─────────┴───────────┴──────────────┴─────────────────────────────────────────────────────────┴────────────┴────────────────┴──────────┴──────────────┴─────────────┘ +11s
  cypress:server:util:process_profiler current & mean memory and CPU usage by process group:
  cypress:server:util:process_profiler ┌─────────┬───────────┬──────────────┬─────────────────────────────────────────────────────────┬────────────┬────────────────┬──────────┬──────────────┬─────────────┐
  cypress:server:util:process_profiler │ (index) │   group   │ processCount │                          pids                           │ cpuPercent │ meanCpuPercent │ memRssMb │ meanMemRssMb │ maxMemRssMb │
  cypress:server:util:process_profiler ├─────────┼───────────┼──────────────┼─────────────────────────────────────────────────────────┼────────────┼────────────────┼──────────┼──────────────┼─────────────┤
  cypress:server:util:process_profiler │    0    │ 'Chrome'  │      7       │ '9984, 8772, 6004, 13368, 9076, 15556 ... 1 more items' │   -0.28    │      1.49      │  364.69  │    374.02    │   384.62    │
  cypress:server:util:process_profiler │    1    │ 'cypress' │      1       │                         '8648'                          │   -0.16    │      4.81      │  313.13  │     304      │   330.57    │
  cypress:server:util:process_profiler │    2    │  'other'  │      6       │         '6688, 17712, 10992, 4500, 9404, 10956'         │     0      │      2.11      │  207.4   │    207.03    │   262.01    │
  cypress:server:util:process_profiler │    3    │ 'plugin'  │      2       │                      '9872, 10916'                      │   -0.07    │      0.08      │  64.07   │    76.68     │    80.52    │
  cypress:server:util:process_profiler │    4    │  'TOTAL'  │      16      │                           '-'                           │    -0.5    │      7.73      │  949.29  │    761.94    │   1025.75   │
  cypress:server:util:process_profiler └─────────┴───────────┴──────────────┴─────────────────────────────────────────────────────────┴────────────┴────────────────┴──────────┴──────────────┴─────────────┘ +11s
  cypress:data-context:sources:GitDataSource Refreshing git data +48s
  cypress:data-context:sources:GitDataSource getting git info for [ 'C:/Users/dipak.bachhav/CypressFramework/cypress/e2e/search.feature' ]: +203ms
  cypress:data-context:sources:GitDataSource executing command: `FOR %x in ("C:\Users\dipak.bachhav\CypressFramework\cypress\e2e\search.feature") DO (git log --max-count=1 --pretty="format:%ci %ar %an|%h|%s" %x)` +0ms
  cypress:data-context:sources:GitDataSource cwd: `C:\Users\dipak.bachhav\CypressFramework` +0ms
  cypress:data-context:sources:GitDataSource On current branch  +337ms
  cypress:server:util:process_profiler current & mean memory and CPU usage by process group:
```

Body:
I am a newbie to cypress and trying to install cypress on my local machine but while doing configuration through UI I am getting the below issue. I already use the below command to install cypress:

npm install cypress --save-dev

Step 1: Select chrome browser and click start E2E testing in Chrome

Sep 2: Getting the below issue after launching the chrome browser

Log:

cypress:launcher:browsers launching browser { browser: { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '108.0.5359.98', path: 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe', minSupportedVersion: 64, majorVersion: '108', isHeaded: true, isHeadless: false }, url: 'about:blank' } +0ms
  cypress:launcher:browsers spawning browser with args { args: [ 'about:blank', '--test-type', '--ignore-certificate-errors', '--start-maximized', '--silent-debugger-extension-api', '--no-default-browser-check', '--no-first-run', '--noerrdialogs', '--enable-fixed-layout', '--disable-popup-blocking', '--disable-password-generation', '--disable-single-click-autofill', '--disable-prompt-on-repos', '--disable-background-timer-throttling', '--disable-renderer-backgrounding', '--disable-renderer-throttling', '--disable-backgrounding-occluded-windows', '--disable-restore-session-state', '--disable-new-profile-management', '--disable-new-avatar-menu', '--allow-insecure-localhost', '--reduce-security-for-testing', '--enable-automation', '--disable-print-preview', '--disable-device-discovery-notifications', '--autoplay-policy=no-user-gesture-required', '--disable-site-isolation-trials', '--metrics-recording-only', '--disable-prompt-on-repost', '--disable-hang-monitor', '--disable-sync', '--disable-web-resources', '--safebrowsing-disable-download-protection', '--disable-client-side-phishing-detection', '--disable-component-update', "--simulate-outdated-no-au='Tue, 31 Dec 2099 23:59:59 GMT'", '--disable-default-apps', '--use-fake-ui-for-media-stream', '--use-fake-device-for-media-stream', '--disable-ipc-flooding-protection', '--disable-backgrounding-occluded-window', '--disable-breakpad', '--password-store=basic', '--use-mock-keychain', '--disable-dev-shm-usage', '--proxy-server=http://localhost:58163', '--proxy-bypass-list=<-loopback>', '--remote-debugging-port=58175', '--remote-debugging-address=127.0.0.1', '--load-extension=C:\\Users\\dipak.bachhav\\AppData\\Roaming\\Cypress\\cy\\production\\browsers\\chrome-stable\\interactive\\CypressExtension,C:\\Users\\dipak.bachhav\\AppData\\Local\\Cypress\\Cache\\12.0.1\\Cypress\\resources\\app\\packages\\extension\\theme', '--user-data-dir=C:\\Users\\dipak.bachhav\\AppData\\Roaming\\Cypress\\cy\\production\\browsers\\chrome-stable\\interactive', '--disk-cache-dir=C:\\Users\\dipak.bachhav\\AppData\\Roaming\\Cypress\\cy\\production\\browsers\\chrome-stable\\interactive\\CypressCache' ] } +0ms
  cypress:launcher:browsers spawning browser with environment { env: { ALLUSERSPROFILE: 'C:\\ProgramData', APPDATA: 'C:\\Users\\dipak.bachhav\\AppData\\Roaming', BPPDOMAIN_MANAGER_ASM: 'EdrDotNet, Version=56.0.0.0, Culture=neutral, PublicKeyToken=da1b3922653ea916', BPPDOMAIN_MANAGER_TYPE: 'EdrDotNet.EdrAppDomainManager', COLOR: '1', CommonProgramFiles: 'C:\\Program Files\\Common Files', 'CommonProgramFiles(x86)': 'C:\\Program Files (x86)\\Common Files', CommonProgramW6432: 'C:\\Program Files\\Common Files', COMPUTERNAME: 'UKC-DSEV023991', ComSpec: 'C:\\WINDOWS\\system32\\cmd.exe', CYPRESS: 'true', CYPRESS_INTERNAL_ENV: 'production', DEBUG: 'cypress:*', DEBUG_COLORS: '1', DriverData: 'C:\\Windows\\System32\\Drivers\\DriverData', EDITOR: 'notepad.exe', FORCE_COLOR: '1', FORCE_STDERR_TTY: '1', FORCE_STDIN_TTY: '1', FORCE_STDOUT_TTY: '1', FPS_BROWSER_APP_PROFILE_STRING: 'Internet Explorer', FPS_BROWSER_USER_PROFILE_STRING: 'Default', GRADLE: 'C:\\Users\\dipak.bachhav\\Downloads\\gradle-6.9.1-bin\\gradle-6.9.1\\bin', HOME: 'C:\\Users\\dipak.bachhav', HOMEDRIVE: 'C:', HOMEPATH: '\\Users\\dipak.bachhav', INIT_CWD: 'C:\\Users\\dipak.bachhav\\CypressFramework', 'IntelliJ IDEA Community Edition': 'C:\\Users\\dipak.bachhav\\AppData\\Local\\JetBrains\\IntelliJ IDEA Community Edition 2022.1.2\\bin;', JAVA_HOME: 'C:\\Program Files\\Java\\jdk1.8.0_281', LOCALAPPDATA: 'C:\\Users\\dipak.bachhav\\AppData\\Local', LOGONSERVER: '\\\\UKC-DSEV023991', MAVEN_HOME: 'C:\\Users\\dipak.bachhav\\Downloads\\apache-maven-3.8.4\\bin', MOCHA_COLORS: '1', NODE: 'C:\\Tools\\nodejs\\node.exe', NODE_EXE: 'C:\\Tools\\nodejs\\\\node.exe', NODE_TLS_REJECT_UNAUTHORIZED: '0', NO_PROXY: '127.0.0.1,::1,localhost', NPM_CLI_JS: 'C:\\Tools\\nodejs\\\\node_modules\\npm\\bin\\npm-cli.js', npm_command: 'exec', npm_config_cache: 'C:\\Users\\dipak.bachhav\\AppData\\Local\\npm-cache', npm_config_globalconfig: 'C:\\Tools\\nodejs\\etc\\npmrc', npm_config_global_prefix: 'C:\\Tools\\nodejs', npm_config_init_module: 'C:\\Users\\dipak.bachhav\\.npm-init.js', npm_config_legacy_peer_deps: 'true', npm_config_local_prefix: 'C:\\Users\\dipak.bachhav\\CypressFramework', npm_config_metrics_registry: 'https://registry.npmjs.org/', npm_config_node_gyp: 'C:\\Tools\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js', npm_config_noproxy: '', npm_config_prefix: 'C:\\Tools\\nodejs', npm_config_userconfig: 'C:\\Users\\dipak.bachhav\\.npmrc', npm_config_user_agent: 'npm/8.19.2 node/v18.12.1 win32 x64 workspaces/false', npm_execpath: 'C:\\Tools\\nodejs\\node_modules\\npm\\bin\\npx-cli.js', npm_lifecycle_event: 'npx', npm_lifecycle_script: 'cypress', npm_node_execpath: 'C:\\Tools\\nodejs\\node.exe', npm_package_json: 'C:\\Users\\dipak.bachhav\\CypressFramework\\package.json', npm_package_name: 'cypressframework', npm_package_version: '1.0.0', NPM_PREFIX_NPX_CLI_JS: 'C:\\Tools\\nodejs\\node_modules\\npm\\bin\\npx-cli.js', NPX_CLI_JS: 'C:\\Tools\\nodejs\\node_modules\\npm\\bin\\npx-cli.js', NUMBER_OF_PROCESSORS: '4', OneDrive: 'C:\\Users\\dipak.bachhav\\OneDrive - Specsavers', OneDriveCommercial: 'C:\\Users\\dipak.bachhav\\OneDrive - Specsavers', ORIGINAL_NODE_OPTIONS: ' --openssl-legacy-provider', ORIGINAL_XDG_CURRENT_DESKTOP: 'undefined', OS: 'Windows_NT', Path: 'C:\\Users\\dipak.bachhav\\CypressFramework\\node_modules\\.bin;C:\\Users\\dipak.bachhav\\CypressFramework\\node_modules\\.bin;C:\\Users\\dipak.bachhav\\node_modules\\.bin;C:\\Users\\node_modules\\.bin;C:\\node_modules\\.bin;C:\\Tools\\nodejs\\node_modules\\npm\\node_modules\\@npmcli\\run-script\\lib\\node-gyp-bin;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\windows\\system32;C:\\windows;C:\\windows\\System32\\Wbem;C:\\windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\windows\\System32\\OpenSSH\\;C:\\Program Files\\WindowsPowerShell\\Scripts;C:\\Program Files\\Amazon\\AWSCLIV2\\;%SystemRoot%\\system32;%SystemRoot%;%SystemRoot%\\System32\\Wbem;%SYSTEMROOT%\\System32\\WindowsPowerShell\\v1.0\\;%SYSTEMROOT%\\System32\\OpenSSH\\;C:\\Users\\dipak.bachhav\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\dipak.bachhav\\AppData\\Local\\JetBrains\\IntelliJ IDEA Community Edition 2022.1.2\\bin;;C:\\Program Files\\Java\\jdk1.8.0_281;C:\\Users\\dipak.bachhav\\Downloads\\mongodb-windows-x86_64-5.0.2\\mongodb-win32-x86_64-windows-5.0.2\\bin;C:\\Users\\dipak.bachhav\\Downloads\\gradle-6.9.1-bin\\gradle-6.9.1\\bin;C:\\Users\\dipak.bachhav\\Downloads\\apache-maven-3.8.4\\bin;C:\\Users\\dipak.bachhav\\AppData\\Local\\Programs\\Git\\cmd;C:\\Users\\dipak.bachhav\\AppData\\Local\\Programs\\Python\\Python310;C:\\Users\\dipak.bachhav\\AppData\\Local\\Programs\\Python\\Python310\\Scripts;C:\\Tools\\nodejs;;C:\\Users\\dipak.bachhav\\AppData\\Local\\Programs\\Microsoft VS Code\\bin', PATHEXT: '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC', PROCESSOR_ARCHITECTURE: 'AMD64', PROCESSOR_IDENTIFIER: 'Intel64 Family 6 Model 78 Stepping 3, GenuineIntel', PROCESSOR_LEVEL: '6', PROCESSOR_REVISION: '4e03', ProgramData: 'C:\\ProgramData', ProgramFiles: 'C:\\Program Files', 'ProgramFiles(x86)': 'C:\\Program Files (x86)', ProgramW6432: 'C:\\Program Files', PROJECT_BASE_DIR: 'C:\\Users\\dipak.bachhav\\AppData\\Local\\Cypress\\Cache\\12.0.1\\Cypress\\resources\\app', PROMPT: '$P$G', PSModulePath: 'C:\\Program Files\\WindowsPowerShell\\Modules;C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules', PUBLIC: 'C:\\Users\\Public', SESSIONNAME: 'Console', snow_agent: 'C:\\Program Files\\Snow Software\\Inventory\\Agent', SystemDrive: 'C:', SystemRoot: 'C:\\WINDOWS', TEMP: 'C:\\Users\\DIPAK~1.BAC\\AppData\\Local\\Temp', TMP: 'C:\\Users\\DIPAK~1.BAC\\AppData\\Local\\Temp', USERDNSDOMAIN: 'ad.Specsavers.com', USERDOMAIN: 'ROOT', USERDOMAIN_ROAMINGPROFILE: 'ROOT', USERNAME: 'dipak.bachhav', USERPROFILE: 'C:\\Users\\dipak.bachhav', UV_THREADPOOL_SIZE: '128', windir: 'C:\\WINDOWS' } } +2ms
  cypress:network:connect received error on connect, retrying { iteration: 0, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:58175     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 58175 } } +20s
  cypress:network:connect received error on connect, retrying { iteration: 1, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:58175     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 58175 } } +103ms
  cypress:network:connect received error on connect, retrying { iteration: 2, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:58175     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 58175 } } +108ms
  cypress:network:connect received error on connect, retrying { iteration: 3, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:58175     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 58175 } } +116ms
  cypress:network:connect received error on connect, retrying { iteration: 4, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:58175     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 58175 } } +112ms
  cypress:network:connect received error on connect, retrying { iteration: 5, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:58175     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 58175 } } +132ms
  cypress:network:connect received error on connect, retrying { iteration: 6, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:58175     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 58175 } } +135ms
  cypress:network:connect received error on connect, retrying { iteration: 7, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:58175     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 58175 } } +125ms
  cypress:network:connect received error on connect, retrying { iteration: 8, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:58175     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 58175 } } +113ms
  cypress:network:connect received error on connect, retrying { iteration: 9, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:58175     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 58175 } } +113ms
  cypress:network:connect received error on connect, retrying { iteration: 10, delay: 500, err: Error: connect ECONNREFUSED 127.0.0.1:58175     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 58175 } } +112ms
  cypress:network:connect received error on connect, retrying { iteration: 11, delay: 500, err: Error: connect ECONNREFUSED 127.0.0.1:58175     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 58175 } } +551ms
  cypress:launcher:browsers chrome stderr: DevTools listening on ws://127.0.0.1:58175/devtools/browser/7e36c6be-5f03-448f-b778-3bb16a60f1c9 +2s
  cypress:network:connect successfully connected { opts: { host: '127.0.0.1', port: 58175, getDelayMsForRetry: [Function: getDelayMsForRetry] }, iteration: 12 } +516ms
  cypress:server:browsers:cri-client connecting { target: 'ws://127.0.0.1:58175/devtools/browser/7e36c6be-5f03-448f-b778-3bb16a60f1c9' } +0ms
  cypress:server:browsers:browser-cri-client Attaching to target url about:blank +0ms
  cypress:server:browsers:cri-client connecting { target: '8FF8DFB3A6DAD300EF9853759F387E8B' } +150ms
  cypress:server:browsers:cri-client registering CDP on event { eventName: 'Inspector.targetCrashed' } +13ms
  cypress:server:browsers:chrome attaching listeners to chrome { url: 'http://localhost:58163/__/', options: { browser: { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '108.0.5359.98', path: 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe', minSupportedVersion: 64, majorVersion: '108', isHeaded: true, isHeadless: false }, url: 'http://localhost:58163/__/', browsers: [ [Object], [Object], [Object] ], userAgent: null, proxyUrl: 'http://localhost:58163', proxyServer: 'http://localhost:58163', socketIoRoute: '/__socket', chromeWebSecurity: true, isTextTerminal: false, downloadsFolder: 'C:\\Users\\dipak.bachhav\\CypressFramework\\cypress\\downloads', experimentalModifyObstructiveThirdPartyCode: false, experimentalWebKitSupport: false, onBrowserClose: [Function (anonymous)], onError: [Function: onError], relaunchBrowser: [AsyncFunction (anonymous)], onBrowserOpen: [Function: onBrowserOpen] } } +3s
  cypress:server:browsers:cri-client registering CDP on event { eventName: 'Network.requestWillBeSent' } +1ms
  cypress:server:browsers:cri-client registering CDP on event { eventName: 'Network.responseReceived' } +1ms
  cypress:launcher:browsers chrome stderr: [9984:11536:1208/135124.795:ERROR:scoped_file_writer.cc(16)] Could not open pak file for writing: The process cannot access the file because it is being used by another process. (0x20) +828ms
  cypress:server:browsers:cri-client registering CDP on event { eventName: 'Page.downloadWillBegin' } +441ms
  cypress:server:browsers:cri-client registering CDP on event { eventName: 'Page.downloadProgress' } +0ms
  cypress:server:browsers:chrome received CRI client +450ms
  cypress:server:browsers:chrome navigating to page http://localhost:58163/__/ +0ms
  cypress:server:browsers:cri-client registering CDP on event { eventName: 'Fetch.requestPaused' } +572ms
  cypress:server:browsers:chrome listen for frame tree changes +565ms
  cypress:server:browsers:cri-client registering CDP on event { eventName: 'Page.frameAttached' } +1ms
  cypress:server:browsers:cri-client registering CDP on event { eventName: 'Page.frameDetached' } +0ms
  cypress:server:browsers browser opened +4s
  cypress:launcher:browsers chrome stderr: [9984:9040:1208/135128.366:ERROR:device_event_log_impl.cc(215)] [13:51:28.372] USB: usb_device_handle_win.cc:1045 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F) +4s
  cypress:launcher:browsers chrome stderr: [9984:9040:1208/135128.377:ERROR:device_event_log_impl.cc(215)] [13:51:28.377] USB: usb_device_handle_win.cc:1045 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
[9984:9040:1208/135128.377:ERROR:device_event_log_impl.cc(215)] [13:51:28.377] USB: usb_device_handle_win.cc:1045 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F) +5ms
  cypress:server:util:process_profiler current & mean memory and CPU usage by process group:
  cypress:server:util:process_profiler ┌─────────┬───────────┬──────────────┬─────────────────────────────────────────────────────────┬────────────┬────────────────┬──────────┬──────────────┬─────────────┐
  cypress:server:util:process_profiler │ (index) │   group   │ processCount │                          pids                           │ cpuPercent │ meanCpuPercent │ memRssMb │ meanMemRssMb │ maxMemRssMb │
  cypress:server:util:process_profiler ├─────────┼───────────┼──────────────┼─────────────────────────────────────────────────────────┼────────────┼────────────────┼──────────┼──────────────┼─────────────┤
  cypress:server:util:process_profiler │    0    │ 'Chrome'  │      8       │ '9984, 8772, 6004, 13368, 9076, 15556 ... 2 more items' │    0.07    │      0.07      │  372.75  │    372.75    │   372.75    │
  cypress:server:util:process_profiler │    1    │ 'cypress' │      1       │                         '8648'                          │    3.31    │      6.86      │  330.57  │    296.42    │   330.57    │
  cypress:server:util:process_profiler │    2    │  'other'  │      6       │        '6688, 17712, 10992, 13048, 3460, 17504'         │    3.48    │      2.96      │  241.91  │    206.43    │   262.01    │
  cypress:server:util:process_profiler │    3    │ 'plugin'  │      2       │                      '9872, 10916'                      │     0      │      0.16      │  80.52   │     79.6     │    80.52    │
  cypress:server:util:process_profiler │    4    │  'TOTAL'  │      17      │                           '-'                           │    6.86    │      9.96      │ 1025.75  │    655.74    │   1025.75   │
  cypress:server:util:process_profiler └─────────┴───────────┴──────────────┴─────────────────────────────────────────────────────────┴────────────┴────────────────┴──────────┴──────────────┴─────────────┘ +11s
  cypress:server:util:process_profiler current & mean memory and CPU usage by process group:
  cypress:server:util:process_profiler ┌─────────┬───────────┬──────────────┬─────────────────────────────────────────────────────────┬────────────┬────────────────┬──────────┬──────────────┬─────────────┐
  cypress:server:util:process_profiler │ (index) │   group   │ processCount │                          pids                           │ cpuPercent │ meanCpuPercent │ memRssMb │ meanMemRssMb │ maxMemRssMb │
  cypress:server:util:process_profiler ├─────────┼───────────┼──────────────┼─────────────────────────────────────────────────────────┼────────────┼────────────────┼──────────┼──────────────┼─────────────┤
  cypress:server:util:process_profiler │    0    │ 'Chrome'  │      8       │ '9984, 8772, 6004, 13368, 9076, 15556 ... 2 more items' │    4.68    │      2.37      │  384.62  │    378.68    │   384.62    │
  cypress:server:util:process_profiler │    1    │ 'cypress' │      1       │                         '8648'                          │    1.56    │      5.8       │  325.21  │    302.18    │   330.57    │
  cypress:server:util:process_profiler │    2    │  'other'  │      6       │         '6688, 17712, 10992, 1488, 16900, 2224'         │    0.82    │      2.53      │  209.05  │    206.95    │   262.01    │
  cypress:server:util:process_profiler │    3    │ 'plugin'  │      2       │                      '9872, 10916'                      │     0      │      0.12      │  80.52   │    79.83     │    80.52    │
  cypress:server:util:process_profiler │    4    │  'TOTAL'  │      17      │                           '-'                           │    7.06    │      9.38      │  999.39  │    724.47    │   1025.75   │
  cypress:server:util:process_profiler └─────────┴───────────┴──────────────┴─────────────────────────────────────────────────────────┴────────────┴────────────────┴──────────┴──────────────┴─────────────┘ +11s
  cypress:server:util:process_profiler current & mean memory and CPU usage by process group:
  cypress:server:util:process_profiler ┌─────────┬───────────┬──────────────┬─────────────────────────────────────────────────────────┬────────────┬────────────────┬──────────┬──────────────┬─────────────┐
  cypress:server:util:process_profiler │ (index) │   group   │ processCount │                          pids                           │ cpuPercent │ meanCpuPercent │ memRssMb │ meanMemRssMb │ maxMemRssMb │
  cypress:server:util:process_profiler ├─────────┼───────────┼──────────────┼─────────────────────────────────────────────────────────┼────────────┼────────────────┼──────────┼──────────────┼─────────────┤
  cypress:server:util:process_profiler │    0    │ 'Chrome'  │      7       │ '9984, 8772, 6004, 13368, 9076, 15556 ... 1 more items' │   -0.28    │      1.49      │  364.69  │    374.02    │   384.62    │
  cypress:server:util:process_profiler │    1    │ 'cypress' │      1       │                         '8648'                          │   -0.16    │      4.81      │  313.13  │     304      │   330.57    │
  cypress:server:util:process_profiler │    2    │  'other'  │      6       │         '6688, 17712, 10992, 4500, 9404, 10956'         │     0      │      2.11      │  207.4   │    207.03    │   262.01    │
  cypress:server:util:process_profiler │    3    │ 'plugin'  │      2       │                      '9872, 10916'                      │   -0.07    │      0.08      │  64.07   │    76.68     │    80.52    │
  cypress:server:util:process_profiler │    4    │  'TOTAL'  │      16      │                           '-'                           │    -0.5    │      7.73      │  949.29  │    761.94    │   1025.75   │
  cypress:server:util:process_profiler └─────────┴───────────┴──────────────┴─────────────────────────────────────────────────────────┴────────────┴────────────────┴──────────┴──────────────┴─────────────┘ +11s
  cypress:data-context:sources:GitDataSource Refreshing git data +48s
  cypress:data-context:sources:GitDataSource getting git info for [ 'C:/Users/dipak.bachhav/CypressFramework/cypress/e2e/search.feature' ]: +203ms
  cypress:data-context:sources:GitDataSource executing command: `FOR %x in ("C:\Users\dipak.bachhav\CypressFramework\cypress\e2e\search.feature") DO (git log --max-count=1 --pretty="format:%ci %ar %an|%h|%s" %x)` +0ms
  cypress:data-context:sources:GitDataSource cwd: `C:\Users\dipak.bachhav\CypressFramework` +0ms
  cypress:data-context:sources:GitDataSource On current branch  +337ms
  cypress:server:util:process_profiler current & mean memory and CPU usage by process group:


问:
Userdefined types not working in PowerShell class
In PowerShell 5.1 I want to invoke API calls to get icons associated with files.

I have put the necessary code for the API calls into a module with the following code:

```<code>################
# Module1.psm1 #
################

Write-Host "Creating IconExtractor"
$IconExtractorSignature = '
    private struct SHFILEINFO
    {
        public IntPtr hIcon;
        public int iIcon;
        public uint dwAttributes;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
        public string szDisplayName;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
        public string szTypeName;
    }
    [DllImport("shell32.dll", CharSet=CharSet.Auto)]private static extern IntPtr SHGetFileInfo(string pszPath, uint dwFileAttributes, ref SHFILEINFO psfi, int cbFileInfo, int uFlags);
    [DllImport("shell32.dll")]public static extern int ExtractIconEx(string sFile, int iIndex, out IntPtr piLargeVersion, out IntPtr piSmallVersion, int amountIcons);
    public static int GetAssociatedIcons(string Path, ref IntPtr LHandle, ref IntPtr SHandle)
    {
        const int SHGFI_ICON = 0x100;

        const int SHGFI_SMALLICON = 0x1;
        const int SHGFI_LARGEICON = 0x0;
        const int SHGFI_USEFILEATTRIBUTES = 0x000000010;
        //const int SHGFI_SYSICONINDEX = 0x4000;
        //const int SHGFI_ICONLOCATION = 0x000001000;
        //const int SHGFI_SHELLICONSIZE = 0x000000004;

        SHFILEINFO SHFI = new SHFILEINFO();
        int size = Marshal.SizeOf(SHFI);
        int SmallIconFlags = SHGFI_ICON | SHGFI_SMALLICON | SHGFI_USEFILEATTRIBUTES;
        int LargeIconFlags = SHGFI_ICON | SHGFI_LARGEICON | SHGFI_USEFILEATTRIBUTES;
        IntPtr Result1;
        IntPtr Result2;
        Result1 = SHGetFileInfo(Path, 0, ref SHFI, size, SmallIconFlags);
        SHandle = SHFI.hIcon;
        Result2 = SHGetFileInfo(Path, 0, ref SHFI, size, LargeIconFlags);
        LHandle = SHFI.hIcon;
        int Result = Result1.ToInt32() + Result2.ToInt32();
        return Result;
    }'

$IconExtractor = Add-Type -MemberDefinition $IconExtractorSignature -Name "Methods" -Namespace Win32 -PassThru
</code>```

My script contains a class where I want to make use of the [Win32.Methods] namespace that is defined in my "Module1.psm1". Simplified code:

```<code>###############
# Script1.ps1 #
###############

using module ".\Module1.psm1" #The module is located in the same directory

class CustomForm : System.Windows.Forms.Form
{
    CustomForm()
    {
        [System.IntPtr] $LHandle = [System.IntPtr]::new(0)
        [System.IntPtr] $SHandle = [System.IntPtr]::new(0)
        [Win32.Methods]::GetAssociatedIcons("C:", [ref] $LHandle, [ref] $SHandle) | Out-Null #Get the Icon associated with drive C:
        $this.Icon = [System.Drawing.Icon]::FromHandle($LHandle)
    }
}
[CustomForm]::new().ShowDialog()
</code>```

It is not possible to run the Script1.ps1 because "Type [Win32.Methods] was not found."...

However, if I change my code in the following way it runs fine:

```<code>###############
# Script2.ps1 #
###############

using module ".\Module1.psm1" #The module is located in the same directory

$CustomForm = [System.Windows.Forms.Form]::new()

[System.IntPtr] $LHandle = [System.IntPtr]::new(0)
[System.IntPtr] $SHandle = [System.IntPtr]::new(0)
[Win32.Methods]::GetAssociatedIcons("C:", [ref] $LHandle, [ref] $SHandle) | Out-Null #Get the Icon associated with drive C:
$CustomForm.Icon = [System.Drawing.Icon]::FromHandle($LHandle)

$CustomForm.ShowDialog()
</code>```

Could anyone please tell me how I get this running using the CustomForm-Class?

Body:
In PowerShell 5.1 I want to invoke API calls to get icons associated with files.

I have put the necessary code for the API calls into a module with the following code:

################
# Module1.psm1 #
################

Write-Host "Creating IconExtractor"
$IconExtractorSignature = '
    private struct SHFILEINFO
    {
        public IntPtr hIcon;
        public int iIcon;
        public uint dwAttributes;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
        public string szDisplayName;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
        public string szTypeName;
    }
    [DllImport("shell32.dll", CharSet=CharSet.Auto)]private static extern IntPtr SHGetFileInfo(string pszPath, uint dwFileAttributes, ref SHFILEINFO psfi, int cbFileInfo, int uFlags);
    [DllImport("shell32.dll")]public static extern int ExtractIconEx(string sFile, int iIndex, out IntPtr piLargeVersion, out IntPtr piSmallVersion, int amountIcons);
    public static int GetAssociatedIcons(string Path, ref IntPtr LHandle, ref IntPtr SHandle)
    {
        const int SHGFI_ICON = 0x100;

        const int SHGFI_SMALLICON = 0x1;
        const int SHGFI_LARGEICON = 0x0;
        const int SHGFI_USEFILEATTRIBUTES = 0x000000010;
        //const int SHGFI_SYSICONINDEX = 0x4000;
        //const int SHGFI_ICONLOCATION = 0x000001000;
        //const int SHGFI_SHELLICONSIZE = 0x000000004;

        SHFILEINFO SHFI = new SHFILEINFO();
        int size = Marshal.SizeOf(SHFI);
        int SmallIconFlags = SHGFI_ICON | SHGFI_SMALLICON | SHGFI_USEFILEATTRIBUTES;
        int LargeIconFlags = SHGFI_ICON | SHGFI_LARGEICON | SHGFI_USEFILEATTRIBUTES;
        IntPtr Result1;
        IntPtr Result2;
        Result1 = SHGetFileInfo(Path, 0, ref SHFI, size, SmallIconFlags);
        SHandle = SHFI.hIcon;
        Result2 = SHGetFileInfo(Path, 0, ref SHFI, size, LargeIconFlags);
        LHandle = SHFI.hIcon;
        int Result = Result1.ToInt32() + Result2.ToInt32();
        return Result;
    }'

$IconExtractor = Add-Type -MemberDefinition $IconExtractorSignature -Name "Methods" -Namespace Win32 -PassThru

My script contains a class where I want to make use of the [Win32.Methods] namespace that is defined in my "Module1.psm1". Simplified code:

###############
# Script1.ps1 #
###############

using module ".\Module1.psm1" #The module is located in the same directory

class CustomForm : System.Windows.Forms.Form
{
    CustomForm()
    {
        [System.IntPtr] $LHandle = [System.IntPtr]::new(0)
        [System.IntPtr] $SHandle = [System.IntPtr]::new(0)
        [Win32.Methods]::GetAssociatedIcons("C:", [ref] $LHandle, [ref] $SHandle) | Out-Null #Get the Icon associated with drive C:
        $this.Icon = [System.Drawing.Icon]::FromHandle($LHandle)
    }
}
[CustomForm]::new().ShowDialog()

It is not possible to run the Script1.ps1 because "Type [Win32.Methods] was not found."...

However, if I change my code in the following way it runs fine:

###############
# Script2.ps1 #
###############

using module ".\Module1.psm1" #The module is located in the same directory

$CustomForm = [System.Windows.Forms.Form]::new()

[System.IntPtr] $LHandle = [System.IntPtr]::new(0)
[System.IntPtr] $SHandle = [System.IntPtr]::new(0)
[Win32.Methods]::GetAssociatedIcons("C:", [ref] $LHandle, [ref] $SHandle) | Out-Null #Get the Icon associated with drive C:
$CustomForm.Icon = [System.Drawing.Icon]::FromHandle($LHandle)

$CustomForm.ShowDialog()

Could anyone please tell me how I get this running using the CustomForm-Class?


问:
Powershell - disable signature check
I have a scheduled task that runs at the same time everyday. It runs a small Powershell script that is unsigned. Since updating Windows 11 to 22H2, I get a prompt from the firewall that Powershell is attempting to connect to the Internet. It's trying to connect to sv.symcb.com or one of the Digicert sites so I assume that this is a cert check for an app signature but I'm not sure.

To be clear, the script does run and completes it's task. I just want it to stop trying to access the Internet. Is there anyway to stop Powershell from attempting to connect to the Internet when this script is ran?

Below are the arguments for the scheduled task:

```<code>-WindowStyle Hidden -NonInteractive -ExecutionPolicy Bypass -File "C:\path-to\script.ps1"
</code>```

Below is the script:

```<code>Param (
    # vCenter server & credintials
    [string]$VIServer = "192.168.224.123",
    [string]$User = 'administrator@vsphere.loc',
    [string]$Password = 'xxxxxxx',

    [string]$ConfigPath = "C:\path-to\backups\",
    [int]$Days = 21
)
Import-Module VMware.PowerCLI
$Time = Get-Date -Format "MM-dd-yy-hhmm"
If (-not (Test-Path $ConfigPath\Old))
{   New-Item $ConfigPath\Old -ItemType Directory
}
# Add date/time to the configuration file name and move to archive
ForEach ($File in (Get-ChildItem $ConfigPath\*.tgz))
{   $NewName = "$($File.Basename)-$Time.tgz"
    Copy-Item $File.FullName "$ConfigPath\Old\$NewName"
    Remove-Item $File.FullName
}
# Download latest configuration files
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Connect-VIServer $VIServer -User $User -Password $Password -Force
Get-VMHost | Get-VMHostFirmware -BackupConfiguration -DestinationPath $ConfigPath
# Remove older files in archive
ForEach ($File in (Get-ChildItem $ConfigPath\Old\*.tgz | Where LastWriteTime -LE (Get-Date).AddDays(-$Days)))
{   Remove-Item $File.FullName
}

# Disconnect from vCenter
Disconnect-VIServer -Server $VIServer -Confirm:$false
</code>```

Title: Powershell - disable signature check

Body:
I have a scheduled task that runs at the same time everyday. It runs a small Powershell script that is unsigned. Since updating Windows 11 to 22H2, I get a prompt from the firewall that Powershell is attempting to connect to the Internet. It's trying to connect to sv.symcb.com or one of the Digicert sites so I assume that this is a cert check for an app signature but I'm not sure.

To be clear, the script does run and completes it's task. I just want it to stop trying to access the Internet. Is there anyway to stop Powershell from attempting to connect to the Internet when this script is ran?

Below are the arguments for the scheduled task:

-WindowStyle Hidden -NonInteractive -ExecutionPolicy Bypass -File "C:\path-to\script.ps1"

Below is the script:

Param (
    # vCenter server & credintials
    [string]$VIServer = "192.168.224.123",
    [string]$User = 'administrator@vsphere.loc',
    [string]$Password = 'xxxxxxx',

    [string]$ConfigPath = "C:\path-to\backups\",
    [int]$Days = 21
)
Import-Module VMware.PowerCLI
$Time = Get-Date -Format "MM-dd-yy-hhmm"
If (-not (Test-Path $ConfigPath\Old))
{   New-Item $ConfigPath\Old -ItemType Directory
}
# Add date/time to the configuration file name and move to archive
ForEach ($File in (Get-ChildItem $ConfigPath\*.tgz))
{   $NewName = "$($File.Basename)-$Time.tgz"
    Copy-Item $File.FullName "$ConfigPath\Old\$NewName"
    Remove-Item $File.FullName
}
# Download latest configuration files
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Connect-VIServer $VIServer -User $User -Password $Password -Force
Get-VMHost | Get-VMHostFirmware -BackupConfiguration -DestinationPath $ConfigPath
# Remove older files in archive
ForEach ($File in (Get-ChildItem $ConfigPath\Old\*.tgz | Where LastWriteTime -LE (Get-Date).AddDays(-$Days)))
{   Remove-Item $File.FullName
}

# Disconnect from vCenter
Disconnect-VIServer -Server $VIServer -Confirm:$false


问:
SecKeychain: sign data with RSA PKCS1 PSS PADDING algorithm
I'm trying to implement c++ external PKI sign method for openvpn client.
I need to sign data with RSA_PKCS1_PSS_PADDING algorithm, but Security framework has no such method.

There is my function:

void MacStore::sign(const std::string &data, std::string &sig, const std::string &algorithm,
                    const std::string &hashalg, const std::string &saltlen) {
    SecKeyAlgorithm alg;
    if (!hashalg.empty()) {
        alg = kSecKeyAlgorithmRSASignatureDigestPSSSHA256;
    } else {
        alg = kSecKeyAlgorithmRSASignatureMessagePSSSHA1;
    }
    openvpn::BufferAllocated signdata(256, openvpn::BufferAllocated::GROW);
    openvpn::base64->decode(signdata, data);
    SecKeyRef pkey;
    OSStatus status = SecIdentityCopyPrivateKey((SecIdentityRef)identity, &pkey);
    if (status) {
        // error
        return;
    }
    auto isSupported = SecKeyIsAlgorithmSupported(pkey, kSecKeyOperationTypeSign, alg);
    std::cout << (isSupported ? "supported" : "not supported") << std::endl;
    auto dataToSign = CFStringCreateWithCString(nullptr, buf_c_str(signdata), kCFStringEncodingASCII);
    auto dataToSignPtr = CFStringCreateExternalRepresentation(nullptr, dataToSign, kCFStringEncodingASCII, 0);

    CFErrorRef err = nullptr;
    auto signature = SecKeyCreateSignature(pkey, alg, dataToSignPtr, &err);
    if (err) {
        return;
    }

    SecCertificateRef cert;
    SecIdentityCopyCertificate((SecIdentityRef)identity, &cert);
    SecKeyRef pub;
    SecCertificateCopyPublicKey(cert, &pub);

    int signatureLength = CFDataGetLength(signature);
    openvpn::BufferAllocated signer(signatureLength, openvpn::BufferAllocated::ARRAY);
    auto range = CFRangeMake(0, signatureLength);
    CFDataGetBytes(signature, range, signer.data());
    signer.set_size(signatureLength);

    CFRelease(signature);
    CFRelease(dataToSign);

    sig = openvpn::base64->encode(signer);
    std::cout << "SIGNATURE[" << signatureLength << "]: " << signer.c_str() << std::endl;
}
```
<p>On connect server log prints:</p>
```// Verifies certificate - OK
OpenSSL: error:02000087:rsa routines::salt length recovery failed
Dec 09 12:51:38 server openvpn[29669]: 10.31.154.84:50843 OpenSSL: error:1C880004:Provider routines::RSA lib
Dec 09 12:51:38 server openvpn[29669]: 10.31.154.84:50843 OpenSSL: error:0A00007B:SSL routines::bad signature
Dec 09 12:51:38 server openvpn[29669]: 10.31.154.84:50843 TLS_ERROR: BIO read tls_read_plaintext error
Dec 09 12:51:38 server openvpn[29669]: 10.31.154.84:50843 TLS Error: TLS object -> incoming plaintext read error
Dec 09 12:51:38 server openvpn[29669]: 10.31.154.84:50843 TLS Error: TLS handshake failed
Dec 09 12:51:38 server openvpn[29669]: 10.31.154.84:50843 Fatal TLS error (check_tls_errors_co), restarting
Dec 09 12:51:38 server openvpn[29669]: 10.31.154.84:50843 SIGUSR1[soft,tls-error] received, client-instance restarting
```

My question is: which SecAlgorithm should I choose to produce valid rsa signature?

UPD: Verify method with same data to sign returns false(invalid signature) as well...

Body:
I'm trying to implement c++ external PKI sign method for openvpn client.
I need to sign data with RSA_PKCS1_PSS_PADDING algorithm, but Security framework has no such method.

There is my function:

void MacStore::sign(const std::string &data, std::string &sig, const std::string &algorithm,
                    const std::string &hashalg, const std::string &saltlen) {
    SecKeyAlgorithm alg;
    if (!hashalg.empty()) {
        alg = kSecKeyAlgorithmRSASignatureDigestPSSSHA256;
    } else {
        alg = kSecKeyAlgorithmRSASignatureMessagePSSSHA1;
    }
    openvpn::BufferAllocated signdata(256, openvpn::BufferAllocated::GROW);
    openvpn::base64->decode(signdata, data);
    SecKeyRef pkey;
    OSStatus status = SecIdentityCopyPrivateKey((SecIdentityRef)identity, &pkey);
    if (status) {
        // error
        return;
    }
    auto isSupported = SecKeyIsAlgorithmSupported(pkey, kSecKeyOperationTypeSign, alg);
    std::cout << (isSupported ? "supported" : "not supported") << std::endl;
    auto dataToSign = CFStringCreateWithCString(nullptr, buf_c_str(signdata), kCFStringEncodingASCII);
    auto dataToSignPtr = CFStringCreateExternalRepresentation(nullptr, dataToSign, kCFStringEncodingASCII, 0);

    CFErrorRef err = nullptr;
    auto signature = SecKeyCreateSignature(pkey, alg, dataToSignPtr, &err);
    if (err) {
        return;
    }

    SecCertificateRef cert;
    SecIdentityCopyCertificate((SecIdentityRef)identity, &cert);
    SecKeyRef pub;
    SecCertificateCopyPublicKey(cert, &pub);

    int signatureLength = CFDataGetLength(signature);
    openvpn::BufferAllocated signer(signatureLength, openvpn::BufferAllocated::ARRAY);
    auto range = CFRangeMake(0, signatureLength);
    CFDataGetBytes(signature, range, signer.data());
    signer.set_size(signatureLength);

    CFRelease(signature);
    CFRelease(dataToSign);

    sig = openvpn::base64->encode(signer);
    std::cout << "SIGNATURE[" << signatureLength << "]: " << signer.c_str() << std::endl;
}

On connect server log prints:

// Verifies certificate - OK
OpenSSL: error:02000087:rsa routines::salt length recovery failed
Dec 09 12:51:38 server openvpn[29669]: 10.31.154.84:50843 OpenSSL: error:1C880004:Provider routines::RSA lib
Dec 09 12:51:38 server openvpn[29669]: 10.31.154.84:50843 OpenSSL: error:0A00007B:SSL routines::bad signature
Dec 09 12:51:38 server openvpn[29669]: 10.31.154.84:50843 TLS_ERROR: BIO read tls_read_plaintext error
Dec 09 12:51:38 server openvpn[29669]: 10.31.154.84:50843 TLS Error: TLS object -> incoming plaintext read error
Dec 09 12:51:38 server openvpn[29669]: 10.31.154.84:50843 TLS Error: TLS handshake failed
Dec 09 12:51:38 server openvpn[29669]: 10.31.154.84:50843 Fatal TLS error (check_tls_errors_co), restarting
Dec 09 12:51:38 server openvpn[29669]: 10.31.154.84:50843 SIGUSR1[soft,tls-error] received, client-instance restarting

My question is: which SecAlgorithm should I choose to produce valid rsa signature?

UPD: Verify method with same data to sign returns false(invalid signature) as well...


问:
Unique constraint in my model in my django project?
I would like to configure my Teacher model so that I can have several teachers with the same name, the same age but different departments
How to do ?

```<code>class Teacher(models.Model):
    name=models.CharField(max_length=70)
    age=models.IntegerField()
    service=models.CharField(max_length=100)
</code>```

Exemple output on my database :

```<code>Name                   Age                     Service
Arnaud                 29                      Science
Carmen                 37                      Medecine
Arnaud                 29                      Geologie
Carmen                 37                      Science
</code>```

Body:
I would like to configure my Teacher model so that I can have several teachers with the same name, the same age but different departments
How to do ?

class Teacher(models.Model):
    name=models.CharField(max_length=70)
    age=models.IntegerField()
    service=models.CharField(max_length=100)

Exemple output on my database :

Name                   Age                     Service
Arnaud                 29                      Science
Carmen                 37                      Medecine
Arnaud                 29                      Geologie
Carmen                 37                      Science


问:
How to create parsing function with two arguments in Haskell that uses currying
I want to create a function in Haskell that parses a 'variable' such that I consume all that is parsed up to a point at which space begins as would be the case in declaring a variable someVar = 4 I am trying to use endBy1. As seen here however it takes p sep as arguments where p is what is to be parsed and sep the seperator.

Normally I would use currying when parsing, such as in

```<code>space :: Parser Char
space = satisfy isSpace
</code>```

Considering that I have two arguments in the task at hand, how do I implement a function that take currying into consideration but parses p based on currying whereas the seperater sep will be determined by a fixed argument. I have tried creating the following helperfunction (the equivalent of flip I suspect), that I could then put in a do block to parse such as seen below:

```<code>helpersep :: Parser a -> Parser a -> Parser [a]
helpersep sep str = sepBy str sep
</code>```

Do block to put it in.

```<code>pIdent :: Parser a
pIdent = (do
            s <- get
            until <- (helpersep isSpace)
            return until)
</code>```

I get the following output:

```<code>error:
    * Couldn't match expected type: ReadP [Char]
                  with actual type: Parser a0 -> Parser [a0]
    * Probable cause: `helpersep' is applied to too few arguments
      In a stmt of a 'do' block: until <- (helpersep isSpace)
      In the expression:
        do s <- get
           until <- (helpersep isSpace)
           if isDigit s then
               pfail
           else
               if (read (s : until)) `elem` [...] then
                   pfail
               else
                   (do rest <- many (satisfy isPrint)
                       ....)
      In an equation for `pIdent':
          pIdent
            = (do s <- get
                  until <- (helpersep isSpace)
                  if isDigit s then
                      pfail
                  else
                      if (read (s : until)) `elem` [...] then
                          pfail
                      else
                          (do rest <- many (satisfy isPrint)
                              ....))
    |
163 |             until <- (helpersep isSpace) -
</code>```

There might be an entirely different way of working around this rather than using currying, I am however very curious to the latter approach since I suspect it will give me a better understanding of Haskell.

Body:
I want to create a function in Haskell that parses a 'variable' such that I consume all that is parsed up to a point at which space begins as would be the case in declaring a variable someVar = 4 I am trying to use endBy1. As seen here however it takes p sep as arguments where p is what is to be parsed and sep the seperator.

Normally I would use currying when parsing, such as in

space :: Parser Char
space = satisfy isSpace

Considering that I have two arguments in the task at hand, how do I implement a function that take currying into consideration but parses p based on currying whereas the seperater sep will be determined by a fixed argument. I have tried creating the following helperfunction (the equivalent of flip I suspect), that I could then put in a do block to parse such as seen below:

helpersep :: Parser a -> Parser a -> Parser [a]
helpersep sep str = sepBy str sep

Do block to put it in.

pIdent :: Parser a
pIdent = (do
            s <- get
            until <- (helpersep isSpace)
            return until)

I get the following output:

error:
    * Couldn't match expected type: ReadP [Char]
                  with actual type: Parser a0 -> Parser [a0]
    * Probable cause: `helpersep' is applied to too few arguments
      In a stmt of a 'do' block: until <- (helpersep isSpace)
      In the expression:
        do s <- get
           until <- (helpersep isSpace)
           if isDigit s then
               pfail
           else
               if (read (s : until)) `elem` [...] then
                   pfail
               else
                   (do rest <- many (satisfy isPrint)
                       ....)
      In an equation for `pIdent':
          pIdent
            = (do s <- get
                  until <- (helpersep isSpace)
                  if isDigit s then
                      pfail
                  else
                      if (read (s : until)) `elem` [...] then
                          pfail
                      else
                          (do rest <- many (satisfy isPrint)
                              ....))
    |
163 |             until <- (helpersep isSpace) -

There might be an entirely different way of working around this rather than using currying, I am however very curious to the latter approach since I suspect it will give me a better understanding of Haskell.


问:
failed to limit the number of results when using group by in TDengine
I want to limit the result of a query in TDengine. My sql statement is as follows:

```<code>SELECT last_row(*),tel_device_id FROM geo WHERE account_id_cp IN (...)
GROUP BY tel_device_id LIMIT 2000
</code>```

However, the result is more than 2000. I cannot tell how to solve it.

Body:
I want to limit the result of a query in TDengine. My sql statement is as follows:

SELECT last_row(*),tel_device_id FROM geo WHERE account_id_cp IN (...)
GROUP BY tel_device_id LIMIT 2000

However, the result is more than 2000. I cannot tell how to solve it.


问:
C++ cURL JSON error 3221226356 more then one time
Hi i got problem with API call when i try to send request secount time (while loop in main.cpp from sqlDB), for the first time everything is ok, but secount request get good JSON response but after that my problem close with

```<code>Process exited after 80.64 seconds with return value 3221226356
</code>```

full console screen
Api call script:

```<code>#include <iostream>
#include <string>
#include <stdio.h>
#include <curl/curl.h>
#include <fstream>
#include "json.hpp"
#include <sstream>
#include <windows.h>

//
using namespace std;

struct MemoryStruct {
    char *memory;
    size_t size;
};

static size_t
WriteMemoryCallback(void *contents, size_t size, size_t nmemb, void *userp)
{
    size_t realsize = size * nmemb;
    struct MemoryStruct *mem = (struct MemoryStruct *)userp;

    mem->memory = (char*)realloc(mem->memory, mem->size + realsize + 1);
    if (mem->memory == NULL) {
        /* out of memory! */
        printf("not enough memory (realloc returned NULL)\n");
        return 0;
    }

    memcpy(&(mem->memory[mem->size]), contents, realsize);
    mem->size += realsize;
    mem->memory[mem->size] = 0;
    return realsize;
}

double api_call(string asin){

    struct MemoryStruct chunk;

    string link = "https://api.rainforestapi.com/request?api_key=xxx";
    link += asin;
    link += "&type=offers";
    int n = link.length();
    char link_char[n + 1];
    strcpy(link_char, link.c_str());

    chunk.memory = (char*)malloc(1);  /* will be grown as needed by the realloc above */
    chunk.size = 0;    /* no data at this point */
    CURL *curl;
    CURLcode res;
    char* curlErrStr = (char*)malloc(CURL_ERROR_SIZE);
    curl = curl_easy_init();
    curl_slist* httpHeaders = NULL;
    if(curl)
    {

    curl_easy_setopt(curl, CURLOPT_URL, link_char);

    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);
    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
    curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
    curl_easy_setopt(curl, CURLOPT_USERAGENT, "libcurl-agent/1.0");
    curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
    /* get it! */

    curl_easy_perform(curl);
    curl_easy_cleanup(curl);
    curl_global_cleanup();
    }

    ofstream oplik;
    oplik.open("test.json");
    oplik << chunk.memory;
    oplik.close();
    if (chunk.memory){
        free(chunk.memory);
    }

    ifstream fJson("test.json");
    stringstream buffer;
    buffer << fJson.rdbuf();
    auto json = nlohmann::json::parse(buffer.str());
    double price = json["offers"][0]["price"]["value"];
    fJson.close();
    return(price);

}
</code>```

I add printf to see where it crash

```<code>printf("4");
curl_global_cleanup();
printf("5");
</code>```

and i can see 4 but not 5, so i think cleanup() crush console, any idea ?

It is test so code is not good but works :)

Maybe someone can find whats wrong cuz i cant ;/

Body:
Hi i got problem with API call when i try to send request secount time (while loop in main.cpp from sqlDB), for the first time everything is ok, but secount request get good JSON response but after that my problem close with

Process exited after 80.64 seconds with return value 3221226356

full console screen
Api call script:

#include <iostream>
#include <string>
#include <stdio.h>
#include <curl/curl.h>
#include <fstream>
#include "json.hpp"
#include <sstream>
#include <windows.h>

//
using namespace std;

struct MemoryStruct {
    char *memory;
    size_t size;
};

static size_t
WriteMemoryCallback(void *contents, size_t size, size_t nmemb, void *userp)
{
    size_t realsize = size * nmemb;
    struct MemoryStruct *mem = (struct MemoryStruct *)userp;

    mem->memory = (char*)realloc(mem->memory, mem->size + realsize + 1);
    if (mem->memory == NULL) {
        /* out of memory! */
        printf("not enough memory (realloc returned NULL)\n");
        return 0;
    }

    memcpy(&(mem->memory[mem->size]), contents, realsize);
    mem->size += realsize;
    mem->memory[mem->size] = 0;
    return realsize;
}

double api_call(string asin){

    struct MemoryStruct chunk;

    string link = "https://api.rainforestapi.com/request?api_key=xxx";
    link += asin;
    link += "&type=offers";
    int n = link.length();
    char link_char[n + 1];
    strcpy(link_char, link.c_str());

    chunk.memory = (char*)malloc(1);  /* will be grown as needed by the realloc above */
    chunk.size = 0;    /* no data at this point */
    CURL *curl;
    CURLcode res;
    char* curlErrStr = (char*)malloc(CURL_ERROR_SIZE);
    curl = curl_easy_init();
    curl_slist* httpHeaders = NULL;
    if(curl)
    {

    curl_easy_setopt(curl, CURLOPT_URL, link_char);

    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);
    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
    curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
    curl_easy_setopt(curl, CURLOPT_USERAGENT, "libcurl-agent/1.0");
    curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
    /* get it! */

    curl_easy_perform(curl);
    curl_easy_cleanup(curl);
    curl_global_cleanup();
    }

    ofstream oplik;
    oplik.open("test.json");
    oplik << chunk.memory;
    oplik.close();
    if (chunk.memory){
        free(chunk.memory);
    }

    ifstream fJson("test.json");
    stringstream buffer;
    buffer << fJson.rdbuf();
    auto json = nlohmann::json::parse(buffer.str());
    double price = json["offers"][0]["price"]["value"];
    fJson.close();
    return(price);

}

I add printf to see where it crash

printf("4");
curl_global_cleanup();
printf("5");

and i can see 4 but not 5, so i think cleanup() crush console, any idea ?

It is test so code is not good but works :)

Maybe someone can find whats wrong cuz i cant ;/


问:
how to make a multi recycler adapter to display such data (today(list 1), yesterday(list 2),earlier(list 3)?

I get 3 different lists that I need to display on the screen

I didn't find an answer on the forums that suits me


问:
Can v-tooltip toggle tooltip content visibility by clicking?
I'm using v-tooltip plugin that needs to work on mobile devices. Naturally, I had to change trigger since it can't trigger hover on a mobile device.

```<code><div
  class="my-tooltip"
  v-tooltip.top="{
    trigger: 'click',
    content: tooltipContent,
  }">
</div>
</code>```

Is it possible to make tooltip content toggle visibility clicking on the same element (div in my case)?

I thought hideOnTargetClick: true option would make that possible.

Body:
I'm using v-tooltip plugin that needs to work on mobile devices. Naturally, I had to change trigger since it can't trigger hover on a mobile device.

Is it possible to make tooltip content toggle visibility clicking on the same element (div in my case)?

I thought hideOnTargetClick: true option would make that possible.


问:
How to get Google Calendar API working in production to create an event
Problem I'm trying to solve: Using Google Calendar API to create a calendar event. It works on locahost but not in production following the Google Documentation. I'm looking for a solution to get it working in production.

What I've tried: I've spent a long time looking at solutions on here including this popular one: Google Calendar API authorization working on localhost but not on Heroku but for me I'm not using pickle. I also attempted all the relevant changes in the answer in relation to my code but I still could not get it to work. I have also made sure that my API console includes the relevant permissions.

What's happening:
Terminal logs are showing that my code attempts to open a browser on the server machine "Please visit this URL to authorize this application" instead of popping up a browser window for the user. This is most likely because my first try block is failing - which I think is where the problem lies.

Please also note I have replaced my redirect URL in the code below for privacy reasons to myurl.com/calendar/. The redirect is simply set to the same page where I am running the code from.

Google API Code:

```<code>SCOPES = ['https://www.googleapis.com/auth/calendar']
# I also tried ['https://www.googleapis.com/auth/drive.metadata.readonly']

def create_calendar_event():

creds = None

if os.path.exists('../token.json'):
  creds = Credentials.from_authorized_user_file('../token.json', SCOPES)
  print("Obtained credentials")

# If there are no (valid) credentials available, let the user log in.

if not creds or not creds.valid:
  if creds and creds.expired and creds.refresh_token:
    creds.refresh(Request())
  else:
    try:

      ## This is the production flow ##

      flow = google_auth_oauthlib.flow.Flow.from_client_secrets_file('/secrets/secret-location/credentials.json', SCOPES)
      flow.redirect_uri = "myurl.com/calendar/"
      authorization_url, state = flow.authorization_url(access_type='offline', include_granted_scopes='true')

    except:
      print("Could not obtain credentials in production mode")

    try:

      ## This is the localhost/testing flow ##

      flow = InstalledAppFlow.from_client_secrets_file(
            '../credentials.json', SCOPES)
      print("Obtained Google Credentials from local file")
      creds = flow.run_local_server(port=0)

      with open('../token.json', 'w') as token:
        token.write(creds.to_json())

    except:
      print("Could not obtain credentials in localhost flow")

service = build('calendar', 'v3', credentials=creds)

# remainder of code to create event quite bulky so removed,
# at this point the Google popup should ask for sign in.
</code>```

Body:
Problem I'm trying to solve: Using Google Calendar API to create a calendar event. It works on locahost but not in production following the Google Documentation. I'm looking for a solution to get it working in production.

What I've tried: I've spent a long time looking at solutions on here including this popular one: Google Calendar API authorization working on localhost but not on Heroku but for me I'm not using pickle. I also attempted all the relevant changes in the answer in relation to my code but I still could not get it to work. I have also made sure that my API console includes the relevant permissions.

What's happening:
Terminal logs are showing that my code attempts to open a browser on the server machine "Please visit this URL to authorize this application" instead of popping up a browser window for the user. This is most likely because my first try block is failing - which I think is where the problem lies.

Please also note I have replaced my redirect URL in the code below for privacy reasons to myurl.com/calendar/. The redirect is simply set to the same page where I am running the code from.

Google API Code:

SCOPES = ['https://www.googleapis.com/auth/calendar']
# I also tried ['https://www.googleapis.com/auth/drive.metadata.readonly']

def create_calendar_event():

creds = None

if os.path.exists('../token.json'):
  creds = Credentials.from_authorized_user_file('../token.json', SCOPES)
  print("Obtained credentials")

# If there are no (valid) credentials available, let the user log in.

if not creds or not creds.valid:
  if creds and creds.expired and creds.refresh_token:
    creds.refresh(Request())
  else:
    try:

      ## This is the production flow ##

      flow = google_auth_oauthlib.flow.Flow.from_client_secrets_file('/secrets/secret-location/credentials.json', SCOPES)
      flow.redirect_uri = "myurl.com/calendar/"
      authorization_url, state = flow.authorization_url(access_type='offline', include_granted_scopes='true')

    except:
      print("Could not obtain credentials in production mode")

    try:

      ## This is the localhost/testing flow ##

      flow = InstalledAppFlow.from_client_secrets_file(
            '../credentials.json', SCOPES)
      print("Obtained Google Credentials from local file")
      creds = flow.run_local_server(port=0)

      with open('../token.json', 'w') as token:
        token.write(creds.to_json())

    except:
      print("Could not obtain credentials in localhost flow")

service = build('calendar', 'v3', credentials=creds)

# remainder of code to create event quite bulky so removed,
# at this point the Google popup should ask for sign in.