[issue45749] Silently fails to build hashlib if openssl has disabled algorithms

2021-11-08 Thread Ross Burton


Ross Burton  added the comment:

Cool, glad to see the additional checks.

--

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



[issue45749] Silently fails to build hashlib if openssl has disabled algorithms

2021-11-08 Thread Ross Burton


Change by Ross Burton :


--
versions: +Python 3.10

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



[issue45749] Silently fails to build hashlib if openssl has disabled algorithms

2021-11-08 Thread Ross Burton


New submission from Ross Burton :

If my openssl is built with no-scrypt then the Python build of hashlib fails 
(as EVP_PBE_scrypt isn't present), but the overall compile succeeds.

--
components: Build
messages: 405954
nosy: rossburton2
priority: normal
severity: normal
status: open
title: Silently fails to build hashlib if openssl has disabled algorithms

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



[issue45147] Typo in "What's New In Python 3.10" documentation

2021-09-09 Thread Ross Martin


Ross Martin  added the comment:

I would like to fix this, if it hasnt been assigned already.

--
nosy: +MrRBM97

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



Release 0.3.4 of orderedstructs including a C++/Python SkipList

2021-04-29 Thread Paul Ross
I have released v0.3.4 of the orderedstructs package that contains a high
performance SkipList implemented in C++ with Python bindings. A SkipList
behaves as an always sorted list with, typically, O(log(n)) cost for
insertion, look-up and removal. This makes it ideal for such operations as
computing the rolling median of a large dataset.

The characteristics of this SkipList implementation include:

   - No capacity restrictions apart from available memory.
   - Works with any C++ type  that has meaningful comparison operators.
   - The C++ SkipList can be compiled as thread safe.
   - The Python SkipList is thread safe.
   - Python SkipLists can be long/float/bytes/object types, the latter can
   have user defined comparison functions.
   - With Python 3.8+ SkipLists can be combined with the
   multiprocessing.shared_memory
   
<https://docs.python.org/3/library/multiprocessing.shared_memory.html#module-multiprocessing.shared_memory>
   module for concurrent operation on large arrays. For example concurrent
   roling medians
   
<https://skiplist.readthedocs.io/en/latest/rolling_median.html#rolling-median-in-python-with-multiprocessing-shared-memory>
   which speed up near linearly with the number of cores.
   - The implementation is extensively performance tested in C++ and Python.

There are a some novel features to this implementation:

   - A SkipList is a probabilistic data structure but we have deterministic
   tests that work for any (sane) random number generator. See testing a
   probabalistic data structure
   
<http://skiplist.readthedocs.io/en/latest/test_notes.html#testing-a-probabilistic-structure>
   - This SkipList can dynamically generate visualisations of its current
   internal state. See visualising a skiplist
   
<http://skiplist.readthedocs.io/en/latest/visualisations.html#skiplist-visualisation-label>

Project source: https://github.com/paulross/skiplist
PyPi: https://pypi.org/project/orderedstructs/
Documentation: http://skiplist.readthedocs.io/en/latest/index.html

Paul Ross.
___
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Member address: arch...@mail-archive.com


[issue43123] email MIME splitting

2021-04-12 Thread Ross Rhodes

Ross Rhodes  added the comment:

PR now “stale” since I have not received any feedback, yet.

--

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



[issue42916] Support for DICOM image file format in imghdr module

2021-04-12 Thread Ross Rhodes

Ross Rhodes  added the comment:

PR already open to support DICOM based on the first 132 characters. Marked 
“stale” since I haven’t had any feedback on GitHub, yet.

--

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



Re: Mutable defaults

2021-02-10 Thread Ross Wilson
On Thu, 11 Feb 2564 BE at 12:52 Grant Edwards 
wrote:

> On 2021-02-11, J. Pic  wrote:
>
> > I just meant removing the whole "default value mutating" story, not
> > removing mutable variables. Really, I was wondering if there was a use
> case
> > where this actually turns to an advantage,
>
> I've seen people show how it can be used to provide function-scope
> persistent storage -- the equivalent of declaring a static variable in
> a C function. I don't think I've seen that done in the wild, though.


Not sure this qualifies as "use in the wild", but the memoized naive
Fibonacci is very nice when written this way:

def fib(n, memo={0: 0, 1: 1}):
if n not in memo:
memo[n] = fib(n-1) + fib(n-2)
return memo[n]
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue42778] Add follow_symlinks=True parameter to both os.path.samefile() and Path.samefile()

2021-02-08 Thread Ross Rhodes

Ross Rhodes  added the comment:

Thanks for sharing the alternative approach, Serhiy. Sounds like the proposed 
changes aren’t necessary if the combined use of samestat and lstat achieve the 
desired behaviour.

Any objections if I close the open PR?

--

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



[issue42916] Support for DICOM image file format in imghdr module

2021-02-08 Thread Ross Rhodes

Ross Rhodes  added the comment:

Looking for input from other contributors here. Naturally with a PR already 
open I’m inclined to keep these changes, but if the majority agree that it is 
too specific a format then I’m happy to hear alternative suggestions?

Ross

--

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



[issue43123] email MIME splitting

2021-02-07 Thread Ross Rhodes


Ross Rhodes  added the comment:

Hi Martin,

Looking into this further, it appears we already catch CR-LF characters in 
header values, but your test case shows that we do not run the same checks on 
header names.

I've opened a PR to rectify this - feel free to leave feedback.

Ross

--

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



[issue43123] email MIME splitting

2021-02-07 Thread Ross Rhodes


Change by Ross Rhodes :


--
keywords: +patch
nosy: +trrhodes
nosy_count: 3.0 -> 4.0
pull_requests: +23267
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24475

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



[issue42916] Support for DICOM image file format in imghdr module

2021-01-16 Thread Ross Rhodes


Ross Rhodes  added the comment:

Hello Charles,

Following the format provided, I've opened a PR to implement your proposal. 
Feedback welcome.

--

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



[issue42916] Support for DICOM image file format in imghdr module

2021-01-16 Thread Ross Rhodes


Change by Ross Rhodes :


--
keywords: +patch
nosy: +trrhodes
nosy_count: 2.0 -> 3.0
pull_requests: +23050
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/24227

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



[issue42756] smtplib.LMTP.connect() raises TypeError if `timeout` is not specified

2021-01-01 Thread Ross Rhodes


Change by Ross Rhodes :


--
pull_requests: +22886
pull_request: https://github.com/python/cpython/pull/24050

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



[issue42794] test_nntplib fails on CI

2020-12-31 Thread Ross Rhodes


Ross Rhodes  added the comment:

Server is returning '215 Newsgroup descriptions in form "group description"', 
but an empty list of lines, so it's reaching the 'nothing' case in 
_getdescriptions: 
https://github.com/python/cpython/blob/master/Lib/nntplib.py#L660

--
nosy: +trrhodes

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



[issue41914] test_pdb fails

2020-12-30 Thread Ross Rhodes


Ross Rhodes  added the comment:

Hi Sumagna,

test_pdb appears to be working as expected on my machine. I realise this was 
posted a few months ago so would you mind trying again and seeing if the issue 
persists? If so, which OS are you running your tests on?

--
nosy: +trrhodes

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



[issue42787] email.utils.getaddresses improper parsing of unicode realnames

2020-12-30 Thread Ross Rhodes


Ross Rhodes  added the comment:

Hi Konstantin,

