Jump to content

Module 'certifi' not found on VW2023 / Windows 10 Pro OS


Paolo

Recommended Posts

Recently I have released a plugin through Gumroad® called Arches.

This plugin written in Python contains a licensing algorithm that queries Gumroad through an url request.

The Python modules required are the following:

import certifi
import ssl
import json
from urllib import request, parse, error

and the core request is the following:

def licenseCheck(license_key, user_email, productID):

	context = ssl.create_default_context(cafile=certifi.where())
	webConnection = testInternet()
	
	url_ = "https://api.gumroad.com/v2/licenses/verify"
	pf_permalink = productID
	params = {'product_permalink': pf_permalink, 'license_key': license_key}
	data=parse.urlencode(params).encode('ascii')

	req = request.Request(url_, data=data)
	try:
	  response = request.urlopen(req, context=context)
	  get_response = json.loads(response.read())
	except: # error.HTTPError as e: get_response = json.loads(e.read())
		get_response ={'success': False, 'purchase': {'email': user_email, 'license_key': license_key}}

	status = False
	if get_response['success'] and get_response['purchase']['email'].lower() == user_email.lower():
	  status = True
	else:
	  get_response = "Failed to verify the license."

	return status, get_response , license_key, webConnection

 

I have deeply tested it on my Mac and upon success I started to sell it.

Nowadays I collected some customers and just one of them got the message

ModuleNot FoundError: No module named 'certifi

I am in contact with this user and I know he runs VW2023 / Windows 10 Pro OS.

I have let him make some tests and the weird thing is that while receiving the module not found message, neither he is able to install it (through Marionette.VerifyOrGetLib) because certifi is already installed.

 

I am still waiting other tests I have requested, and in the meanwhile I am asking @Vlado or @K.Lalkovski or any other expert, if the simple script:

import certifi
vs.Message(certifi.where())

gives error (module not found) or, as in my case (macOS) the module path inside Vectorworks / Python:

/Applications/Vectorworks 2023 IT/Vectorworks 2023.app/Contents/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/certifi/cacert.pem

 

Thank you in advance

Link to comment

I should have fixed the problem avoiding to use the 'certifi' module:

context = ssl.create_default_context(cafile=certifi.where())

has been replaced with:

context = ssl.create_default_context()
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE

On my mac works well, I am waiting the result on the VW2023 / Windows 10 Pro OS that was giving trouble…

 

P.S.:

I have just received a positive response that the new code works fine also on Win 10.

Edited by Paolo
Updated info
  • Like 1
Link to comment
  • Vectorworks, Inc Employee

Hi @Paolo,

I saw you have already found a solution, but here is an example on Windows that finds package certifi. Just open vwx file and run find certifi node. The problem with the module not being found is that certifi for VW2023(Win) is not a direct descendant of the 'site-packages' folder and just the path to certifi needs to be added at runtime.

 

 

testcertifipresence.vwx

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...