ANN: Python Meeting Düsseldorf - 12.06.2019

2019-06-11 Thread eGenix Team: M.-A. Lemburg


[This announcement is in German since it targets a local user group
 meeting in Düsseldorf, Germany]



ANKÜNDIGUNG

  Python Meeting Düsseldorf

   http://pyddf.de/

Ein Treffen von Python Enthusiasten und Interessierten
 in ungezwungener Atmosphäre.

   Mittwoch, 12.06.2019, 18:00 Uhr
   Raum 1, 2.OG im Bürgerhaus Stadtteilzentrum Bilk
 Düsseldorfer Arcaden, Bachstr. 145, 40217 Düsseldorf

Diese Nachricht ist auch online verfügbar:
https://www.egenix.com/company/news/Python-Meeting-Duesseldorf-2019-06-12


NEUIGKEITEN

 * Bereits angemeldete Vorträge:

   Detlef Lannert
 "Data classes in Python 3.7"

   Marc-Andre Lemburg
"Unfacify – Gesichtserkennung mit Python"

   Charlie Clark
"Do you love your database enough?"

   Christian Liguda
"Using Python in an e-mail based reporting workflow"

   Weitere Vorträge können gerne noch angemeldet werden: i...@pyddf.de

 * Startzeit und Ort:

   Wir treffen uns um 18:00 Uhr im Bürgerhaus in den Düsseldorfer
   Arcaden.

   Das Bürgerhaus teilt sich den Eingang mit dem Schwimmbad und
   befindet sich an der Seite der Tiefgarageneinfahrt der Düsseldorfer
   Arcaden.

   Über dem Eingang steht ein großes "Schwimm' in Bilk" Logo. Hinter
   der Tür direkt links zu den zwei Aufzügen, dann in den 2. Stock
   hochfahren. Der Eingang zum Raum 1 liegt direkt links, wenn man aus
   dem Aufzug kommt.

   Google Street View: http://bit.ly/11sCfiw



EINLEITUNG

Das Python Meeting Düsseldorf ist eine regelmäßige Veranstaltung in
Düsseldorf, die sich an Python Begeisterte aus der Region wendet:

 * http://pyddf.de/

Einen guten Überblick über die Vorträge bietet unser YouTube-Kanal,
auf dem wir die Vorträge nach den Meetings veröffentlichen:

 * http://www.youtube.com/pyddf/

Veranstaltet wird das Meeting von der eGenix.com GmbH, Langenfeld,
in Zusammenarbeit mit Clark Consulting & Research, Düsseldorf:

 * http://www.egenix.com/
 * http://www.clark-consulting.eu/



PROGRAMM

Das Python Meeting Düsseldorf nutzt eine Mischung aus (Lightning)
Talks und offener Diskussion.

Vorträge können vorher angemeldet werden, oder auch spontan während
des Treffens eingebracht werden. Ein Beamer mit XGA Auflösung
steht zur Verfügung.

(Lightning) Talk Anmeldung bitte formlos per EMail an i...@pyddf.de



KOSTENBETEILIGUNG

Das Python Meeting Düsseldorf wird von Python Nutzern für Python
Nutzer veranstaltet. Um die Kosten zumindest teilweise zu
refinanzieren, bitten wir die Teilnehmer um einen Beitrag in Höhe von
EUR 10,00 inkl. 19% Mwst, Schüler und Studenten zahlen EUR 5,00
inkl. 19% Mwst.

Wir möchten alle Teilnehmer bitten, den Betrag in bar mitzubringen.



ANMELDUNG

Da wir nur für ca. 20 Personen Sitzplätze haben, möchten wir
bitten, sich per EMail anzumelden. Damit wird keine Verpflichtung
eingegangen. Es erleichtert uns allerdings die Planung.

Meeting Anmeldung bitte per Meetup

https://www.meetup.com/Python-Meeting-Dusseldorf/

oder formlos per EMail an i...@pyddf.de



WEITERE INFORMATIONEN

Weitere Informationen finden Sie auf der Webseite des Meetings:

http://pyddf.de/