Thanks for raising this issue. It appears the field provided in your example 
does not conform to RFC 2822 followed by this email library. Square brackets 
are treated as special characters in [section 
3.2.1](https://tools.ietf.org/html/rfc2822#section-3.2.1), which is handled in 
the 
[_parseaddr](https://github.com/python/cpython/blob/master/Lib/email/_parseaddr.py#L219)
 file.

The above combined with the fact that any [failed parsing returns an two-tuple 
of ('', 
'')](https://github.com/python/cpython/blob/master/Lib/email/utils.py#L212) I 
believe explains the behavior observed.

--
nosy: +trrhodes

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



[issue42778] Add follow_symlinks=True parameter to both os.path.samefile() and Path.samefile()

2020-12-29 Thread Ross Rhodes


Ross Rhodes  added the comment:

Hi Tom,

Thanks for raising this issue. I've opened a PR to permit us to set 
`follow_symlinks` in both os.path and pathlib. Feel free to leave feedback.

--

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



[issue42778] Add follow_symlinks=True parameter to both os.path.samefile() and Path.samefile()

2020-12-29 Thread Ross Rhodes


Change by Ross Rhodes :


--
keywords: +patch
nosy: +trrhodes
nosy_count: 1.0 -> 2.0
pull_requests: +22839
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/23996

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



[issue42756] smtplib.LMTP.connect() raises TypeError if `timeout` is not specified

2020-12-27 Thread Ross Rhodes

Ross Rhodes  added the comment:

Hello Wüstengecko,

Thanks for raising this issue. I've opened a PR which I believe will resolve 
the problem, but it's difficult to verify this against the mock socket setup. 
Feel free to leave feedback.

--

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



[issue42756] smtplib.LMTP.connect() raises TypeError if `timeout` is not specified

2020-12-27 Thread Ross Rhodes


Change by Ross Rhodes :


--
keywords: +patch
nosy: +trrhodes
nosy_count: 1.0 -> 2.0
pull_requests: +22814
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/23969

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



[issue41781] Typos in typing.py

2020-12-26 Thread Ross Rhodes


Ross Rhodes  added the comment:

Hello Patrick,

Thanks for opening this issue. I'm creating a PR to resolve the typo in 
"_allow_reckless_class_cheks", but I'm unable to find "instnance". Presumably 
the latter was resolved in an earlier PR.

--

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



[issue41781] Typos in typing.py

2020-12-26 Thread Ross Rhodes


Change by Ross Rhodes :


--
keywords: +patch
nosy: +trrhodes
nosy_count: 1.0 -> 2.0
pull_requests: +22804
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/23957

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



[issue42352] A string representation of slice objects with colon syntax

2020-11-13 Thread Ross Barnowski


New submission from Ross Barnowski :

It would be nice if there were a way to get a string representation of a slice 
object in extended indexing syntax, e.g.

```
>>> myslice = slice(None, None, 2)
>>> print(myslice)
'::2'
```

One motivating use-case is in descriptive error messages, e.g.

```
TypeError(f"Can't slice {myobj}, try list({myobj})[{myslice}]")
```

In this case, it is much more natural for `myslice` to use the extended 
indexing syntax than the slice str/repr.

Perhaps this could be done via __str__, or if that is too big a change, maybe 
via __format__ e.g. `f"{myslice:asidx}"`

It's simple enough to write a conversion function, but this feels like a 
feature that would fit best upstream. I searched the issue tracker, PRs on 
GitHub, and the Python documentation and didn't see any related 
issues/PRs/articles.

xref: https://github.com/networkx/networkx/pull/4304

--
messages: 380921
nosy: rossbar
priority: normal
severity: normal
status: open
title: A string representation of slice objects with colon syntax
type: enhancement
versions: Python 3.10

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



[issue42173] Drop Solaris support

2020-11-02 Thread Gordon Ross


Gordon Ross  added the comment:

I can understand the frustrations around dealing with minority platforms, but 
please remember that the illumos project (www.illumos.org) is basically the 
inheritor of problems around "Build on Solaris" for 3rd party software like 
Python.  There are several OS distributions based on illumos that would be 
impacted by removing the ability to (easily) build Python. I'm confident we can 
find some people to help maintain build-bots etc. if that's what it takes.  If 
you're still looking for such help, let me know and I'll ask on 
develop...@list.illumos.org for volunteers.

Thanks!  -GWR

--
nosy: +gwr

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



[issue40028] Math module method to find prime factors for non-negative int n

2020-04-18 Thread Ross Rhodes


Ross Rhodes  added the comment:

Unable to dedicate time to this issue under the change of circumstances. Happy 
for someone else to re-open this if they take an interest in picking up this 
work.

--
resolution:  -> postponed
stage: needs patch -> resolved
status: open -> closed

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



[issue40028] Math module method to find prime factors for non-negative int n

2020-03-21 Thread Ross Rhodes


Ross Rhodes  added the comment:

Hi Steven,

I agree, your set of proposed methods seem sensible to me. I'm happy to start 
with an implementation of at least some of those methods and open for review, 
taking this one step at a time for easier review and regular feedback.

> Another question: since factorization can take a long time, should it be a 
> generator that yields the factors as they are found?

Yes, I think a generator is a sensible shout. Happy to proceed with this 
suggestion.

Ross

--

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



[issue40028] Math module method to find prime factors for non-negative int n

2020-03-21 Thread Ross Rhodes


Ross Rhodes  added the comment:

Hi Serhiy,

> Provide a pull request.

Apologies, by "this idea" I should clarify I meant the "imath" module proposal. 
On this particular enhancement, yes, I'm happy to work on and later provide a 
pull request.

--

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



[issue40028] Math module method to find prime factors for non-negative int n

2020-03-21 Thread Ross Rhodes


Ross Rhodes  added the comment:

Hi Serhiy,

Thanks for sharing your thread. I support this proposal, and would be happy to 
help where time permits if we can gather sufficient support.

I inadvertently posted my support twice on your thread with no obvious means of 
deleting the duplicate post, since the first one had a delay appearing. 
Regardless, how can we best move forward with this idea?

Ross

--

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



[issue40028] Math module method to find prime factors for non-negative int n

2020-03-21 Thread Ross Rhodes

Ross Rhodes  added the comment:

Hi Tim,

Are there any open discussions or threads following the proposed “imath” 
module? I’m a relatively new entrant to the Python community, so if there’s any 
ongoing discussion on that front I’d be happy to read further.

I think as a first step it would be good to implement this logic for a limited 
range of non-negative n, imposing an upper limit (suggestions welcome) to make 
sure all provided input can be safely processed. We can then build from there 
to support larger n going forward if the demand is out there.

Ross

--

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



[issue40028] Math module method to find prime factors for non-negative int n

2020-03-20 Thread Ross Rhodes


New submission from Ross Rhodes :

Hello,

Thoughts on a new function in the math module to find prime factors for 
non-negative integer, n? After a brief search, I haven't found previous 
enhancement tickets raised for this proposal, and I am not aware of any 
built-in method within either Python's math module or numpy, but happy to be 
corrected on that front.

If there's no objection and the method does not already exist, I'm happy to 
implement it and open for review.

Ross

--
messages: 364711
nosy: trrhodes
priority: normal
severity: normal
status: open
title: Math module method to find prime factors for non-negative int n
versions: Python 3.9

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



[issue39507] http library missing HTTP status code 418 "I'm a teapot"

2020-01-31 Thread Ross Rhodes


Change by Ross Rhodes :


--
keywords: +patch
pull_requests: +17665
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18291

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



[issue39507] http library missing HTTP status code 418 "I'm a teapot"

2020-01-31 Thread Ross Rhodes


New submission from Ross Rhodes :

http library missing HTTP status code 418 "I'm a teapot".

--
messages: 361106
nosy: trrhodes
priority: normal
severity: normal
status: open
title: http library missing HTTP status code 418 "I'm a teapot"

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



[issue38999] Python launcher on Windows does not detect active venv

2019-12-24 Thread Ross Boylan

Ross Boylan  added the comment:

As someone who finds the current behavior surprising, and having lost 
significant time because of it, I have a couple of comments.

1) If the venv created a python3 (or 2, as appropriate) file, would the 
expected behavior with !#/usr/bin/env python3 be restored?  I think the 
previous analysis said that python3 doesn't match the venv because there is no 
python3 in the venv path.  So putting one there would fix it.  Of course, it 
would only help for newly created venvs.  The pythonN file would need to be in 
addition to the python file, not instead of it, so that invocations of python 
without a number continued to work as expected.

2) There appear to be two separate sections of the documentation which govern 
this case. 3.7.1.2 of Python Setup and Usage says "If the launcher is run with 
no explicit Python version specification, and a virtual environment (created 
with the standard library venv module or the external virtualenv tool) active, 
the launcher will run the virtual environment’s interpreter rather than the 
global one. "
If py myscript.py is invoked that seems to fit this case, but obviously that's 
not what's happening.  I realize one could interpret the python3 in the shebang 
as an "explicit version specification", but a) that's not on the command line, 
which seems the more natural reading and b) it's only a partial specification, 
since it doesn't say which python3 to use.

Then section 3.7.2 is about !# lines.  So if you invoke py without a version 
specifier, but the invoked file has a !#, does 3.7.1.2 or 3.2 apply?

--
nosy: +rossb

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



Re: Wind Rose Plotting in Python

2019-09-05 Thread Ross Wilson
On Thu, 5 Sep 2562 at 22:00 Madhavan Bomidi  wrote:

