[issue22213] Make pyvenv style virtual environments easier to configure when embedding Python

2019-10-17 Thread PyScripter


PyScripter  added the comment:

To Steve:

I want the embedded venv to have the same sys.path as if you were running the 
venv python interpreter.  So my method takes into account for instance the 
include-system-site-packages option in pyvenv.cfg.  Also my method sets 
sys.prefix in the same way as the venv python interpreter.

--

___
Python tracker 
<https://bugs.python.org/issue22213>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22213] Make pyvenv style virtual environments easier to configure when embedding Python

2019-10-17 Thread PyScripter


PyScripter  added the comment:

Just in case this will be of help to anyone, I found a way to use venvs in 
embedded python.

- You first need to Initialize python that is referred as home in pyvenv.cfg.
- Then you execute the following script:

import sys
sys.executable = r"Path to the python executable inside the venv"
path = sys.path
for i in range(len(path)-1, -1, -1):
if path[i].find("site-packages") > 0:
path.pop(i)
import site
site.main()
del sys, path, i, site

--

___
Python tracker 
<https://bugs.python.org/issue22213>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38398] PyUnicode functions are not exported by python 2 in Ubuntu

2019-10-07 Thread PyScripter


PyScripter  added the comment:

>>> sys.version
'2.7.16 (default, Oct  7 2019, 17:16:30) \n[GCC 7.4.0]'
>>> ctypes.pythonapi.PyUnicodeUCS4_FromWideChar
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python2.7/ctypes/__init__.py", line 379, in __getattr__
func = self.__getitem__(name)
  File "/usr/local/lib/python2.7/ctypes/__init__.py", line 384, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: python2.7: undefined symbol: PyUnicodeUCS4_FromWideChar
>>>

--

___
Python tracker 
<https://bugs.python.org/issue38398>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38398] PyUnicode functions are not exported by python 2 in Ubuntu

2019-10-07 Thread PyScripter


PyScripter  added the comment:

Is this on Ubuntu?

--

___
Python tracker 
<https://bugs.python.org/issue38398>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38398] PyUnicode functions are not exported by python 2 in Ubuntu

2019-10-07 Thread PyScripter


PyScripter  added the comment:

I meant PyUnicodeUCS4_FromWideChar PyUnicodeUCS2_FromWideChar.

--

___
Python tracker 
<https://bugs.python.org/issue38398>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38398] PyUnicode functions are not exported by python 2 in Ubuntu

2019-10-07 Thread PyScripter


PyScripter  added the comment:

To Victor:

Neither of PyUnicodeUCS2_FromWideChar or PyUnicodeUCS4_FromWideChar is exported.

>>> import ctypes
>>> hasattr(ctypes.pythonapi, "PyUnicode_FromWideChar")
>>> hasattr(ctypes.pythonapi, "PyUnicodeUSC4_FromWideChar")
>>> hasattr(ctypes.pythonapi, "PyUnicodeUSC2_FromWideChar")

all return false on Ubuntu.

--

___
Python tracker 
<https://bugs.python.org/issue38398>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38398] PyUnicode functions are not exported by python 2 in Ubuntu

2019-10-07 Thread PyScripter

New submission from PyScripter :

As per title PyUnicode functions, such as PyUnicode_FromWideChar, are not 
exported on Ubuntu and possibly other Linux systems.  This is a show stopper 
for embedded Python.

To confirm:

>>> import ctypes
>>> hasattr(ctypes.pythonapi, "PyUnicode_FromWideChar")

It should return True, but it returns False.  

I have tested with the default Ubuntu python 2.7.15 and with compiled python 
2.7.16.

Note that the problem does not exist in python3 and also python 2.7 and 3.x in 
Windows.  So it is only python 2.7 in Ubuntu.

--
components: Library (Lib)
messages: 354105
nosy: pyscripter
priority: normal
severity: normal
status: open
title: PyUnicode functions are not exported by python 2 in Ubuntu
type: crash
versions: Python 2.7

___
Python tracker 
<https://bugs.python.org/issue38398>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22213] Make pyvenv style virtual environments easier to configure when embedding Python

2019-09-20 Thread PyScripter


PyScripter  added the comment:

To Victor:
So how does the implementation of PEP-587 help configure embedded python with 
venv?  It would be great help to provide some minimal instructions.

--
nosy: +pyscripter

___
Python tracker 
<https://bugs.python.org/issue22213>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37633] Py_CompileString and PyParser_SimpleParseString not exported in python38.dll

2019-07-20 Thread PyScripter


PyScripter  added the comment:

Py_CompileStringFlags is not exported either.

--

___
Python tracker 
<https://bugs.python.org/issue37633>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37633] Py_CompileString and PyParser_SimpleParseString not exported in python38.dll

2019-07-19 Thread PyScripter


New submission from PyScripter :

Py_CompileString and PyParser_SimpleParseString and possibly other related 
functions are not exported in Python 3.8 b2 DLL.  This is unintentional, not 
documented and unnecessarily breaks backward compatibility.

Issue 37189 was similar and related to PyRun_String.  This was fixed in Python 
3.8b2. Please provide fixes to the above two functions as well.  

To confirm the error:
>>> import ctypes
>>> api = ctypes.pythonapi
>>> hasattr(api, "PyParser_SimpleParseString")
False
>>> hasattr(api2, "Py_CompileString")
False

