Embedding Python into your apps
- Kwai chang caine
- Always Here
- Posts: 5353
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Re: Embedding Python into your apps
You have right, but in my case, it's just for use SELENIUM the remote webbrowser.
Unfortunately (for me and PB), the creator have create an OOP language
So obviously, all his library is OOP and then impossible to use with PB
The great SROD have create COMATE for the community, starting to Dishelper made in C
Before, i use COMATE for remote IE, and all it's done
But now, IE is not always updated on all machine, and sometime not accept all the last HTML, and mainly, IE is not portable
A friend show me PYTHON with SELENIUM for FF for replace COMATE and OLE for IE, and i must recognize that's works nearly also good than COM
It's the reason why, i'm forced to try to embeding PYTHON for use SELENIUM and FF all that in portable version.
For me, the dream is always everybody coding in C, but we know you and me it's not the case.
The C is always in the most used language, but all the new library, and other languages (C++, c#, JAVA, PYTHON, PHP, etc ..) is OOP, and i'm sad about that
Unfortunately (for me and PB), the creator have create an OOP language
So obviously, all his library is OOP and then impossible to use with PB
The great SROD have create COMATE for the community, starting to Dishelper made in C
Before, i use COMATE for remote IE, and all it's done
But now, IE is not always updated on all machine, and sometime not accept all the last HTML, and mainly, IE is not portable
A friend show me PYTHON with SELENIUM for FF for replace COMATE and OLE for IE, and i must recognize that's works nearly also good than COM
It's the reason why, i'm forced to try to embeding PYTHON for use SELENIUM and FF all that in portable version.
For me, the dream is always everybody coding in C, but we know you and me it's not the case.
The C is always in the most used language, but all the new library, and other languages (C++, c#, JAVA, PYTHON, PHP, etc ..) is OOP, and i'm sad about that
The happiness is a road...
Not a destination
Not a destination
- Kwai chang caine
- Always Here
- Posts: 5353
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Re: Embedding Python into your apps
I don't understand...i'm really a donkey
I have :
1/ Install Python 3.1.4
2/ Take the "Python31.dll"
3/ Uninstall Python
4/ Compile your code in console mode with "callpy.exe" with PB v4.51
5/ Put "callpy.exe" + python31.dll + first.py on root of C:
6/ Write "callpy first multiply 2 3" on the root in the cmd console
And i have this error with XP pro
I have :
1/ Install Python 3.1.4
2/ Take the "Python31.dll"
3/ Uninstall Python
4/ Compile your code in console mode with "callpy.exe" with PB v4.51
5/ Put "callpy.exe" + python31.dll + first.py on root of C:
6/ Write "callpy first multiply 2 3" on the root in the cmd console
And i have this error with XP pro
C:\>callpy first multiply 2 3
Fatal Python error: Py_Initialize: can't initialize sys standard streams
ImportError: No module named encodings.utf_8
The happiness is a road...
Not a destination
Not a destination
Re: Embedding Python into your apps
Hi KCC,
copy callpy.exe first.py and the dll in one directory.
I compiled callpy.pb in ascii mode.
hmm....
Just tried it on my home PC: same result as you.
Strange I use the same OS (Win7 Pro X64) in the office: works like charme.
I'll have look...
copy callpy.exe first.py and the dll in one directory.
I compiled callpy.pb in ascii mode.
hmm....
Just tried it on my home PC: same result as you.
Strange I use the same OS (Win7 Pro X64) in the office: works like charme.
I'll have look...
- Kwai chang caine
- Always Here
- Posts: 5353
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Re: Embedding Python into your apps
Alleluia !!!!
I'm not alone to have this problem
You surely laugh but i have even thinking, with my little head to try to compile in UNICODE, without succes too, obviously
I'm not alone to have this problem
You surely laugh but i have even thinking, with my little head to try to compile in UNICODE, without succes too, obviously
You are an angelI'll have look...
The happiness is a road...
Not a destination
Not a destination
Re: Embedding Python into your apps
Some hints from the web means: a wrong PYTHONHOME environment variable
But I'd looked everyywhere (set, registry) there is nothing to find.
An other point is VC9 runtime environment.
The dll is compiled with vc9 and it needs the vc9 runtime environment.
it's in vc 2008 redist stuff.
But I'd looked everyywhere (set, registry) there is nothing to find.
An other point is VC9 runtime environment.
The dll is compiled with vc9 and it needs the vc9 runtime environment.
it's in vc 2008 redist stuff.
- Kwai chang caine
- Always Here
- Posts: 5353
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Re: Embedding Python into your apps
Thanks a lot i take a look about this VC9
Me since the beginning i have the same error, even with the W7 of my office
With XP it's more understandable, but with W7....
Me since the beginning i have the same error, even with the W7 of my office
With XP it's more understandable, but with W7....
The happiness is a road...
Not a destination
Not a destination
- Kwai chang caine
- Always Here
- Posts: 5353
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Re: Embedding Python into your apps
It's strange, because i have two VC++ 2008 redistributable installed on my XP
And that works not two time better
And that works not two time better
The happiness is a road...
Not a destination
Not a destination
Re: Embedding Python into your apps
Got a question...
Is "python31.dll" the only version of the .dll this will work with?
Is "python31.dll" the only version of the .dll this will work with?
The world and human nature was screwed up before I was born. It's not my fault and I'm just stuck with trying to deal with the mess left behind, so don't blame me.
- skinkairewalker
- Enthusiast
- Posts: 635
- Joined: Fri Dec 04, 2015 9:26 pm
Re: Embedding Python into your apps
Hi everyone !
well , i have problems in import Python DLL ,
when i call with > OpenLibrary(1,"python35.dll")
dont call library ...
follow the screenshot > http://prntscr.com/d5iquh
this is Dlls in my folder http://prntscr.com/d5ipwg
how can i fix this ?
well , i have problems in import Python DLL ,
when i call with > OpenLibrary(1,"python35.dll")
dont call library ...
follow the screenshot > http://prntscr.com/d5iquh
this is Dlls in my folder http://prntscr.com/d5ipwg
how can i fix this ?
Re: Embedding Python into your apps
is the dll 32-bit or 64-bit?
my guess is that it's 32-bit and you need the 64-bit version since you are using PB x64, or you could use PB x86
my guess is that it's 32-bit and you need the 64-bit version since you are using PB x64, or you could use PB x86
- skinkairewalker
- Enthusiast
- Posts: 635
- Joined: Fri Dec 04, 2015 9:26 pm
Re: Embedding Python into your apps
now show this error > http://prntscr.com/d5n5j0
this is code used >
this is code used >
Code: Select all
Prototype Py_Initialize()
Prototype.s PyRun_SimpleString(String.s)
Prototype Py_Finalize()
If OpenConsole("Python with PB")
If OpenLibrary(0, "python35.dll")
PythonInitialize.Py_Initialize = GetFunction(0, "Py_Initialize")
PythonRunSimpleString.PyRun_SimpleString = GetFunction(0, "PyRun_SimpleString")
PythonFinalize.Py_Finalize = GetFunction(0, "Py_Finalize")
PythonInitialize()
pystring$ = "from time import time, ctime" + Chr(10)
pystring$ = "print('Hello PB World from Python!')" + Chr(10)
pystring$ + "print('Today is', ctime(time()))"
PythonRunSimpleString(pystring$)
PythonFinalize()
CloseLibrary(0)
Delay(3000)
EndIf
CloseConsole()
EndIf
Last edited by skinkairewalker on Thu Nov 10, 2016 8:03 pm, edited 1 time in total.
- skinkairewalker
- Enthusiast
- Posts: 635
- Joined: Fri Dec 04, 2015 9:26 pm
Re: Embedding Python into your apps
i fix this error !
just need Set System Variable ,
PYTHONHOME = C:\Users\YOURPC\AppData\Local\Programs\Python\PythonXX
AND
PYTHONPATH = C:\Users\YOURPC\AppData\Local\Programs\Python\PythonXX; C:\Users\YOURPC\AppData\Local\Programs\Python\PythonXX\DLLs;
C:\Users\YOURPC\AppData\Local\Programs\Python\PythonXX\Lib;
C:\Users\YOURPC\AppData\Local\Programs\Python\PythonXX\libs;
C:\Users\YOURPC\AppData\Local\Programs\Python\PythonXX\Lib\site-packages
and this bug has fixes ...
note > Python 3.2 or greater
just need Set System Variable ,
PYTHONHOME = C:\Users\YOURPC\AppData\Local\Programs\Python\PythonXX
AND
PYTHONPATH = C:\Users\YOURPC\AppData\Local\Programs\Python\PythonXX; C:\Users\YOURPC\AppData\Local\Programs\Python\PythonXX\DLLs;
C:\Users\YOURPC\AppData\Local\Programs\Python\PythonXX\Lib;
C:\Users\YOURPC\AppData\Local\Programs\Python\PythonXX\libs;
C:\Users\YOURPC\AppData\Local\Programs\Python\PythonXX\Lib\site-packages
and this bug has fixes ...
note > Python 3.2 or greater
Re: Embedding Python into your apps
Hello!
I know that the thread is already old.
How does it work under a current Linux?
How can I use this to execute entire Python scripts?
I know that the thread is already old.
How does it work under a current Linux?
How can I use this to execute entire Python scripts?