> Hi,
>
> Can someone help me on how to make the wind rose plotting (similar to the
> figure 2 in the paper:
> https://agupubs.onlinelibrary.wiley.com/doi/epdf/10.1029/2011JD016386) in
> Python?
>
> The input file contains the data in 4 columns:
>
> [date, time, wind_speed, wind_direction]
>
> Look forward to your support and suggestions.
>

Hi Madhavan,

I can only see the first page of the paper you linked, so this might not
help.

Try looking at the "windrose" third-party library for matplotlib at
https://github.com/python-windrose/windrose .  The matplotlib page of
third-party libraries is at
https://matplotlib.org/3.1.1/thirdpartypackages/index.html#windrose .

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


[issue36159] Modify Formatter Class to handle arbitrary objects

2019-03-12 Thread Ross Biro


Ross Biro  added the comment:

I'm currently writing a language translator between two domain specific
computer languages.  Because some expressions occur repeatedly, but in
slightly different contexts, I make multiple passes.  The first pass
reduces everything it can and leaves place holder objects for things it
can't reduce.  Later passes replace the objects with their final expression
in the new language.  The final expression varies by context, so every time
it's reevaluated, it could change.  I would really like to handle things
like a + b as

"{a} + {b}".format(a=a, b=b)

This works great when a and b are strings.  But when they are place holder
objects, I wasn't able to find a good solution.  Although the Formatter
class came so close that I thought I would suggest the change.  What I
ended up doing was replacing objects with unique strings so that I could
use format and then using regular expressions on the output string to split
it into an array and replace the string identifiers with the original
objects.  The change I've suggested to the Formatter class would have
allowed me to skip the regular expressions.

Ross

On Mon, Mar 11, 2019 at 11:47 PM Lisa Roach  wrote:

>
> Lisa Roach  added the comment:
>
> Can you give an example use case for this? F-strings are the newer method
> of string interpolation, I'm not sure it's worth putting effort into adding
> features to string.Formatter.
>
> --
> nosy: +lisroach
>
> ___
> Python tracker 
> <https://bugs.python.org/issue36159>
> ___
>

-- 
*Ross Biro* | CTO
___

O: 240-380-2231|  F: 240-556-0361 <(240)%20556-0361>
The Interface Financial Group <https://interfacefinancial.com/>

CONFIDENTIALITY NOTICE: This email message, including any attachments, is
for the sole use of the intended recipient/s and may contain confidential &
privileged information. Any unauthorized review, use, disclosure, or
distribution is prohibited. If you are not the intended recipient, please
contact the sender by reply email and destroy all copies of the original
messages and any attachments.

--

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



[issue36125] Cannot cross-compile to more featureful but same tune

2019-03-03 Thread Ross Burton


Ross Burton  added the comment:

That's exactly the glitch.  I'm cross-compiling to a more powerful IA process 
from IA.  This *is* a cross-compilation but the triple is the same.  Assuming 
that you can rely on the loader to not open target binaries when they're on the 
path to load from is unwise.

--

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



[issue36125] Cannot cross-compile to more featureful but same tune

2019-03-02 Thread Ross Burton


Ross Burton  added the comment:

strace disagrees.  By putting strace in PYTHON_FOR_BUILD and then invoking make 
sharedmods:

| openat(AT_FDCWD, 
"/data/poky-tmp/master/work/corei7-64-poky-linux/python3/3.7.2-r0/build/build/lib.linux-x86_64-3.7/_heapq.cpython-37m-x86_64-linux-gnu.so",
 O_RDONLY|O_CLOEXEC) = 3
| read(3, 
"\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\20\0\0\0\0\0\0"..., 832) = 
832
| fstat(3, {st_mode=S_IFREG|0755, st_size=62104, ...}) = 0
| mmap(NULL, 23880, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f93d7cb9000
| mmap(0x7f93d7cba000, 4096, PROT_READ|PROT_EXEC, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1000) = 0x7f93d7cba000
| mmap(0x7f93d7cbb000, 4096, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 
0x2000) = 0x7f93d7cbb000
| mmap(0x7f93d7cbc000, 12288, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f93d7cbc000
| close(3)= 0
| mprotect(0x7f93d7cbc000, 4096, PROT_READ) = 0
| --- SIGILL {si_signo=SIGILL, si_code=ILL_ILLOPN, si_addr=0x7f93d7cbab10} ---
| +++ killed by SIGILL (core dumped) +++
| Illegal instruction
| Makefile:625: recipe for target 'sharedmods' failed

We do have patches but I don't think they affect this part of the build.

--

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



[issue36159] Modify Formatter Class to handle arbitrary objects

2019-03-01 Thread Ross Biro


New submission from Ross Biro :

The only point in the string.Formatter class that really depends on string 
output is line 245: return ''.join(result), auto_arg_index.  

I'm currently working on a problem that would be much easier if I could get 
access to the result list instead of having that join called.

I propose creating another overridable method in string.Formatter, say oformat 
that calls _vformat and is called by vformat. oformat would have the guts of 
vformat and just return the result list.  vformat would then consist of the 
call ot oformat and the join.  See Below.  The recursive call to _vformat would 
also need some slight modification.

The work would not be difficult and I'm willing to do it, provided there is 
sufficient interest.

def vformat(self, format_string, args, kwargs):
result = self.oformat(format_string, args, kwargs)
return ''.join(result)

def oformat(self, format_string, args, kwargs):
used_args = set()
result, _ = self._vformat(format_string, args, kwargs, used_args, 2)
self.check_unused_args(used_args, args, kwargs)
return result

--
components: Library (Lib)
messages: 336945
nosy: Ross Biro
priority: normal
severity: normal
status: open
title: Modify Formatter Class to handle arbitrary objects
type: enhancement
versions: Python 2.7, Python 3.8

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



[issue36125] Cannot cross-compile to more featureful but same tune

2019-02-26 Thread Ross Burton


Ross Burton  added the comment:

>From what I can tell:

configure.ac sets PYTHON_FOR_BUILD like this if cross-compiling:

PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) 
_PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f 
pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib 
_PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH) 
'$interp

Note how PYTHONPATH is set to the source and build paths for Lib/.

The intention appears to be that the sysconfig.py in the build is used.  In my 
case that directory is also full of shared libraries that Python happily loads, 
and then fails.

--

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



[issue36125] Cannot cross-compile to more featureful but same tune

2019-02-26 Thread Ross Burton


New submission from Ross Burton :

My build machine is a Haswell Intel x86-64. I'm cross-compiling to x86-64, with 
-mtune=Skylake -avx2.  During make install PYTHON_FOR_BUILD loads modules from 
the *build* Lib/ which contain instructions my Haswell can't execute:

| 
_PYTHON_PROJECT_BASE=/data/poky-tmp/master/work/corei7-64-poky-linux/python3/3.7.2-r0/build
 _PYTHON_HOST_PLATFORM=linux-x86_64 PYTHONPATH=../Python-3.7.2/Lib 
_PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_m_linux_x86_64-linux-gnu python3.7 -v 
-S -m sysconfig --generate-posix-vars ;\
Illegal instruction

--
components: Build
messages: 336688
nosy: rossburton
priority: normal
severity: normal
status: open
title: Cannot cross-compile to more featureful but same tune
versions: Python 3.7

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



[issue34585] Don't use AC_RUN_IFELSE to determine float endian

2018-09-06 Thread Ross Burton


Change by Ross Burton :


--
pull_requests: +8543
stage:  -> patch review

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



[issue34585] Don't use AC_RUN_IFELSE to determine float endian

2018-09-05 Thread Ross Burton


New submission from Ross Burton :

Currently configure.ac uses AC_RUN_IFELSE to determine the byte order of floats 
and doubles.  This hurts when cross-compiling because a default is set, 
resulting in Python silently falling back to sub-optimal codepaths.

A partial improvement would be to not set a fallback, to force the user to set 
the right byte order explicitly.

However this test can be done without running anything.  autoconf-archive has a 
macro that uses a carefully constructed double that encodes to an ASCII string 
in the binary, which is then examined using grep.  Evil genius.

Attached is a POC using this.  Currently the autoconf-archive macro only 
handles big and little endian not the ARM OABI mixed-endian format, so 
configure.ac assumes if the byte order is unknown then it's the crazy 
mixed-endian.

To be honest OABI is so old now, I don't believe anyone actually uses it 
anymore: everyone still on ARMv4 should have moved to EABI many years ago, and 
the mixed-endian support could be removed from Py3 in the future.

--
components: Build
files: 0001-Don-t-do-runtime-test-to-get-float-byte-order.patch
keywords: patch
messages: 324627
nosy: rossburton
priority: normal
severity: normal
status: open
title: Don't use AC_RUN_IFELSE to determine float endian
versions: Python 3.8
Added file: 
https://bugs.python.org/file47788/0001-Don-t-do-runtime-test-to-get-float-byte-order.patch

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



Re: How to start gnuradio

2018-07-31 Thread Ross Wilson
I had a paddle through the manual at
https://www.gnuradio.org/doc/doxygen/page_python_blocks.html and apparently
some DSP operations use numpy.

Ross

On Wed, 1 Aug 2018 at 11:56  wrote:

>
>
> After some research I found out that "sudo apt-get install python-numpy"
> solved the problem.
>
> Can anyone clarify how python-numpy solves the problem?
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Meaning of abbreviated terms

2018-05-12 Thread Ross Wilson
The "plist" abbreviation goes back to at least 1958 as it was used in 
the Lisp implementation [0].  And it may even predate Lisp.  I'm very 
sure that what actually went into a plist has often changed over the 
years, but the name persists.


Lisp also used "association lists" [1] which were a key/value data 
structure, usually called an "alist" or "a-list".


Ross

[0] https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node108.html
[1] https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node153.html


On 12/5/2561 BE 13:45, Bob Martin wrote:

in 793617 20180511 072806 Steven D'Aprano 
<steve+comp.lang.pyt...@pearwood.info> wrote:

On Fri, 11 May 2018 07:20:36 +, Bob Martin wrote:


in 793605 20180511 044309 T Berger <brg...@gmail.com> wrote:

On Saturday, May 5, 2018 at 6:45:46 PM UTC-4, MRAB wrote:

On 2018-05-05 17:57, T Berger wrote:

What does the "p" in "plist" stand for? Is there a python glossary
that spells out the meanings of abbreviated terms?


"plist" is "property list". It's listed in the Python documentation.

Thanks for the answer. Missed it till now.

In IBM-speak it was parameter list.



But that's not where plists came from, was it? As I understand it, the
plist data format was invented by Apple, and they called it a property
list.

How old is Apple?
I was using plist for parameter list in OS/360 in 1965.


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


Re: virtualenv doesn't see my compiled tensorflow

2017-09-01 Thread ross
Solution: remember to run the 'activate' script:

% source ~/tf_compile/tensorflow/bin/activate


On Friday, September 1, 2017 at 2:39:33 PM UTC-7, ro...@cgl.ucsf.edu wrote:
> With the prebuilt version of tensorflow, I did:
> 
>virtualenv --system-site-packages  ~/tensorflow
> 
> and somehow got it working with keras. Now I've compiled tensorflow in 
> another shell/directory, where to start with I did:
> 
>virtualenv --system-site-packages  .
> 
> and I got it running with keras on my net, with a nice speedup. Then I went 
> back to my previous shell, did a deactivate, then
> 
> virtualenv --system-site-packages ~/tf_compile/tensorflow
> 
> to point to the dir that was '.' above, but my prompt path did not pick up 
> '(tensorflow)' as before:
> 
> % virtualenv --system-site-packages ~/tf_compile/tensorflow
> New python executable in /Users/priot/tf_compile/tensorflow/bin/python
> Installing setuptools, pip, wheel...done.
> priot keras%
> 
> and I get:
> 
> % python prog.py
>   ...
>   File "/Users/ppp/anaconda/lib/python2.7/site-
>   packages/keras/backend/tensorflow_backend.py", line 1, in 
> import tensorflow as tf
>   ImportError: No module named tensorflow
> 
> Seems inconsistent.
> 
> % virtualenv --version
> 15.1.0
> 
> % python --version
> Python 2.7.10 :: Anaconda custom (x86_64)
> 
> OS: OSx Darwin

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


virtualenv doesn't see my compiled tensorflow

2017-09-01 Thread ross
With the prebuilt version of tensorflow, I did:

   virtualenv --system-site-packages  ~/tensorflow

and somehow got it working with keras. Now I've compiled tensorflow in another 
shell/directory, where to start with I did:

   virtualenv --system-site-packages  .

and I got it running with keras on my net, with a nice speedup. Then I went 
back to my previous shell, did a deactivate, then

virtualenv --system-site-packages ~/tf_compile/tensorflow

to point to the dir that was '.' above, but my prompt path did not pick up 
'(tensorflow)' as before:

% virtualenv --system-site-packages ~/tf_compile/tensorflow
New python executable in /Users/priot/tf_compile/tensorflow/bin/python
Installing setuptools, pip, wheel...done.
priot keras%

and I get:

% python prog.py
  ...
  File "/Users/ppp/anaconda/lib/python2.7/site-
  packages/keras/backend/tensorflow_backend.py", line 1, in 
import tensorflow as tf
  ImportError: No module named tensorflow

Seems inconsistent.

% virtualenv --version
15.1.0

% python --version
Python 2.7.10 :: Anaconda custom (x86_64)

OS: OSx Darwin
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26350] Windows: signal doc should state certains signals can't be registered

