Re: php to python code converter

2020-05-13 Thread anjulakshmi894
On Friday, 8 May 2009 16:08:25 UTC+5:30, bvidinli  wrote:
> if anybody needs:
> http://code.google.com/p/phppython/

$username = "username";
$password = "password";
$hostname = "localhost";

$dbhandle = mysql_connect($hostname, $username, $password) or 
die("Unable to connect to MySQL");
$selected = mysql_select_db("dropdownvalues", $dbhandle) or die("Could 
not select examples");
$choice = mysql_real_escape_string($_GET['choice']);

$query = "SELECT * FROM dd_vals WHERE category='$choice'";

$result = mysql_query($query);

while ($row = mysql_fetch_array($result)) {
echo "" . $row{'dd_val'} . "";
}
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help Problem with python : python-3.8.3rc1-amd64

2020-05-13 Thread Mats Wichmann
On 5/11/20 9:25 PM, Michael Torrie wrote:
> On 5/11/20 8:33 PM, Buddy Peacock wrote:
>> I am trying to install python on my surface with windows 10, version 1903,
>> build 18362.778.  The installer seems to think everything worked. But there
>> is no Python folder anywhere on the system.  I looked in the root directory
>> as well as "Program Files" and "Program Files (x86)" and not in any users
>> folders either.  I have uninstalled and re-installed twice.  Once after
>> shutting down and restarting.  Your help would be appreciated as I am
>> taking an on-line programming class.
> 
> Unless you specifically selected "install for all users" it's probably
> going to be installed to your home directory under the hidden folder
> "AppData," specially "AppData\Local\Programs\Python."  Be sure to tell
> the installer to put python in your path--that way no matter where it
> is, from the command prompt you can just run "python" and it will fire
> up the interpreter. 

That's what the Python Launcher is for... instead of always having to
get the path to python itself into the Windows path - and change it each
time the version bumps, since the path includes the version number -
"py" goes in your path in a place it's always found, so "py" from a
command prompt works, with options to select a specific Python if you
have several installed.  Bonus: "py" works from PowerShell as well
("python" tends not to).

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3.6 Embedded

2020-05-13 Thread matheusdalmago10
On Monday, December 26, 2016 at 5:27:33 AM UTC-2, [email protected] wrote:
> I'm using the python3.6 DLL to embed Python 3 inside a Windows application.
> 
> Here is some background into how Python is being used.
> 
> 1. Firstly the same basic code worked fine with the earlier Python 2.7 
> version.
> 
> 2. The code is structured as follows:
> 
> Windows Executable
> +
> |
> + Scripting DLL
>   +
>   |
>   + Pthyhon 3.6 DLL
> 
> In other words the executable talks to the Scripting DLL and the scripting 
> DLL then talks to the Python DLL.
> 
> 3. To run a script the following flow control is used:
> 
> a. Application loads the Scripting DLL
> i.  The Scripting DLL calls Py_Initialize found in the Python DLL
> 
> b. Application run the script file using the Scripting DLL
> i.  The Scripting DLL calls PyRun_SimpleFileEx in the Python DLL to 
> run the script
> 
> c. Unload the scripting DLL
> i.  The Scripting DLL calls Py_FinalizeEx in the Python DLL clean up
> 
> Symptoms of the Problem
> ---
> The problem can be replicated by a script that contains nothing but a single 
> import statement.
> 
> Using this test script the script can be run and re-run any number of times:
> 
> import sys
> 
> Using this test script the script will run the first time but fail every 
> subsequent time:
> 
> import socket
> 
> The difference in the two import statements is the former is a built-in 
> module while the later is using a dynamically loaded module.
> 
> The Cause of the Problem
> 
> I tracked down the cause of the problem to the fact the python36.dll unloads 
> just fine for the first case but fails to unloaded for the second case.
> 
> So when the application loads and unloads the Scripting DLL the python36.dll 
> remains loaded.
> 
> Then when the python36.dll is used the second time it now contains pointers 
> to stale data and crashes on the second run.
> 
> The Py_FinalizeEx document found here suggests it should stop all 
> interpreters: https://docs.python.org/dev/c-api/init.html
> 
> Anyone have an idea know what might be going wrong?
> 
> What code is holding on to the Python DLL?

Three and a half year later and I have the exact same problem. Curios world.
-- 
https://mail.python.org/mailman/listinfo/python-list


Subprocess Popen confusion

2020-05-13 Thread Dick Holmes
https://occovid19.ochealthinfo.com/coronavirus-in-oc I'm trying to 
communicate using a continuing dialog between two 
processes on the same system. I've looked at various mechanisms and the 
class that seems to fit my needs is Popen in the subprocess module, but 
I can't seem to get more than a single round-trip message through Popen. 
I first call Popen then poll using the identifier returned from the call 
and the poll seems to work. I then call the communicate function passing 
None as the value to send to the companion process stdin. I get the 
expected result, but I also get "Exception condition detected on fd 0
\\n" and "error detected on stdin\\n". Subsequent attempts to 
read/write/communicate with the subprocess fail because the file (stdxx 
PIPE) is closed.

I can't tell from the documentation if the communicate function is a 
one-time operation. I have tried using read but the read call doesn't 
return (I'm using winpdb-reborn to monitor the operations). 

I'm using Python 3.7, Windows 10, winpdb-reborn 2.0.0, rpdb2 1.5.0. If 
it makes any difference, I'm trying to communicate with GDB using the MI 
interpreter.

Thoughts and advice appreciated!

Dick
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: php to python code converter

2020-05-13 Thread Palash Bauri
That gives a 404 🤷‍♂️, you sure , you pasted the right link ?

~Palash Bauri

On Wed, 13 May 2020, 9:07 pm ,  wrote:

> On Friday, 8 May 2009 16:08:25 UTC+5:30, bvidinli  wrote:
> > if anybody needs:
> > http://code.google.com/p/phppython/
>
> $username = "username";
> $password = "password";
> $hostname = "localhost";
>
> $dbhandle = mysql_connect($hostname, $username, $password) or
> die("Unable to connect to MySQL");
> $selected = mysql_select_db("dropdownvalues", $dbhandle) or
> die("Could not select examples");
> $choice = mysql_real_escape_string($_GET['choice']);
>
> $query = "SELECT * FROM dd_vals WHERE category='$choice'";
>
> $result = mysql_query($query);
>
> while ($row = mysql_fetch_array($result)) {
> echo "" . $row{'dd_val'} . "";
> }
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list