Mit freundlichen Grüßen,
-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Experts (#1, Jun 11 2019)
>>> Python Projects, Coaching and Consulting ...  http://www.egenix.com/
>>> Python Database Interfaces ...   http://products.egenix.com/
>>> Plone/Zope Database Interfaces ...   http://zope.egenix.com/


::: We implement business ideas - efficiently in both time and costs :::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
   http://www.egenix.com/company/contact/
  http://www.malemburg.com/


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


pysftp / paramiko problem

2019-06-11 Thread Robin Becker

I am trying to convert older code that uses ftplib as the endpoint has switched 
to sftp only.

I am using the pysftp wrapper around paramiko.

The following script fails

def main():
import pysftp
with pysftp.Connection('ftp.remote.com', username='me', password='xx') 
as sftp:
print('top level')
print(sftp.listdir())
print(sftp.normalize(u''))
print('direct list of ')
print(sftp.listdir(u''))
with sftp.cd(u''):
print(sftp.listdir())

if __name__ == '__main__':
main()


when run the program prints [u''] and then fails at the normalize command.


$ python tsftp.py
top level
[u'']
Traceback (most recent call last):
  File "tsftp.py", line 13, in 
main()
  File "tsftp.py", line 6, in main
print(sftp.normalize(u''))
  File "/home/rptlab/devel/env/lib/python2.7/site-packages/pysftp/__init__.py", 
line 640, in normalize
return self._sftp.normalize(remotepath)
  File 
"/home/rptlab/devel/env/lib/python2.7/site-packages/paramiko/sftp_client.py", 
line 632, in normalize
t, msg = self._request(CMD_REALPATH, path)
  File 
"/home/rptlab/devel/env/lib/python2.7/site-packages/paramiko/sftp_client.py", 
line 813, in _request
return self._read_response(num)
  File 
"/home/rptlab/devel/env/lib/python2.7/site-packages/paramiko/sftp_client.py", 
line 865, in _read_response
self._convert_status(msg)
  File 
"/home/rptlab/devel/env/lib/python2.7/site-packages/paramiko/sftp_client.py", 
line 894, in _convert_status
raise IOError(errno.ENOENT, text)
IOError: [Errno 2] No such file.


I tried other commands, but it seems any attempt to cd to the  directory 
fails.

Using sftp in the shell directly I needed to add HostKeyAlgorithms=+ssh-dss for 
this host.

Any pointers to what the problem could be?
--
Robin Becker

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


Why I am getting IndexError: tuple index out of range when converting a float value to a string?

2019-06-11 Thread madhavanbomidi
I wrote the following lines of code:

xm = np.nanmean(x[indx],axis=None,dtype=float)   
xsd = np.nanstd(x[indx],axis=None,dtype=float)

type(xm)# np.float64
type(xsd# np.float64

print(xm)  # 0.5414720812182742
print(xsd) # 0.15748041033663002

print(str("{6.5f}".format(xm)))

I get the following error:

IndexError: tuple index out of range

Can someone suggest me why I am getting this error and how to overcome this?

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


Re: Why I am getting IndexError: tuple index out of range when converting a float value to a string?

2019-06-11 Thread Rob Gaddi

On 6/11/19 9:52 AM, madhavanbom...@gmail.com wrote:

I wrote the following lines of code:

xm = np.nanmean(x[indx],axis=None,dtype=float)
xsd = np.nanstd(x[indx],axis=None,dtype=float)

type(xm)# np.float64
type(xsd# np.float64

print(xm)  # 0.5414720812182742
print(xsd) # 0.15748041033663002

print(str("{6.5f}".format(xm)))

I get the following error:

IndexError: tuple index out of range

Can someone suggest me why I am getting this error and how to overcome this?

Thanks in advance



print(str("{:6.5f}".format(xm)))

You want to apply the format 6.5f to the autoindexed element.  You could 
also explicitly index the 1st element (#0) as {0:6.5f}.


--
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Why I am getting IndexError: tuple index out of range when converting a float value to a string?

2019-06-11 Thread Terry Reedy

On 6/11/2019 1:04 PM, Rob Gaddi wrote:

On 6/11/19 9:52 AM, madhavanbom...@gmail.com wrote:

I wrote the following lines of code:

xm = np.nanmean(x[indx],axis=None,dtype=float)
xsd = np.nanstd(x[indx],axis=None,dtype=float)

type(xm)    # np.float64
type(xsd    # np.float64

print(xm)  # 0.5414720812182742
print(xsd) # 0.15748041033663002

print(str("{6.5f}".format(xm)))

I get the following error:

IndexError: tuple index out of range

Can someone suggest me why I am getting this error and how to overcome 
this?


Show us the full traceback after expanding and reducing the example to 
the minimum needed to exhibit the problem.



print(str("{:6.5f}".format(xm)))

You want to apply the format 6.5f to the autoindexed element.


Which works fine as it is.

>>> xm = 3.0
>>> print(str("{:6.5f}".format(xm)))
3.0


You could also explicitly index the 1st element (#0) as {0:6.5f}.


He could, but it makes no difference for the print statement above.

Applying str to an str is redundant, as it applying it to a print argument.

>>> print("{0:6.5f}".format(xm))
3.0


--
Terry Jan Reedy


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


Re: FDs will be closed after exception automatically in python2.7?

2019-06-11 Thread Alan Bawden
D'Arcy Cain  writes:
> On 2019-06-10 15:46, Alan Bawden wrote:
> > D'Arcy Cain  writes:
> >> with open("file","w+") as fd:
> > 
> > That makes the window smaller, but it doesn't actually eliminate it.  Look
> > at the generated byte code.  In both cases the call to open() is over and
> > the open file is created _before_ the SETUP_WITH instruction is executed.
> 
> Am I correct in assuming that the window is there for process interrupts
> but not threads?

I believe that _either_ a signal handler invocation _or_ a thread switch
might happen immediately before the SETUP_WITH instruction, so there is a
window in either case.

You probably do have less to worry about in the thread switch case,
because eventually the thread will resume where it left off (there being no
way to kill a thread).

In the interrupt case it is possible that a KeyboardInterrupt will kill
your thread right before the SETUP_WITH, and then the stream's __exit__
method will never be called.  But you don't have much to worry about in
that case either because the ONLY reference to the stream is on the top of
the stack, so after the thread is unwound the stream will become garbage,
and then the garbage collector will close it.

But my point was that replacing:

f = open(...)
with f:

with

with open(...) as f:

doesn't fully close _any_ timing windows, it's just clearer to write it
that way.

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


Re: pysftp / paramiko problem

2019-06-11 Thread dieter
Robin Becker  writes:
> I am trying to convert older code that uses ftplib as the endpoint has 
> switched to sftp only.
>
> I am using the pysftp wrapper around paramiko.
>
> The following script fails
>
> def main():
> import pysftp
> with pysftp.Connection('ftp.remote.com', username='me', 
> password='xx') as sftp:
> print('top level')
> print(sftp.listdir())
> print(sftp.normalize(u''))

>From the "sftp" documentation:

 |  normalize(self, remotepath)
 |  Return the expanded path, w.r.t the server, of a given path.  This
 |  can be used to resolve symlinks or determine what the server believes
 |  to be the :attr:`.pwd`, by passing '.' as remotepath.

This suggests that your observation could be explained
by "u''" being a broken symlink.

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