2017-08-08 Thread Ross Rosen

Ross Rosen added the comment:

I'm not sure if this is helpful, but I thought it might be useful for you to 
hear a non-expert user's perspective.  (In summary, I'm agreeing with the OP.)

I spent a lot of time getting some signal handling working on OSX. Then finally 
in my process got to porting to Windows. I spent a bunch more time scratching 
my head trying to figure out why it wasn't working. Even after reading the 
os.kill and signal docs and searching for "Windows" I still wasn't clear what 
was wrong.  

This thread was the answer. 

So my suggestion at the least would be to put warnings in the signal doc, and 
clarify the language in the os.kill.

--
nosy: +Ross Rosen

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



error in syntax description for comprehensions?

2017-03-30 Thread Boylan, Ross
https://docs.python.org/3/reference/expressions.html#displays-for-lists-sets-and-dictionaries
describes the syntax for comprehensions as
comprehension ::=  expression comp_for
comp_for  ::=  [ASYNC] "for" target_list "in" or_test [comp_iter]
comp_iter ::=  comp_for | comp_if
comp_if   ::=  "if" expression_nocond [comp_iter]

Is the comp_for missing an argument after "in"?
One has to follow the definition of or_test and its components, but I can't 
find anything that results to a single variable or expression.

Actually, I'm not sure what or_test would do there either with or  without an 
additional element following "in". 

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


RE: how to control formatting of a namedtuple in a list

2016-11-17 Thread Boylan, Ross
Actually,
>> print(list(foo, bar))
Traceback (most recent call last):  

  File "", line 1, in

TypeError: list() takes at most 1 argument (2 given)   

Though 
>>> [foo, bar]
['ham, eggs, cheese', 'bacon, toast'] 
which admittedly would be confusing if the strings weren't quoted. But display, 
or formatted values, are not intended to allow reconstruction of the objects; 
that's what repr is for. 

The argument that the display of list is already low-level, and so everything 
inside the list should be displayed low-level, seems a bit of a stretch.

Overriding repr is serviceable for me, but it requires violating the intended 
semantics of repr, namely that the result could be converted back to the 
original object. I'm trying to get a display that has only some of the 
information in the object.  My understanding is that str is supposed to provide 
that.

At any rate, I agree there are reasons to use repr inside a list.

Ross

From: Python-list [python-list-bounces+ross.boylan=ucsf@python.org] on 
behalf of Ethan Furman [et...@stoneleaf.us]
Sent: Thursday, November 17, 2016 4:18 PM
To: python-list@python.org
Subject: Re: how to control formatting of a namedtuple in a list

On 11/17/2016 04:09 PM, MRAB wrote:
> On 2016-11-17 23:49, Boylan, Ross wrote:

>> Thank you; I can confirm that overriding __repr__ makes the list display as 
>> I wanted.
>>
>> The decision to use repr inside the list seems very odd, given the context, 
>> namely formatting something for display or looking for a simple string 
>> representation.  It seems more natural to me to use str or, if in a format, 
>> the default formatting all the way down.  Is there a good reason it's repr?
>
> Given a string, say:
>
> >>> s = 'foo'
>
> str shows:
>
> >>> print(str(s))
>
> whereas repr shows:
>
> >>> print(repr(s))
> 'foo'
>
> If it was in a list, would you want it to show:
>
> [foo]
>
> or:
>
> ['foo']
>
> ?

Another example:

  >>> foo = 'ham, eggs, cheese'
  >>> bar = 'bacon, toast'

if list used str instead of repr:

  >>> print(list(foo, bar))
  [ham, eegs, cheese, bacon, toast]

