Hello,
I'm creating a notepad++ plugin which hosts an embedded python interpreter
by using cffi to build the dll.
So far so good. One obstacle I've found is that I'm not able to use
exec(help(object)) in order to get the wanted info from the object.
The error I get is:
Traceback (most recent call
I've already sent this through mail yesterday but it doesn't appear here, maybe
because of the help word in the content. Please execute in case it appears a
second time.
Hello,
I'm creating a notepad++ plugin which hosts an embedded python interpreter by
using cffi to build the dll.
So far so
Just saw, that I replied to you directly instead to python list, sorry.
That did it, changed encoding from function to property and now I'm able to
call help(object)
Thank you.
--
https://mail.python.org/mailman/listinfo/python-list
@MRAB, I'm building a notepad++ plugin which can execute the
written code and if one writes help(os) it gets executed via
exec(editor.getText()) and output redirected to the plugin console window.
Sorry to you as well as I have also replied to you directly.
Thank you
--
https://mail.python.org/mai
Am Montag, 2. September 2019 00:49:05 UTC+2 schrieb Hongyi Zhao:
> Hi,
>
> What's differences:
>
> a,b = 2,3 and [a,b] = [2,3]
>
> Regards
In this example the result is the same but the second one
builds, internally, an additional list, therefore isn't as sufficient
as the first one.
--
https:
Suppose the following
from enum import IntEnum
class ENDOFLINE(IntEnum):
CRLF = 0
CR = 1
LF = 2
def get_eol() -> ??:
return ENDOFLINE.CRLF
def set_eol(eol_value) -> None:
pass
How should the return value from get_eol be annotated? As ENDOFLINE?
The same question for set_
I'm confused about the following
import sys
print(tuple(bytes.fromhex('282C34')))
print(tuple((0x282C34).to_bytes(3, byteorder=sys.byteorder)))
which results in
(40, 44, 52)
(52, 44, 40)
on my machine. Shouldn't I expect the same result?
Thank you
Eren
--
https://mail.python.org/mailman/list
> You haven't said whether your machine is big-endian or little-endian.
Correct, it is little but I'm wondering why this isn't taking into account.
I thought a method called fromhex would imply that bytes for an integer
should be created and as that it would use the proper byte order to create it.
> ChrisA
You are correct, but, sorry for not being clear what confused me.
I assumed it would use the sys.byteorder but I guess this is simply a
AssumedError exception. :-)
--
https://mail.python.org/mailman/listinfo/python-list
> No, constructing a bytes literal from hex digits implies that they
> follow the sequence in the string of digits. It's nothing to do with
> the endinanness of integers.
> ChrisA
> Why should it imply that? You're asking it to create some bytes
> from a string of hex digits -- no mention of integ
I'm fairly new when it comes to metaclass programming and therefore the
question whether the following makes sense or not.
The goal is to have two additional class properties which return a
dictionary name:class_attribute and value:class_attribute for an IntEnum class
and after reading about it I
Thank you for your thoughts.
I'm trying to migrating en existing python2 api,
which has been build using boost::python with pure python3 code.
All of the py2 classes do have these additional properties names and values.
You are right, using dict(Ordinal.__members__) for names
could have been used
Using the following code in Python3.7 doesn't make FOO to be singleton anymore.
import sys
class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls] = super(Singleton, cls).__call__(*args,
**kwargs)
Shame on me :-)
Thank you very much Ethan.
--
https://mail.python.org/mailman/listinfo/python-list
Why does f1 work? I've expected an exception as no global dict has been
provided, and why does throw f3 an exception if it does, more or less, the same
as f1?
x += 5
def f1():
exec("x += 1; print('f1 in:', x)")
return x
print('f1 out', f1())
# result => f1 in: 6
# result => f1 out 5
x
> In all cases, if the optional parts are omitted, the code is executed in the
> current scope. ...
>
>
> You can see from it that "globals" is optional.
> And that, if "globals" is missing, then
> "exec" is executed in the current scope ("f1" in your case).
Thank you for your answer, and that
> Then it should be clear that the name 'test01' is put into globals(), if
> load_module() doesn't throw an exception. No sharing or nesting of
> namespaces takes place.
Thank you too for your answer. Ok, that means that in every case when exec
imports something it has its own global namespace,
Am Donnerstag, 19. September 2019 12:45:35 UTC+2 schrieb Richard Damon:
> On 9/19/19 6:16 AM, Eko palypse wrote:
> >> In all cases, if the optional parts are omitted, the code is executed in
> >> the current scope. ...
> >>
> >>
> >> You can see f
Am Donnerstag, 19. September 2019 12:56:59 UTC+2 schrieb Peter Otten:
> Eko palypse wrote:
>
> >> Then it should be clear that the name 'test01' is put into globals(), if
> >> load_module() doesn't throw an exception. No sharing or nesting of
> >>
No, I have to correct myself
x = 5
def f1():
exec("x = x + 1; print('f1 in:', x)")
return x
print('f1 out', f1())
results in the same, for me confusing, results.
f1 in: 6
f1 out 5
Eren
--
https://mail.python.org/mailman/listinfo/python-list
Am Donnerstag, 19. September 2019 17:52:48 UTC+2 schrieb cdoa...@orange.com:
> Hi,
> I am no more able to start Python from Windows 7 environment.
> I have the following message :
> "The Application was unable to start correctly, (0xC142). Click OK to
> close the application"
>
> Do you have
First thank you for all the answers, very much appreciated.
I assume the root cause might be explained by the zen of python as well.
If the implementation is hard to explain, it's a bad idea.
Maybe I need to rethink my implementation :-)
Eren
--
https://mail.python.org/mailman/listinfo/python-l
Am Donnerstag, 19. September 2019 18:31:43 UTC+2 schrieb Peter Otten:
> Eko palypse wrote:
>
> > No, I have to correct myself
> >
> > x = 5
> > def f1():
> > exec("x = x + 1; print('f1 in:', x)")
> > return x
> >
Am Donnerstag, 19. September 2019 20:24:49 UTC+2 schrieb Peter Otten:
> Eko palypse wrote:
>
> > Am Donnerstag, 19. September 2019 18:31:43 UTC+2 schrieb Peter Otten:
> >> Eko palypse wrote:
> >>
> >> > No, I have to correct myself
> >> >
&g
>What is strange is that I can run Python, but only with a short program !
Hi Crhistian,
hard to tell, what might help is if you can copy/paste code which does
not run (an example should be as small as possible).
In addition, isn't there any output you get when the program doesn't run?
A traceback
Hello, I'm looking for a solution to a problem which is described best as an
observer pattern issue I guess.
The scenario is the following, client code can register a callback for one or a
list of notifications.
This is currently solved by having a dictionary with the possible notifications
as
Am Sonntag, 29. September 2019 01:02:48 UTC+2 schrieb Paul Rubin:
> Eko palypse writes:
> > Two dicts, one for sync and the other for async registrations?
>
> Why not make all the callbacks asynchronous? Clients that don't want to
> handle a callback immediately can kee
Am Sonntag, 29. September 2019 19:18:32 UTC+2 schrieb Barry Scott:
> > On 29 Sep 2019, at 14:14, Eko palypse wrote:
> >
> > Unfortunately, I can't make all callbacks synchronous or asynchronous
> > because this has negative effects on the application in one way or
Am Montag, 30. September 2019 11:46:43 UTC+2 schrieb Barry Scott:
> > On 29 Sep 2019, at 21:41, Eko palypse wrote:
> >
> > Am Sonntag, 29. September 2019 19:18:32 UTC+2 schrieb Barry Scott:
> >>> On 29 Sep 2019, at 14:14, Eko palypse wrote:
> >>>
>
What needs to be set in order to be able to use a re search within
utf8 encoded bytes?
My test, being on a windows PC with cp1252 setup, looks like this
import re
import locale
cp1252 = 'Ärger im Paradies'.encode('cp1252')
utf8 = 'Ärger im Paradies'.encode('utf-8')
print('cp1252:', cp1252)
pr
Thank you very much for your answer.
> You have to be able to match bytes, not strings.
May I ask you to elaborate on this, sorry non-native English speaker.
The buffer I receive is a byte-like buffer.
> I don't think you'll be able to 100% reliably match bytes in this way.
> You're asking it to
> You cannot. First, \w in re.LOCALE works only when the text is encoded
> with the locale encoding (cp1252 in your case). Second, re.LOCALE
> supports only 8-bit charsets. So even if you set the utf-8 locale, it
> would not help.
>
> Regular expressions with re.LOCALE are slow. It may be more
First of all many thanks to everyone for the active participation.
@Chris Angelico
I think I understand what you illustrated with the byte example,
makes sense. As it was developed for 8-bit encoding only,
it cannot be used for mulitbyte encoding.
@Richard Damon and @MRAB
thank you very much for
Am Sonntag, 13. Oktober 2019 21:20:26 UTC+2 schrieb moi:
> [Do not know why I spent hours with this...]
>
> To answer you question.
> Yes, I confirm.
> It seems that as soon as one works with bytes and when
> a char is encoded in more than 1 byte, "re" goes into
> troubles.
>
First, sorry for a
Am Montag, 14. Oktober 2019 13:56:09 UTC+2 schrieb Chris Angelico:
>
> (My apologies for saying this in reply to an unrelated post, but I
> also don't see those posts, so it's not easy to reply to them.)
>
> ChrisA
Nothing to apologize and thank you for clarification,
I was already checking my s
>From what I understand you want to give the user the possibility to try 10
times or enter -1 to end the script, right?
If so, you need to check if item is -1 or total tries are already 10 and in
such a case break the loop.
No need for an else branch.
Note, input returns an str object but you compa
Assuming there is an CppApp which allows extending its functionality by adding
plugins. Now let's assume there are plugin developer which use cython to create
such a plugins.
How can one check if there has been already a plugin loaded which itself loaded
a python interpreter?
And if this is po
Thanks for the information.
My test looks like this right now.
I have two plugins which, when loaded separately, work.
But when both are loaded, I get AccessVioletion messages from python37.dll.
The init code for both dlls is this:
cpp_init_code = f'''#include
#include "PluginInterface.h"
PyMODI
Hi everyone,
the following happens on Windows7 x64 and Python37 x64
I have a plugin DLL for a C++ application in which Python37 is embedded.
The plugin itself works, except when I want to use the threading module.
If I start a Python script in my plugin which uses the threading module
I can veri
en
Am Mi., 15. Apr. 2020 um 20:12 Uhr schrieb Barry Scott <
ba...@barrys-emacs.org>:
>
>
> > On 15 Apr 2020, at 13:30, Eko palypse wrote:
> >
> > Hi everyone,
> >
> > the following happens on Windows7 x64 and Python37 x64
> >
> > I have a plugi
5, _object * kwnames=0x)*
The thread is neither suspended nor does it have any different status than
the main thread
which loops through its main event queue at this point.
Thank you
Eren
Am Mi., 15. Apr. 2020 um 22:57 Uhr schrieb Barry :
>
>
> > On 15 Apr 2020,
proc),
0)
def test_window():
dlg = DlgWindow()
dlg.start()
if __name__ == '__main__':
test_window()
Thanks
Eren
Am Do., 16. Apr. 2020 um 18:33 Uhr schrieb Barry Scott <
ba...@barrys-emacs.org>:
>
>
> > On 16 Apr
Hello,
I am subclassing a scintilla window and it happens every now and then
that I get an OverflowError. I've logged the message and could narrow down
that it
is a single windows message which causes this trouble. It's WM_ERASEBKGND.
Now the confusing part for me is the following.
According to MS
def __WndProc(self, hWnd, msg, wParam, lParam):
event_handler = self._event_handler.get(msg, None)
if event_handler:
return event_handler(msg, wParam, lParam)
return False
Once again, thank you
Eren
Am Mi., 29. Juli 2020 um 16:26 Uhr schrieb Eryk Sun :
>
Hello,
background info first. On windows, python3.8.5
A cpp app has an embedded python interpreter which allows to modify/enhance the
cpp app
by providing objects to manipulate the cpp app and callbacks to act on certain
events,
like fileopen, fileclose, updateui ... which are send by the cpp
7;s where a debugger is just nicer, I think.
Eren
Am Sa., 22. Aug. 2020 um 22:59 Uhr schrieb Chris Angelico :
> On Sun, Aug 23, 2020 at 5:51 AM Eko palypse wrote:
> > So the question is, what do I need to read/learn/understand in order to
> solve this issue?
> > Or in other w
its own thread? I'll give it a
try anyways. :-)
Thx
Eren
Am So., 23. Aug. 2020 um 22:55 Uhr schrieb Barry :
>
>
> > On 22 Aug 2020, at 20:53, Eko palypse wrote:
> >
> > Hello,
> >
> > background info first. On windows, python3.8.5
> >
> > A
With python3.7 I'm able to use
_module = importlib.import_module('app.plugins.plugin_dir.plugin_name')
succesfully but with python 3.8 this results in
File "D:\ProgramData\Python\Python38_64\lib\importlib\__init__.py", line 127,
in import_module
return _bootstrap._gcd_import(name[level:]
Seems I've missed that __init__.py's aren't allowed to be empty anymore.
Adding a single # solved the issue.
Eren
--
https://mail.python.org/mailman/listinfo/python-list
> On 19/09/20 7:51 am, Eko palypse wrote:
> > ValueError: source code string cannot contain null bytes
> >
> > Any idea what happened here?
>
> > Seems I've missed that __init__.py's aren't allowed to be empty anymore.
> > Adding a single # solved
50 matches
Mail list logo