--
components: Windows
messages: 348198
nosy: paul.moore, pyscripter, steve.dower, tim.golden, vstinner, zach.ware
priority: normal
severity: normal
status: open
title: Py_CompileString and PyParser_SimpleParseString not exported in 
python38.dll
versions: Python 3.8

___
Python tracker 
<https://bugs.python.org/issue37633>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37189] PyRun_String not exported in python38.dll

2019-06-16 Thread PyScripter


PyScripter  added the comment:

This does break PyScripter Python for Delphi as well.  The question whether 
this change was intentional in which case it would need to be explained and 
documented, or accidental and will be reversed begs an answer.

--
nosy: +pyscripter

___
Python tracker 
<https://bugs.python.org/issue37189>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35706] Make it easier to use a venv with an embedded Python interpreter

2019-02-04 Thread PyScripter


PyScripter  added the comment:

This issue is related (duplicate) to https://bugs.python.org/issue22213.
It appears that there is a workaround but only for Linux using 
Py_SetProgramName.  I wish that there was some similar way for Windows.

--
nosy: +ncoghlan, pitrou

___
Python tracker 
<https://bugs.python.org/issue35706>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35706] Make it easier to use a venv with an embedded Python interpreter

2019-02-04 Thread PyScripter


PyScripter  added the comment:

"Personally, I am 100% against letting an embedded runtime automatically pick 
up any settings from the environment. You don't know where they came from."

Why is that?  When the embedding application is using Py_SetPythonHome there is 
clear intent to use a specific python setup.  This is no different to using any 
other Python setup.  Why venvs should be treated differently that standard 
installations?

As to manually setting the path, why pass the burden to the embedding 
application.  The idea is that python, in the embedding application, should 
work as in the python executable.   Trying to match the complex and evolving 
algorithms that python uses to setup the path, is a huge and unnecessary burden 
on the embedding application.

--

___
Python tracker 
<https://bugs.python.org/issue35706>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35706] Make it easier to use a venv with an embedded Python interpreter

2019-02-03 Thread PyScripter


PyScripter  added the comment:

I don't see how pep-0582 is related to embedded python.

The solution is to check for the presence of pyvenv.cfg in PYTHONHOME and set 
up the system.path accordingly.

--

___
Python tracker 
<https://bugs.python.org/issue35706>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35706] Make it easier to use a venv with an embedded Python interpreter

2019-02-02 Thread PyScripter


PyScripter  added the comment:

Similar experience.  I have found no way to get to use a venv as embedded 
Python in PyScripter.  Tried Py_SetPythonhome, Py_SetPythonName, 
combinations... Nothing worked.

--
nosy: +pyscripter

___
Python tracker 
<https://bugs.python.org/issue35706>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2199] cPickle error with gtk GEnum classes

2008-02-28 Thread PyScripter

New submission from PyScripter:

cPickle has problems loading instances of gtk gobject.GEnum classes. 
gobject.GEnum is a subclass of int.  On the other hand pickle handles
those classes correctly.  Since cPickle is meant to be a faster version
of pickle this needs to be consider a bug.  

To test run the following script:

import gtk
##import pickle
import cPickle as pickle

simple_types = (
bool,
int,
long,
float,
complex,
basestring,
type(None),
)


d = vars(gtk)
for (i,j) in d.iteritems():
if isinstance(j, simple_types):
try:
s = pickle.dumps(j, pickle.HIGHEST_PROTOCOL)
obj = pickle.loads(s)
except (ValueError, TypeError):
print j, type(j)

If you replace cPickle with pickle then the script runs fine.

--
components: Library (Lib)
messages: 63091
nosy: pyscripter
severity: normal
status: open
title: cPickle error with gtk GEnum classes
versions: Python 2.5

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2199>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1685] linecache .updatecache fails on utf8 encoded files

2007-12-28 Thread PyScripter

PyScripter added the comment:

Patch file attached

Added file: http://bugs.python.org/file9034/linecache.py.patch

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1685>
__

linecache.py.patch
Description: Binary data
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1685] linecache .updatecache fails on utf8 encoded files

2007-12-28 Thread PyScripter

PyScripter added the comment:

To reproduce the error:

a) Save the following file in utf-8 format as c:\temp\module1.py
# -*- coding: utf-8 -*-
print("ψ")

b) Run the following script:
import pdb
d = pdb.Pdb()
filename = r"c:\Temp\module1.py"
print(d.set_break(filename,1))

Expected result
None

Actual Result
Line c:\temp\module1.py:1 does not exist

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1685>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1685] linecache .updatecache fails on utf8 encoded files

2007-12-21 Thread PyScripter

New submission from PyScripter:

linecache.updatecache works as follows after it finds a module name:

fp = open(fullname, 'rU')
lines = fp.readlines()
fp.close()

It then tries to detect a file encoding comment...

The problem is that readlines fails with a UnicodeDecodeError if the 
file is utf8 encoded, the preferred locale encoding is something else 
and the file contains characters that cannot be decoded.

Instead the function should:
a) read the raw data into a bytes object 
b)then search for a file encoding comment and
c)use one if found else use utf8 since this is not the default file 
encoding.

--
components: Library (Lib)
messages: 58958
nosy: pyscripter
severity: normal
status: open
title: linecache .updatecache fails on utf8 encoded files
versions: Python 3.0

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1685>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com