How many items are in that list?  (Hint: it isn't 5. ;)

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


RE: how to control formatting of a namedtuple in a list

2016-11-17 Thread Boylan, Ross
Thank you; I can confirm that overriding __repr__ makes the list display as I 
wanted.

The decision to use repr inside the list seems very odd, given the context, 
namely formatting something for display or looking for a simple string 
representation.  It seems more natural to me to use str or, if in a format, the 
default formatting all the way down.  Is there a good reason it's repr?

Ross

From: Python-list [python-list-bounces+ross.boylan=ucsf@python.org] on 
behalf of Chris Angelico [ros...@gmail.com]
Sent: Thursday, November 17, 2016 3:24 PM
To: python-list@python.org
Subject: Re: how to control formatting of a namedtuple in a list

On Fri, Nov 18, 2016 at 10:04 AM, Boylan, Ross <ross.boy...@ucsf.edu> wrote:
> Even after defining custom __str__ and __format__ methods they don't affect 
> the display of objects when they are in a list.  Is there a way to change 
> that, other than explicitly converting each list element to a string?
>

Yep! Inside a list, it's the repr that gets shown. So you should be
able to do this:

class Foo(namedtuple("Foo", "x")):
def __repr__(self):
  return "foolish({})".format(self.x)

This will also affect the other forms - if you don't define __str__,
it'll use __repr__. So this should be all you need.

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


how to control formatting of a namedtuple in a list

2016-11-17 Thread Boylan, Ross
Even after defining custom __str__ and __format__ methods they don't affect the 
display of objects when they are in a list.  Is there a way to change that, 
other than explicitly converting each list element to a string?

The last line of output below shows that when I format the list I get standard 
formatting of my objects instead of my custom format.

Code
#! /usr/bin/python3
from collections import namedtuple

class Foo(namedtuple("Foo", "x")):
__slots__ = ()

def __str__(self):
  return "foolish({})".format(self.x)

def __format__(self, spec):
  return self.__str__()

f=Foo(4)
print(f)
print(str(f))
print("{}".format(f))
print("{}".format([f]))  # a list with one f

Output
foolish(4)
foolish(4)
foolish(4)
[Foo(x=4)]

I'm running Python 3.4.

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


How to get Read the Docs to generate py-modindex.html?

2016-08-29 Thread Charles Ross
Since I appear to be experiencing one of the few times that Stack Overflow 
hasn’t provided any quick answers to a problem 
(http://stackoverflow.com/questions/39197037/how-to-get-read-the-docs-to-generate-py-modindex-html
 
),
 I’ll try posting my question here and see if anyone has a suggestion.

I'm trying to get Read the Docs to generate the `py-modindex.html` file. 
Research into a related question lead me to the following setup:

- `setup.py` in the project directory has the following contents, which were 
the minimum needed to get `pytest` to work and haven't been changed since I got 
that part of my project working:

import setuptools

setuptools.setup(
name='polygons',
packages=setuptools.find_packages(),
)

- `docs/requirements.txt` contains a single line:

sphinx-autodoc-annotation

- The Read the Docs repository URL points to my repository 
(https://github.com/chivalry/polygons).
- The RtD setting for "Install your project inside a virtualenv using setup.py 
install" is checked.
- The RtD setting for "Requirements file" points to `docs/requirements.txt`.

The "Module Index" link gets included in `index.html` 
(http://polygons.readthedocs.io/en/latest/), but the `py-modindex.html` file is 
missing.

My understanding is that with the virtualenv setting above, RtD will use the 
`setup.py` file to install the project so that Sphinx can read the 
documentation found in the Python docstrings. I'm using function annotations 
and would like `sphyinx-autodoc-annotation` to make use of those when creating 
the built docs files. All of this works splendidly on my local machine when I 
run `make html` while in the `docs` folder. Now I'm trying to get it to work on 
Read the Docs.

Thanks,
Chuck

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


Meta Python Chapter 3 Available

2016-08-12 Thread Charles Ross
I’ve completed a first draft of Chapter 3: Modules (and Packages) of the Meta 
Python book. Feedback from novices and experts alike would be welcome.

https://github.com/chivalry/meta-python 


Thanks,
Chuck
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Call for Assistance

2016-08-09 Thread Charles Ross
Well, I’ve been convinced. The license for the book is now Creative Commons 
Attribution-ShareAlike.

https://github.com/chivalry/meta-python/blob/master/LICENSE.md

Thanks,
Chuck

> On Aug 9, 2016, at 3:00 PM, Charles Ross <chiva...@mac.com> wrote:
> 
>> CC-BY-NC-SA is not a license for free (as in speech) content. Is that
>> what you want?
> 
> I really appreciate all the conversation about the license. Perhaps I made a 
> mistake with requiring noncommercial in the license, I don’t know, but I’ll 
> look at the links provided about free documentation and free software and see 
> if I can understand the issues more and perhaps make a better decision.
> 
> Honestly, I have no expectation that this book will ever be anything more 
> than a (hopefully) useful resource for others like myself, as described in 
> the current introduction. I might have a remote hope that it would be 
> something that would receive attention from a traditional publisher, but that 
> remote hope is in the same category as a remote hope that a distant rich 
> uncle will someday name me in his well. So, given the minuscule odds of that 
> happening, I’ll probably remove the NC portion. I’ll just do a bit of 
> research first with those links.
> 
> Thanks,
> Chuck
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: Call for Assistance

2016-08-09 Thread Charles Ross
> CC-BY-NC-SA is not a license for free (as in speech) content. Is that
> what you want?

I really appreciate all the conversation about the license. Perhaps I made a 
mistake with requiring noncommercial in the license, I don’t know, but I’ll 
look at the links provided about free documentation and free software and see 
if I can understand the issues more and perhaps make a better decision.

Honestly, I have no expectation that this book will ever be anything more than 
a (hopefully) useful resource for others like myself, as described in the 
current introduction. I might have a remote hope that it would be something 
that would receive attention from a traditional publisher, but that remote hope 
is in the same category as a remote hope that a distant rich uncle will someday 
name me in his well. So, given the minuscule odds of that happening, I’ll 
probably remove the NC portion. I’ll just do a bit of research first with those 
links.

Thanks,
Chuck
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Call for Assistance

2016-08-09 Thread Charles Ross
You’re right. I should have mentioned that this is a volunteer effort on my 
part and anyone else who becomes involved. It’s being released under the 
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License 
(http://creativecommons.org/licenses/by-nc-sa/4.0/ 
<http://creativecommons.org/licenses/by-nc-sa/4.0/>) as demonstrated by the 
LICENSE.md file at the GitHub repository 
(https://github.com/chivalry/meta-python/blob/master/LICENSE.md 
<https://github.com/chivalry/meta-python/blob/master/LICENSE.md>).

I don’t yet know precisely how the “book” will be published. I might just leave 
it as a set of GitHub files or export the Markdown to other format to be hosted 
outside GitHub. I’m not worrying yet about publishing, only clarity and 
correctness of content.

Thanks,
Chuck

> On Aug 9, 2016, at 1:17 AM, Steven D'Aprano 
> <steve+comp.lang.pyt...@pearwood.info> wrote:
> 
> On Tuesday 09 August 2016 11:52, Charles Ross wrote:
> 
>> I’ve begun a new book called Meta Python that I’m looking for assistance
>> with.
> 
> Are you looking for people to be co-authors? Are you offering payment, or 
> credit? A free copy of the book? A kick to the head? Or just looking for 
> volunteers to provide content for the book while you lie back on a beach in 
> the 
> Bahamas collecting the millions[1] in royalties?
> 
> 
> 
> 
> 
> [1] Zimbabwean dollars.
> 
> -- 
> Steve
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Call for Assistance

2016-08-09 Thread Charles Ross
I’ve begun a new book called Meta Python that I’m looking for assistance with. 
The book is one I wish was out there, and so am writing. The book is targeted 
at experienced programmers who are novice Python users and want to move from 
that point to one where they have published to PyPI.

I’m specifically looking for three types of users to assist me:

- Expert Python developers who are willing to confirm and correct the technical 
details, since I’m getting to the material that I want to learn and therefore 
need to teach. So far that only really includes virtual environments, covered 
in chapter 2, but will soon include many other topics.
- Developers like me, who aren’t new to programming but are perhaps new to 
Python and certainly new to publishing to PyPI, and who can provide feedback on 
the clarity and usefulness of the content.
- Linux and Windows Python users who would be willing to assist in making the 
book a bit less Mac-centric.

The book is being hosted at https://github.com/chivalry/meta-python 
. The introduction and first two 
chapters have their initial drafts complete, but you’ll see a few “TODOs” in 
there. Any and all feedback is appreciated, and preferred through the GitHub 
Issues system, but feel free to email me if you prefer.

Thanks,
Chuck

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


[issue23144] html.parser.HTMLParser: setting 'convert_charrefs = True' leads to dropped text

2015-01-01 Thread Ross

New submission from Ross:

If convert_charrefs is set to true the final data section is not return by 
feed(). It is held until the next tag is encountered.

---
from html.parser import HTMLParser

class MyHTMLParser(HTMLParser):
def __init__(self):
HTMLParser.__init__(self, convert_charrefs=True)
self.fed = []
def handle_starttag(self, tag, attrs):
print(Encountered a start tag:, tag)
def handle_endtag(self, tag):
print(Encountered an end tag :, tag)
def handle_data(self, data):
print(Encountered some data  :, data)

parser = MyHTMLParser()

parser.feed(foo alink/a bar)
print()
parser.feed(spam alink/a eggs)

---

gives

Encountered some data  : foo 
Encountered a start tag: a
Encountered some data  : link
Encountered an end tag : a

Encountered some data  :  barspam 
Encountered a start tag: a
Encountered some data  : link
Encountered an end tag : a


With 'convert_charrefs = False' it works as expected.

--
components: Library (Lib)
messages: 233291
nosy: xkjq
priority: normal
severity: normal
status: open
title: html.parser.HTMLParser: setting 'convert_charrefs = True' leads to 
dropped text
type: behavior
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23144
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23144] html.parser.HTMLParser: setting 'convert_charrefs = True' leads to dropped text

2015-01-01 Thread Ross

Ross added the comment:

That would make sense.

Might also be worth mentioning the difference in behaviour with 
convert_charrefs = True/False as that was what led me to think this was a bug.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23144
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23070] Error in Tutorial comment

2014-12-16 Thread Ross Burnett

New submission from Ross Burnett:

In section 3.1.2. Strings of the Tutorial (version 3.4 plus others?), a 
comment on a slicing error has an error:

word[42]  # the word only has 7 characters

It should say word[42]  # the word has 6 characters

--
assignee: docs@python
components: Documentation
messages: 232795
nosy: docs@python, rossburnett
priority: normal
severity: normal
status: open
title: Error in Tutorial comment
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23070
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



What is the difference between 32 and 64 bit Python on Windows 7 64 bit?

2014-05-11 Thread Ross Gayler
Hi,

I want to install Python on a PC with 16GB of RAM and the 64 bit version of
Windows 7.
I want Python to be able to use as much as possible of the RAM.

When I install the 64 bit version of Python I find that sys.maxint ==
2**31  - 1
Whereas the Pythpon installed on my 64 bit linux system returns sys.maxint
== 2**63 - 1.


It looks to me as though 32 and 64 bit versions of Python on 64 bit Windows
are both really 32 bit Python, differing only in how they interact with
Windows. So I wouldn't expect 64 bit Python running on 64 bit Windows to
allow the large data struictures I could have with 64 bit Python running on
64 bit linux.

Is that true?I have spent a couple of hours searching for a definitive
description of the difference between the 32 and 64 bit versions of Python
for Windows and haven't found anything.

Thanks

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


Try-except-finally paradox

2014-01-29 Thread Jessica Ross
I found something like this in a StackOverflow discussion.
 def paradox():
... try:
... raise Exception(Exception raised during try)
... except:
... print Except after try
... return True
... finally:
... print Finally
... return False
... return None
... 
 return_val = paradox()
Except after try
Finally
 return_val
False

I understand most of this.
What I don't understand is why this returns False rather than True. Does the 
finally short-circuit the return in the except block?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue17552] socket.sendfile()

2013-03-27 Thread Ross Lagerwall

Changes by Ross Lagerwall rosslagerw...@gmail.com:


--
nosy: +rosslagerwall

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17552
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17495] email.quoprimime.body_encode can't handle characters that encodings.quopri_codec can

2013-03-20 Thread Ross Patterson

New submission from Ross Patterson:

When using email.charset.Charset to encode MIME bodie as quoted-printable, some 
characters that are encodable with the quopri_codec cause a KeyError in 
email.quoprimime:

Python 3.3.0 (default, Oct  7 2012, 14:43:21) 
[GCC 4.6.3] on linux
Type help, copyright, credits or license for more information.
 text_encoded = b'mo \xe2\x82\xac'
 text = text_encoded.decode('utf-8')
 print(text)
mo €
 import codecs
 codecs.getencoder('quopri_codec')(text_encoded)[0]
b'mo=20=E2=82=AC'
 from email import charset
 c = charset.Charset('utf-8')
 c.header_encoding = charset.QP
 c.body_encoding = charset.QP
 c.header_encode(text)
'=?utf-8?q?mo_=E2=82=AC?='
 c.body_encode(text)
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python3.3/email/charset.py, line 395, in body_encode
return email.quoprimime.body_encode(string)
  File /usr/lib/python3.3/email/quoprimime.py, line 240, in body_encode
if body_check(ord(c)):
  File /usr/lib/python3.3/email/quoprimime.py, line 81, in body_check
return chr(octet) != _QUOPRI_BODY_MAP[octet]
KeyError: 8364

--
components: email
messages: 184772
nosy: barry, r.david.murray, rpatterson
priority: normal
severity: normal
status: open
title: email.quoprimime.body_encode can't handle characters that 
encodings.quopri_codec can
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17495
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17495] email.quoprimime.body_encode can't handle characters that encodings.quopri_codec can

2013-03-20 Thread Ross Patterson

Ross Patterson added the comment:

What is the reason that email.quoprimime doesn't use 
codecs.getencoder('quopri_codec') to do the actual character encoding?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17495
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17495] email.quoprimime.body_encode can't handle characters that encodings.quopri_codec can

2013-03-20 Thread Ross Patterson

Ross Patterson added the comment:

I thought I had tested it under 2.7, but I'm not entirely sure.

--
versions:  -Python 2.6, Python 2.7, Python 3.1, Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17495
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17495] email.quoprimime.body_encode can't handle characters that encodings.quopri_codec can

2013-03-20 Thread Ross Patterson

Changes by Ross Patterson m...@rpatterson.net:


--
resolution:  - duplicate
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17495
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Excel column 256 limit

2013-03-19 Thread Michael Ross

On Tue, 19 Mar 2013 15:07:54 +0100, Neil Cerutti ne...@norwich.edu wrote:


