Building on Windows

2022-07-02 Thread Sam Ezeh
I have a Windows virtual machine and I'm following the instructions on
the devguide [1] to build Python inside it.

When running `PCbuild\build\bat -e -d` I get "Cannot locate
MSBuild.exe on PATH or as MSBUILD variable". I've done a minimal
amount of searching [2][3] but I'm not well-acquainted with Windows
and don't understand the solutions.

Thanks in advance.

Kind regards,
Sam Ezeh

[1]: https://devguide.python.org/compiler/
[2]: https://bugs.python.org/issue41213
[3]: https://bugs.python.org/issue33675
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Building on Windows

2022-07-02 Thread Sam Ezeh
To add to this, my process was

1. Setup the VM
2. Install Git
3. Clone CPython
4. Run `PCbuild\build.bat -d -e`
5. Notice the error, then install visual studio community 2022
6. Re-run `PCbuild\build.bat -d -e` and see the same error

I can't directly copy and paste between the VM and my host desktop but
in this scenario, the error was that single line and I can use paste
sites where necessary.

Kind regards,
Sam Ezeh

On Sat, 2 Jul 2022 at 15:27, Sam Ezeh  wrote:
>
> I have a Windows virtual machine and I'm following the instructions on
> the devguide [1] to build Python inside it.
>
> When running `PCbuild\build\bat -e -d` I get "Cannot locate
> MSBuild.exe on PATH or as MSBUILD variable". I've done a minimal
> amount of searching [2][3] but I'm not well-acquainted with Windows
> and don't understand the solutions.
>
> Thanks in advance.
>
> Kind regards,
> Sam Ezeh
>
> [1]: https://devguide.python.org/compiler/
> [2]: https://bugs.python.org/issue41213
> [3]: https://bugs.python.org/issue33675
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Building on Windows

2022-07-02 Thread Barry Scott



> On 2 Jul 2022, at 15:41, Sam Ezeh  wrote:
> 
> To add to this, my process was
> 
> 1. Setup the VM
> 2. Install Git
> 3. Clone CPython
> 4. Run `PCbuild\build.bat -d -e`
> 5. Notice the error, then install visual studio community 2022

Try running this:

call "C:\Program Files\Microsoft Visual 
Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"

I use that to get at the command line tools.

If that does not work then search the disk for msbuild.exe and add its folder 
to your PATH.

Barry

> 6. Re-run `PCbuild\build.bat -d -e` and see the same error
> 
> I can't directly copy and paste between the VM and my host desktop but
> in this scenario, the error was that single line and I can use paste
> sites where necessary.
> 
> Kind regards,
> Sam Ezeh
> 
> On Sat, 2 Jul 2022 at 15:27, Sam Ezeh  wrote:
>> 
>> I have a Windows virtual machine and I'm following the instructions on
>> the devguide [1] to build Python inside it.
>> 
>> When running `PCbuild\build\bat -e -d` I get "Cannot locate
>> MSBuild.exe on PATH or as MSBUILD variable". I've done a minimal
>> amount of searching [2][3] but I'm not well-acquainted with Windows
>> and don't understand the solutions.
>> 
>> Thanks in advance.
>> 
>> Kind regards,
>> Sam Ezeh
>> 
>> [1]: https://devguide.python.org/compiler/
>> [2]: https://bugs.python.org/issue41213
>> [3]: https://bugs.python.org/issue33675
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 

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


Re: Byte arrays and DLLs

2022-07-02 Thread Edmondo Giovannozzi
Il giorno venerdì 1 luglio 2022 alle 00:46:13 UTC+2 ery...@gmail.com ha scritto:
> On 6/30/22, Rob Cliffe via Python-list  wrote: 
> > 
> > AKAIK it is not possible to give ctypes a bytearray object and persuade 
> > it to give you a pointer to the actual array data, suitable for passing 
> > to a DLL.
> You're overlooking the from_buffer() method. For example: 
> 
> >>> ba = bytearray(10) 
> >>> ca = (ctypes.c_char * len(ba)).from_buffer(ba) 
> >>> ca.value = b'spam&eggs' 
> >>> ba 
> bytearray(b'spam&eggs\x00') 
> 
> Note that the bytearray can't be resized while a view of the data is 
> exported. For example: 
> 
> >>> ba.append(97) 
> Traceback (most recent call last): 
> File "", line 1, in  
> BufferError: Existing exports of data: object cannot be re-sized 
> 
> >>> del ba[-1] 
> Traceback (most recent call last): 
> File "", line 1, in  
> BufferError: Existing exports of data: object cannot be re-sized

Have you had a look at numpy (https://numpy.org/)?
Typically, it is used for all scientific applications, supports several 
different kind of array, fast linear algebra, etc.
And of course you can pass an array to a dynamic library with ctypes 
(https://numpy.org/doc/stable/reference/routines.ctypeslib.html).

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