!ycQaniQUpWrKNZyovx:librem.one

Python

369 Members
Chat about the programming language Python.35 Servers

Load older messages


SenderMessageTime
3 Feb 2023
@a_ya:matrix.org@a_ya:matrix.org joined the room.18:57:10
@a_ya:matrix.org@a_ya:matrix.org left the room.18:58:00
4 Feb 2023
@raj27:matrix.org@raj27:matrix.org joined the room.05:17:03
@raj27:matrix.org@raj27:matrix.org left the room.05:39:20
6 Feb 2023
@adriqt:tchncs.de@adriqt:tchncs.de joined the room.23:09:29
@adriqt:tchncs.de@adriqt:tchncs.de changed their display name from adriqt to adrian rodriguez.23:12:15
@adriqt:tchncs.de@adriqt:tchncs.de changed their display name from adrian rodriguez to adrian.23:13:55
@adriqt:tchncs.de@adriqt:tchncs.de set a profile picture.23:25:05
7 Feb 2023
@adriqt:tchncs.de@adriqt:tchncs.de changed their profile picture.03:41:46
11 Feb 2023
@adriqt:tchncs.de@adriqt:tchncs.de changed their profile picture.17:20:27
18 Feb 2023
@commie:wetfish.chat@commie:wetfish.chat changed their display name from commie to bigMcommie.17:13:12
19 Feb 2023
@commie:wetfish.chat@commie:wetfish.chat changed their display name from bigMcommie to commie.05:21:41
20 Feb 2023
@enessgurkan:librem.oneenessgurkan joined the room.07:32:57
23 Feb 2023
@adriqt:tchncs.de@adriqt:tchncs.de changed their display name from adrian to adrián.01:57:16
@name_missing:matrix.orgname_missingIm having difficulty using PYTHONPATH. Does anyone have tips on how to use custom package paths with it?14:44:23
@torped:librem.onetorpedAre you using python inside a flatpak?16:29:47
@name_missing:matrix.orgname_missingNo, Windows and Linux. I got it to work with a bash script. But for some reason im getting module not found if i use subprocess.21:55:29
@adriqt:tchncs.de@adriqt:tchncs.de left the room.22:28:22
24 Feb 2023
@torped:librem.onetorpedHow are you using the sub-process?14:14:02
@name_missing:matrix.orgname_missingLets see if i can get a minimum example running.18:43:39
@name_missing:matrix.orgname_missing
ef run_application(
		application: Pathed,
		arguments: List[Pathed],
		environment: Dict[str, str] = None
) -> subprocess.CompletedProcess:
	if not Path(application).exists():
		raise FileNotFoundError(f'{application}')
	process_arguments = [f'{application}', *arguments]
	information('Starting child process.', [process_arguments, environment])
	result = subprocess.run(
		process_arguments,
		env=environment,
		stderr=sys.stderr,
		stdout=subprocess.DEVNULL,
		stdin=subprocess.DEVNULL
	)
19:43:26
@name_missing:matrix.orgname_missing *
def run_application(
		application: Pathed,
		arguments: List[Pathed],
		environment: Dict[str, str] = None
) -> subprocess.CompletedProcess:
	if not Path(application).exists():
		raise FileNotFoundError(f'{application}')
	process_arguments = [f'{application}', *arguments]
	information('Starting child process.', [process_arguments, environment])
	result = subprocess.run(
		process_arguments,
		env=environment
	)
19:43:45
@name_missing:matrix.orgname_missing *
def run_application(
		application: Pathed,
		arguments: List[Pathed],
		environment: Dict[str, str] = None
) -> subprocess.CompletedProcess:
	if not Path(application).exists():
		raise FileNotFoundError(f'{application}')
	process_arguments = [f'{application}', *arguments]
	information('Starting child process.', [process_arguments, environment])
	result = subprocess.run(
		process_arguments,
		env=environment
	)return result
19:43:57
@name_missing:matrix.orgname_missing *
def run_application(
		application: Pathed,
		arguments: List[Pathed],
		environment: Dict[str, str] = None
) -> subprocess.CompletedProcess:
	if not Path(application).exists():
		raise FileNotFoundError(f'{application}')
	process_arguments = [f'{application}', *arguments]
	information('Starting child process.', [process_arguments, environment])
	result = subprocess.run(
		process_arguments,
		env=environment
	)
	return result
19:44:13
25 Feb 2023
@name_missing:matrix.orgname_missing

This one works, so time to search for differences.

import os
import subprocess
from pathlib import Path


PYTHON_PATH: str = 'PYTHONPATH'


def main():
	current = Path.cwd()

	library = current.joinpath('venv', 'python3.9', 'site-packages')
	interpreter = current.joinpath('venv', 'bin', 'python')
	project = current.joinpath('test')

	package = 'some.package.path'

	filtered = {
		key: value
		for key, value
		in os.environ.items()
		if key != PYTHON_PATH
	}
	environment = {
		PYTHON_PATH: f'{project}',
		**filtered
	}

	arguments = [
		interpreter,
		'-m',
		package
	]

	subprocess.run(
		arguments,
		env=environment
	)


if __name__ == '__main__':
	main()

12:20:54
28 Feb 2023
@name_missing:matrix.orgname_missingAt last i know the cause now. The debugger from Pycharm is using the wrong environment in child processes. Which triggers a design flaw in Pythons fake name space system. Exactly the reason why i wanted to use VENV in the first place. 😆 16:37:59
@torped:librem.onetorpedGlad you worked through it!16:44:17
3 Mar 2023
@ovoki:matrix.org@ovoki:matrix.org joined the room.14:29:44
@ovoki:matrix.org@ovoki:matrix.org left the room.14:29:58
9 Mar 2023
@pwood22:matrix.orgPaul Wood joined the room.06:39:01

Show newer messages


Back to Room ListRoom Version: 1