On 2013-03-18, Ana Dion?sio anadionisio...@gmail.com wrote:

But I still get the error and I use Excel 2010.

I'm trying to export data in a list to Excel


xlrd: Library for developers to extract data from Microsoft Excel
(tm).

It is for *reading* Excel files, not writing them. To get data
into Excel use the csv module and create the file using the
default 'excel-csv' format. Then load the file using Excel.

Creating an Excel file directly in Python is possible, but I
think it will require use of the Pywin32 extensions.



I use and recommend http://pythonhosted.org/openpyxl/ for creating Excel  
files from Python.

No trouble so far.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Excel column 256 limit

2013-03-18 Thread Michael Ross
On Mon, 18 Mar 2013 16:50:21 +0100, Steven D'Aprano  
steve+comp.lang.pyt...@pearwood.info wrote:



On Mon, 18 Mar 2013 08:28:46 -0700, Ana Dionísio wrote:


Is there some way to go around this limit? I need to import data from
python to excel and I need 1440 columns for that.


That's an Excel question, it has nothing to do with Python.

Have you considered using something other than Excel? As I understand it,
OpenOffice, LibreOffice, and Gnumeric do not have a 256 column limit.


Just for completeness:
Excel in it's Office 2010 version does not have a 256 column limit  
either.

I can use  2000 columns without problem.
--
http://mail.python.org/mailman/listinfo/python-list


[issue17428] replace readdir to readdir_r in function posix_listdir

2013-03-16 Thread Ross Lagerwall

Ross Lagerwall added the comment:

That text was from the POSIX 2008 spec:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/readdir.html

The following text from my copy of the readdir manpage gives an indication of 
how you *should* allocate struct dirent when using readdir_r:

Since  POSIX.1 does not specify the size of the d_name field, and other 
nonstandard fields may precede that field within the dirent structure, portable 
applications that use readdir_r() should allocate the buffer whose address is 
passed in entry as follows:

   name_max = pathconf(dirpath, _PC_NAME_MAX);
   if (name_max == -1) /* Limit not defined, or error */
   name_max = 255; /* Take a guess */
   len = offsetof(struct dirent, d_name) + name_max + 1;
   entryp = malloc(len);

(POSIX.1 requires that d_name is the last field in a struct dirent.)


I hope that helps

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17428
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17428] replace readdir to readdir_r in function posix_listdir

2013-03-15 Thread Ross Lagerwall

Ross Lagerwall added the comment:

Hi,

There shouldn't be a problem with the existing implementation since, according 
to posix:

The pointer returned by readdir() points to data which may be overwritten by 
another call to readdir() on the same directory stream. This data is not 
overwritten by another call to readdir() on a different directory stream.


Since each call to listdir() opens a different directory stream, this shouldn't 
be a problem.

Also, when using readdir_r(), struct dirent should not be allocated on the 
stack since the last field may be an unspecified size.
See the following for further reading about this:
http://elliotth.blogspot.co.uk/2012/10/how-not-to-use-readdirr3.html
http://womble.decadent.org.uk/readdir_r-advisory.html

Regards

--
nosy: +rosslagerwall

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17428
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: An error when i switched from python v2.6.6 = v3.2.3

2013-03-07 Thread Michael Ross
On Thu, 07 Mar 2013 12:27:03 +0100, Νίκος Γκρ33κ nikos.gr...@gmail.com  
wrote:


Τη Πέμπτη, 7 Μαρτίου 2013 11:06:27 π.μ. UTC+2, ο χρήστης Νίκος Γκρ33κ  
έγραψε:

Any ideas about the error please?



I can assure you all the statemnt are correct ebcause they work in  
python v2.6.6


can someone help this issue so my webiste will get back on working plz?


MySQLdb is python 2 only.
MySQL-3.23 through 5.0 and Python-2.3 through 2.7 are currently  
supported. Python-3.0 will be supported in a future release.


Maybe try this one:
https://pypi.python.org/pypi/mysql-connector-python/1.0.9

Alternatively,
forget about subprocess.check_output,
call your metrites.py with os.system('python metrites.py some-temp-file')
and have it write its output to some-temp-file,
and read some-temp-file back into your template?

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


Re: An error when i switched from python v2.6.6 = v3.2.3

2013-03-07 Thread Michael Ross
On Thu, 07 Mar 2013 13:25:58 +0100, Νίκος Γκρ33κ nikos.gr...@gmail.com  
wrote:


Τη Πέμπτη, 7 Μαρτίου 2013 1:51:42 μ.μ. UTC+2, ο χρήστης Michael Ross  
έγραψε:

On Thu, 07 Mar 2013 12:27:03 +0100, Νίκος Γκρ33κ nikos.gr...@gmail.com

wrote:



 Τη Πέμπτη, 7 Μαρτίου 2013 11:06:27 π.μ. UTC+2, ο χρήστης Νίκος Γκρ33κ

 έγραψε:

 Any ideas about the error please?







 I can assure you all the statemnt are correct ebcause they work in

 python v2.6.6



 can someone help this issue so my webiste will get back on working  
plz?




MySQLdb is python 2 only.

MySQL-3.23 through 5.0 and Python-2.3 through 2.7 are currently

supported. Python-3.0 will be supported in a future release.



Maybe try this one:

https://pypi.python.org/pypi/mysql-connector-python/1.0.9



Alternatively,

forget about subprocess.check_output,

call your metrites.py with os.system('python metrites.py  
some-temp-file')


and have it write its output to some-temp-file,

and read some-temp-file back into your template?


Yes its better for me to give upon python3 for the moment being, because  
all that hassle was for makeing the subprocess command run.


Now i just followed your advice and tried:

elif htmlpage.endswith('.py'):
		htmldata = os.system('/usr/bin/python ./metrites.py  
/data/files/htmltemp')


but produced error tells me that:

template undefined, htmldata = -1, counter = ' centera  
href=mailto:supp...@superhost.gr; ...st.gr/?show=statsfont  
color=cyan 0 /td\n\t\t '


whay htmldata reeturn the value '-1' when os.sytem is executed?


Because
On Unix, the return value is the exit status of the process encoded in  
the format specified for wait().


It's in the documentation for os.system.
Which you should have read before asking here.

You may not intend it like that,
but if you ask any and all errors here, you effectively ask the list to  
develop the software for you.


Seriously this is beyond the scope of volunteer help for a commercial site.
I'm bailing out.
--
http://mail.python.org/mailman/listinfo/python-list


Re: sync databse table based on current directory data without losign previous values

2013-03-06 Thread Michael Ross
On Wed, 06 Mar 2013 12:52:00 +0100, Mark Lawrence  
breamore...@yahoo.co.uk wrote:



On 06/03/2013 07:45, Νίκος Γκρ33κ wrote:
I'am using this snipper to read a current directory and insert all  
filenames into a databse and then display them.


But what happens when files are get removed form the directory?
The inserted records into databse remain.
How can i update  the databse to only contain the existing filenames  
without losing the previous stored data?


Here is what i ahve so far:

==
path = /home/nikos/public_html/data/files/

#read the containing folder and insert new filenames
for result in os.walk(path):


You were told yesterday at least twice that os.walk returns a tuple but  
you still insist on refusing to take any notice of our replies when it  
suits you, preferring instead to waste everbody's time with these  
questions.  Or are you trying to get into the Guinness Book of World  
Records for the laziest bastard on the planet?


Hold on a sec ...

He has

for result in os.walk(path):
for filename in result[2]:

So he *did* take notice of that.


Nikos:
Expectation is to iterate through a tuple like this:

for dirpath, dirnames, filenames in os.walk(path):
...







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


Re: Inserting-embedding some html data at the end of a .py file

2013-03-06 Thread Michael Ross
On Thu, 07 Mar 2013 00:18:44 +0100, Νίκος Γκρ33κ nikos.gr...@gmail.com  
wrote:


Τη Τετάρτη, 6 Μαρτίου 2013 2:06:33 π.μ. UTC+2, ο χρήστης Michael Ross  
έγραψε:



check_output is available as of Python 2.7
I guess you are still on version 2.6 ?



I can access each of these from my jailed shell user account without  
issue, and especially i try /usr/bin/python3


ni...@superhost.gr [~]# /usr/bin/python -V
Python 2.6.6

ni...@superhost.gr [~]# /opt/python3/bin/python3 -V
Python 3.2.3

ni...@superhost.gr [~]# /usr/bin/python3 -V
Python 3.2.3


Problem is that when i change my shebang constructor to  
#!/sur/bin/python3 my '/cgi-bin/metrites.py' python cgi scripts produces  
an internal server error while with #!/sur/bin/python the script works.


Any ideas as to why? I can post ocde if you want to.



You need to post the Traceback.

Either run /usr/bin/python3 /cgi-bin/metrites.py on the shell
or better look in your webserver error log.

Guess:
In Python 3 print is a function.
So
print something
will not work. You need to
print(something)
--
http://mail.python.org/mailman/listinfo/python-list


Re: Do you feel bad because of the Python docs?

2013-03-06 Thread Michael Ross
On Thu, 07 Mar 2013 02:28:10 +0100, Chris Kaynor  
ckay...@zindagigames.com wrote:



I actually just tried that, and the results weren't very good.

Using the doc's search feature, the Reporting Bugs (and the About  
these documents) page was significantly down the page (about 2/3 of  
the way) - not the most obvious result in the pile. All the other  
searches I could think of either didn't return either of those pages at  
all, or they were also 1/2-2/3 of the way down the page.





Using Google it took me about 3 seconds to find the page.

python report doc bug.

Works with Bing or DuckDuckGo too. First hit on either engine.

The doc's search is ... fine if I search for e. g. 'subprocess.Popen',
but near-useless for general searches.




The link is also on the main documentation page, but it is, again, near  
the bottom, making it hidden from many users. Both of them show up just  
above the bottom of the window with it maximized on my screen.




The first of the issues may be difficult to fix,


Is it?
You'd just have to have an additional search box labeld search whole page  
with google/bing/whatever (?)





but would likely be fairly useful - that would generally be my first  
port of call. The second one is more minor as most people will scroll  
down to see whats farther down, if they go to the main page to find the  
links.




Chris



On Wed, Mar 6, 2013 at 5:06 PM, alex23 wuwe...@gmail.com wrote:



On Mar 7, 10:47 am, Rick Johnson rantingrickjohn...@gmail.com wrote:


That's great Terry, but how will the next person find the link?




Why do you have such a low opinion of others that you think they're

unable to look up Reporting Bugs in the _documentation_?

--

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




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


Re: Inserting-embedding some html data at the end of a .py file

2013-03-05 Thread Michael Ross
On Tue, 05 Mar 2013 21:04:59 +0100, Νίκος Γκρ33κ nikos.gr...@gmail.com  
wrote:



#open html template
if htmlpage.endswith('.html'):
f = open( /home/nikos/public_html/ + htmlpage )

htmldata = f.read()
		counter = ''' centera href=mailto:supp...@superhost.gr; img  
src=/data/images/mail.png /a

  centertable border=2 cellpadding=2 
bgcolor=black
  tdfont color=limeΑριθμός 
Επισκεπτών/td
	  tda href=http://superhost.gr/?show=stats;font color=cyan  
%d /td

  ''' % data[0]

#render template
template = htmldata + counter
print ( template )

Yes the aboev code does work if we talk about appending html data to an  
already html file!


But if the file is some_python.py file then i cannot just append the  
data.
Actually by appending i dont want to actually insert the data to the end  
of the .py file, thus altering it but instead run the .py file and print  
the counter html data afterwards!



subprocess.checkoutput() ?

if htmlpage.endswith('.py'):
htmldata=subprocess.check_output(...)
counter=...
template=htmldata+counter

http://docs.python.org/2/library/subprocess.html?highlight=check_output#subprocess.check_output




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


Re: Inserting-embedding some html data at the end of a .py file

2013-03-05 Thread Michael Ross
On Tue, 05 Mar 2013 23:47:18 +0100, Νίκος Γκρ33κ nikos.gr...@gmail.com  
wrote:


Thank you very much! This is what i was looking for and here is my code  
after receiving your help.
So, with the command you provided to me i can actually run the .py  
script ans save its output and then append from there!! Great!


Here is my code now!

if htmlpage.endswith('.html'):
f = open( /home/nikos/public_html/ + htmlpage )
htmldata = f.read()
elif htmlpage.endswith('.py'):
		htmldata = subprocess.check_output( open(  
/home/nikos/public_html/cgi-bin/ + htmlpage ) )



	counter = ''' centera href=mailto:supp...@superhost.gr; img  
src=/data/images/mail.png /a

  centertable border=2 cellpadding=2 bgcolor=black
tdfont color=limeΑριθμός Επισκεπτών/td
tda href=http://superhost.gr/?show=stats;font color=cyan %d  
/td

  ''' % data[0]


template = htmldata + counter
print ( template )
===

But i'am getting this error:
type 'exceptions.AttributeError': 'module' object has no attribute  
'check_output'


Why does it say it has no attribute?


Python version  2.7 ?

And it's more along the lines of
subprocess.check_output( '/home/nikos/.../' + htmlpage )
without open.
Or even
	subprocess.check_output( [ '/your/python/interpreter', '/home/nikos/...'  
] )

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


Re: Inserting-embedding some html data at the end of a .py file

2013-03-05 Thread Michael Ross
On Wed, 06 Mar 2013 00:39:31 +0100, Νίκος Γκρ33κ nikos.gr...@gmail.com  
wrote:


htmldata = subprocess.check_output( '/home/nikos/public_html/cgi-bin/' +  
htmlpage )


htmldata = subprocess.check_output( ['/usr/bin/python',  
'/home/nikos/public_html/cgi-bin/' + htmlpage] )


Both of the above statemnts fail i'am afraid with the same error message.



check_output is available as of Python 2.7

I guess you are still on version 2.6 ?


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


Re: Speeding up Python's exit

2013-03-03 Thread Ross Ridge
Antoine Pitrou  solip...@pitrou.net wrote:
Now please read my message again. The OS buffers are *not* flushed according
to POSIX.

POSIX says open *streams* might not be flushed.  POSIX streams are C
FILE * streams and generally aren't regarded as being part of the OS.

When you call os._exit() in a Python program any unwritten data still
in Python's own file buffers will be lost.  Any unwritten data still
in the C library's FILE * buffers will be lost.  Any data successfuly
written through a POSIX file descriptor (eg. using the write() function)
will not be lost becasue os._exit() was used.

Note that this doesn't mean that OS buffers will flushed when os._exit()
is called.  Data that hasn't yet been physically written to disk, hasn't
be successfully transmitted over the network, or otherwise hasn't been
fully comitted could still be lost.  However, exiting Python normally
doesn't change this.  Only the Python process's own internal buffers are
flushed, the OS doesn't change its handling of its buffers.  If you want
written data to be fully committed before exiting you need to use other
OS services that guarantee this.

Ross Ridge

-- 
 l/  //   Ross Ridge -- The Great HTMU
[oo][oo]  rri...@csclub.uwaterloo.ca
-()-/()/  http://www.csclub.uwaterloo.ca/~rridge/ 
 db  //   
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to prevent tests from running against production?

2013-03-03 Thread Ross Ridge
Roy Smith  r...@panix.com wrote:
Our deploy/configuration system includes credentials for connecting to a 
database.  We have one production database, and a variety of clones of 
that in our test and development environments.

Having your tests use credentials that don't work in the production
environment would seem to be the obvious solution.

Ross Ridge

-- 
 l/  //   Ross Ridge -- The Great HTMU
[oo][oo]  rri...@csclub.uwaterloo.ca
-()-/()/  http://www.csclub.uwaterloo.ca/~rridge/ 
 db  //   
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Newbie

2013-02-24 Thread Michael Ross

On Sun, 24 Feb 2013 20:40:05 +0100, piterrr.dolin...@gmail.com wrote:


 if (some statement):   # short form

 rather than

 if (some statement == true):   # long form


What all those ugly brackets are for?



Mark,

Back in the day when C was king, or take many newer long established  
languages (C#, Java), the use of () has been widespread and mandated by  
the compilers. I have never heard anyone moan about the requirement to  
use parentheses.


You've never heard me then. I ... strongly dislike having to parse  
visual elements which I consider superfluous and implicit.


Does the English language have a proverb like not being able to see the  
forest for the trees?


To me, a C source looks like all brackets. Can't see the code for all the  
brackets.



Now come Python in which parens are optional, and all of a sudden they  
are considered bad and apparently widely abandoned. Do you really not  
see that code with parens is much more pleasing visually?


I guess one can get just as religious about the brackets as one can about  
the whitespace.



if ( condition ) { action }
vs
if condition: action


In time estimated, I'd say I can read and understand Python code about 20%  
faster than any of these brackety languages, even compared to languages I  
worked a with couple of years longer. That's a lot of effort saved.




Michael
--
http://mail.python.org/mailman/listinfo/python-list


Re: Checking for valid date input and convert appropriately

2013-02-21 Thread Michael Ross
On Thu, 21 Feb 2013 22:22:15 +0100, Ferrous Cranus nikos.gr...@gmail.com  
wrote:


Τη Πέμπτη, 21 Φεβρουαρίου 2013 10:14:13 μ.μ. UTC+2, ο χρήστης MRAB  
έγραψε:

On 2013-02-21 19:38, Ferrous Cranus wrote:

 import datetime from datetime



Should be:



from datetime import datetime





 try:

  datetime.strptime( date, '%d %m %Y' )



That parses the date and discards the result.



  date = date.strptime( '%Y-%m-%d' )



'date' is a string, it doesn't have a 'strptime' method.



When you parsed the date you got a datetime object; _that_ has the

'strptime' method.


I don't need to store the date i just want to make sure is entered  
correctly.

I would like to have the user type the date like

21 02 2013
and then convert it to 2013-02-21 because thats how mysql wants the date  
in order to store it.

Please show me how to write this.

Also, can you show me how to write it that if so even if the user  
entered date is wrong it doesn't just crash the cgi-script?i know i can  
use tr: expect: but i want to avoid it, somehow i need to check the date  
in the same if statemnt like i do with the other user defined varibles  
for validity.




You *have* to try/expect in order to not have the script crash.
Think user typo: 21 02 2ß13

Personally, I'd use a javascript on the html so users can't POST invalid  
dates.
I use mootools for that. It accepts 21/02/2013, 21-02-2013 and 21.02.13 as  
input,

and you end up with 21.02.2013 posted to your cgi in any case.


Michael
--
http://mail.python.org/mailman/listinfo/python-list


Re: Checking for valid date input and convert appropriately

2013-02-21 Thread Michael Ross
On Fri, 22 Feb 2013 00:08:01 +0100, Ferrous Cranus nikos.gr...@gmail.com  
wrote:


Τη Παρασκευή, 22 Φεβρουαρίου 2013 12:03:59 π.μ. UTC+2, ο χρήστης Michael  
Ross έγραψε:
On Thu, 21 Feb 2013 22:22:15 +0100, Ferrous Cranus  
nikos.gr...@gmail.com


wrote:



 Τη Πέμπτη, 21 Φεβρουαρίου 2013 10:14:13 μ.μ. UTC+2, ο χρήστης MRAB

 έγραψε:

 On 2013-02-21 19:38, Ferrous Cranus wrote:



  import datetime from datetime







 Should be:







 from datetime import datetime







 



  try:



   datetime.strptime( date, '%d %m %Y' )







 That parses the date and discards the result.







   date = date.strptime( '%Y-%m-%d' )







 'date' is a string, it doesn't have a 'strptime' method.







 When you parsed the date you got a datetime object; _that_ has the



 'strptime' method.



 I don't need to store the date i just want to make sure is entered

 correctly.

 I would like to have the user type the date like



 21 02 2013

 and then convert it to 2013-02-21 because thats how mysql wants the  
date


 in order to store it.

 Please show me how to write this.



 Also, can you show me how to write it that if so even if the user

 entered date is wrong it doesn't just crash the cgi-script?i know i  
can


 use tr: expect: but i want to avoid it, somehow i need to check the  
date


 in the same if statemnt like i do with the other user defined varibles

 for validity.





You *have* to try/expect in order to not have the script crash.

Think user typo: 21 02 2ß13



Personally, I'd use a javascript on the html so users can't POST invalid

dates.

I use mootools for that. It accepts 21/02/2013, 21-02-2013 and 21.02.13  
as


input,

and you end up with 21.02.2013 posted to your cgi in any case.


i just want to check for date validity from within ha same if statemnt  
like i check the other variables and i tried a regualr expression just  
now:


if( task and ( price and price.isdigit() and price.__len__() = 3 ) and  
( date and re.search( r'(\d+) (\d+) (\d+)', date ) ) ):


Do i ahve somehting wrong in it?

will the if become true if the user enters 21 02 2013 ?



I pretend not to know, try it out?

And try with invalid inputs, too:
211 02 2013
21 99 2013
31 02 2013
--
http://mail.python.org/mailman/listinfo/python-list


Re: Checking for valid date input and convert appropriately

2013-02-21 Thread Michael Ross
On Fri, 22 Feb 2013 01:12:40 +0100, Ferrous Cranus nikos.gr...@gmail.com  
wrote:



Please i have been trying hours for this:


Don't do that: Spending hours on being stuck. Take a break. Call it a  
night.

Brain needs time to unstick itself.


Besides:


from datetime import date



entry='31 03 2013'



day, month, year = int(entry[:2]), int(entry[3:5]), int(entry[6:])



mydate=date(year,month,day)



mydate.strftime('%Y-%m-%d')

'2013-03-31'





try:
datetime.strptime(date, '%d m% %Y')
date = date.strftime('%Y-%m-%d')
except:
print( h2date not propetly entered. )
sys.exit(0)
===

the user enters 21 02 2013

a) i just need to check if its in accepted format
b) then truncate the given date to mysql format

That's all i want to do and i cant make it work. Plese tell me how to  
write this.


I have tried anything i can think of.

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


[issue16853] add a Selector to the select module

2013-01-04 Thread Ross Lagerwall

Ross Lagerwall added the comment:

Interesting benchmark. There is no gain for epoll with a large number of
ready fds (as expected) but at least it is no worse than poll. Poll offers
a large improvement on select, in this case.

$ ./python selector_bench.py -r 2 -m 1000 -t pipe
Trying with 2 ready FDs out of 1000, type pipe
class 'select.EpollSelector'
0.004317363000154728
class 'select.PollSelector'
0.08897221900042496
class 'select.SelectSelector'
0.155811747055

$ ./python selector_bench.py -r 100 -m 1000 -t pipe
Trying with 100 ready FDs out of 1000, type pipe
class 'select.EpollSelector'
0.1106707402169
class 'select.PollSelector'
0.18777027299984184
class 'select.SelectSelector'
0.3015780589866

$ ./python selector_bench.py -r 1000 -m 1000 -t pipe
Trying with 1000 ready FDs out of 1000, type pipe
class 'select.EpollSelector'
1.08963231099915
class 'select.PollSelector'
1.69247998987
class 'select.SelectSelector'
8.283167362000313

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16853
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16853] add a Selector to the select module

2013-01-04 Thread Ross Lagerwall

Ross Lagerwall added the comment:

 Ross, the select() result for a large number of ready FDs was
 completely skewed because of a bug spotted by Antoine (complexity
 was much worse than it ought to be).

Ah, that makes a little more sense now.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16853
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Question on for loop

2013-01-03 Thread Don Ross
I'm interested to know why you're trying this as well.  Is this something that 
would be helped by creating a class and then dynamically creating instances of 
that class?  Something like...

class Fruit:
def __init__(self, name):
self.name = name

for fruit in ['banana', 'apple', 'mango']:
varName = Fruit(fruit)
# do stuff with varName

On Thursday, January 3, 2013 2:04:03 PM UTC-6, subhaba...@gmail.com wrote:
 Dear Group,
 
 If I take a list like the following:
 
 
 
 fruits = ['banana', 'apple',  'mango']
 
 for fruit in fruits:
 
print 'Current fruit :', fruit
 
 
 
 Now, 
 
 if I want variables like var1,var2,var3 be assigned to them, we may take,
 
 var1=banana,
 
 var2=apple,
 
 var3=mango
 
 
 
 but can we do something to assign the variables dynamically I was thinking
 
 of 
 
 var_series=['var1','var2','var3']
 
 for var in var_series:
 
   for fruit in fruits:
 
print var,fruits
 
 
 
 If any one can kindly suggest.
 
 
 
 Regards,
 
 Subhabrata
 
 
 
 NB: Apology for some alignment mistakes,etc.

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


[issue16850] Atomic open + close-and-exec

2013-01-03 Thread Ross Lagerwall

Changes by Ross Lagerwall rosslagerw...@gmail.com:


--
nosy: +rosslagerwall

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16850
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16853] add a Selector to the select module

2013-01-03 Thread Ross Lagerwall

Changes by Ross Lagerwall rosslagerw...@gmail.com:


--
nosy: +rosslagerwall

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16853
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Tarfile and usernames

2012-12-30 Thread Michael Ross

On Sun, 30 Dec 2012 19:57:31 +0100, Nicholas Cole nicholas.c...@gmail.com wrote:Dear List,I'm hoping to use the tarfile module in the standard library to move some files between computers.I can't see documented anywhere what this library does with userids and groupids. I can't guarantee that the computers involved will have the same users and groups, and would like the archives to be extracted so that the files are all owned by the extracting user.
Essentially, I do *not* with to preserve the owner and groups specified in the archives.As long as you don't extract as root, doesn't extracting set the extracting user's uid/gid anyway?Regards,MichaelWhat is the right way to achieve this?
Best wishes,Nicholas
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue16661] test_posix.test_getgrouplist fails on some systems - incorrectly comparing getgroups and getgrouplist results

2012-12-16 Thread Ross Lagerwall

Ross Lagerwall added the comment:

getgrouplist() is new in 3.3. Those failures are from getgroups() failing. I'll 
open a separate issue for that.

--
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16661
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16698] test_posix.test_getgroups fails on some systems

2012-12-16 Thread Ross Lagerwall

New submission from Ross Lagerwall:

test_posix.test_getgroups() fails on some systems:

http://buildbot.python.org/all/builders/AMD64%20Mountain%20Lion%20%5BSB%5D%203.2

This could be related to #16661.

--
components: Tests
messages: 177601
nosy: rosslagerwall
priority: normal
severity: normal
stage: needs patch
status: open
title: test_posix.test_getgroups fails on some systems
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16698
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16661] test_posix.test_getgrouplist fails on some systems - incorrectly comparing getgroups and getgrouplist results

2012-12-15 Thread Ross Lagerwall

Changes by Ross Lagerwall rosslagerw...@gmail.com:


--
assignee:  - rosslagerwall
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16661
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16661] test_posix.test_getgrouplist fails on some systems - incorrectly comparing getgroups and getgrouplist results

2012-12-13 Thread Ross Lagerwall

Ross Lagerwall added the comment:

Is that fixed now? I simplified the test to check for a non-empty list being 
returned.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16661
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: String manipulation in python..NEED HELP!!!!

2012-12-11 Thread Ross Ridge
John Gordon wrote:
 def encode(plain):
 '''Return a substituted version of the plain text.'''
 encoded = ''
 for ch in plain:
encoded += key[alpha.index(ch)]
 return encoded

Terry Reedy  tjre...@udel.edu wrote:
The turns an O(n) problem into a slow O(n*n) solution. Much better to 
build a list of chars and then join them.

There have been much better suggestions in this thread, but John Gordon's
code above is faster than the equivilent list and join implementation
with Python 2.6 and Python 3.1 (the newest versions I have handy).
CPython optimized this case of string concatenation into O(n) back in
Python 2.4.

Ross Ridge

-- 
 l/  //   Ross Ridge -- The Great HTMU
[oo][oo]  rri...@csclub.uwaterloo.ca
-()-/()/  http://www.csclub.uwaterloo.ca/~rridge/ 
 db  //   
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue16661] test_posix.test_getgrouplist fails on some systems - incorrectly comparing getgroups and getgrouplist results

2012-12-10 Thread Ross Lagerwall

Ross Lagerwall added the comment:

It seems like getgrouplist returns the information from the system
database whereas getgroups (and consequently id -G) returns the
supplementary groups for the calling process.

I'm not exactly sure how getgrouplist() can be effectively tested then.

--
nosy: +rosslagerwall
title: test_posix.test_getgrouplist fails on some systems - incorrectly 
comparing getgroups and getgrouplist results - test_posix.test_getgrouplist 
fails on some systems -incorrectly comparing getgroups and getgrouplist 
results

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16661
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16661] test_posix.test_getgrouplist fails on some systems - incorrectly comparing getgroups and getgrouplist results

2012-12-10 Thread Ross Lagerwall

Ross Lagerwall added the comment:

I wouldn't think so. A call to setgroups can add or remove groups for
the calling process. If it removes groups, then getgrouplist() won't
return a subset of getgroups().

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16661
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   3   4   5   6   7   8   >