Re: Uninstall problem

2020-09-06 Thread Luuk

On 5-9-2020 19:40, Mats Wichmann wrote:

On 9/5/20 7:54 AM, f.le...@omnias.fr wrote:

Hello,

  


I commit an error to install python because I chose python 3.8.5 x32bytes

So I wanted uninstalling it to install python 3.7.9 x64bytes


why not 3.8.5, by the way?


But 3.8.5 version don't want uninstall !?!


what does this mean?   uninstall should work like any uninstall on your
platform. in what way doesn't it want to uninstall?



And so I have the twice in my computer now ! How can I do to uninstall 3.8.5
?



it doesn't hurt to have more than one.  If you're on Windows, and use
the Python Launcher, you can show all your installs, and use it to
select the one you want:

py --list
py -3.7# specifically pick 3.7
py -3.8-32   # pick 32-bit 3.8, if both 64-bit and 32-bit are installed
py -3-64  # pick latest 64-bit Py3

The one reason you might be unhappy with both is that the Python
Launcher picks the highest numbered one as the default, so just

py

would get you 32-bit 3.8.   if both 64-bit and 32-bit of same version
are installed, the 64-bit one is preferred.



D:\TEMP>python -V
Python 3.8.5

D:\TEMP>py --list
Installed Pythons found by py Launcher for Windows
 -3.7-64 *


Can you explain above?

D:\TEMP>where py
C:\Windows\py.exe

D:\TEMP>where python
C:\Users\Luuk\AppData\Local\Microsoft\WindowsApps\python.exe

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


Re: Uninstall problem

2020-09-05 Thread Luuk

On 5-9-2020 15:54, f.le...@omnias.fr wrote:

Hello,

  


I commit an error to install python because I chose python 3.8.5 x32bytes

So I wanted uninstalling it to install python 3.7.9 x64bytes

But 3.8.5 version don't want uninstall !?!

  


And so I have the twice in my computer now ! How can I do to uninstall 3.8.5
?

  


Thanks

  


You have to tel which OS (Operating System) you are using,

And from which place you installed this version.

Because i am assuming you use Windows:

If it is from here:
https://www.microsoft.com/en-us/p/python-38/9mssztt1n39l?activetab=pivot:overviewtab

then uninstall info is here:
https://support.microsoft.com/en-us/help/4028054/windows-10-repair-or-remove-programs


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


Re: Downloading Python

2020-08-01 Thread Luuk



On 31-7-2020 22:10, Tanmay Shah wrote:

Hello to whoever this may concern,

After downloading Python 3.8.5 IDLE, an error message popped up, saying
the code execution cannot proceed because python38.dll was not found. What
should I do in order to use the Python interpreter?

Thank you!



It's WIndows, did you try to reboot ?

It seems to solve a lot of problems, on Windows

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


Re: Fwd: How can I build embeddable zip python on Linux

2020-06-05 Thread Luuk

On 5-6-2020 08:49, Luuk wrote:

On 5-6-2020 06:12, Michael Torrie wrote:

On 6/4/20 2:47 AM, Filip Bascarevic wrote:

When I tried to build GDB with Python support on Linux, I realized I
couldn’t find embeddable python for Linux.

Please, can you give me some instructions how can I build embeddable Python
from source in Linux? Is it possible in the Linux environment?


What does "embeddable python" mean?  Do you mean the libpython shared
library and C API?  If so it's just a matter of installing the correct
-devel or -dev package on your distro. On Debian this would likely be
libpython#.#-dev where # is the version. For example, libpython3.8-dev.
On Fedora that might be python-devel (or on CentOS, python36-devel).



probably the same as asked here (with no answer (yet)):
https://stackoverflow.com/questions/49425397/building-an-embeddable-minimal-python-distribution-on-linux




https://docs.python.org/3.5/using/windows.html#embedded-distribution

3.8. Embedded Distribution
New in version 3.5.

The embedded distribution is a ZIP file containing a minimal Python 
environment. It is intended for acting as part of another application, rather 
than being directly accessed by end-users.

When extracted, the embedded distribution is (almost) fully isolated from the 
user’s system, including environment variables, system registry settings, and 
installed packages. The standard library is included as pre-compiled and 
optimized .pyc files in a ZIP, and python3.dll, python35.dll, python.exe and 
pythonw.exe are all provided. Tcl/tk (including all dependants, such as Idle), 
pip and the Python documentation are not included.

Note The embedded distribution does not include the Microsoft C Runtime and it 
is the responsibility of the application installer to provide this. The runtime 
may have already been installed on a user’s system previously or automatically 
via Windows Update, and can be detected by finding ucrtbase.dll in the system 
directory.
Third-party packages should be installed by the application installer alongside 
the embedded distribution. Using pip to manage dependencies as for a regular 
Python installation is not supported with this distribution, though with some 
care it may be possible to include and use pip for automatic updates. In 
general, third-party packages should be treated as part of the application 
(“vendoring”) so that the developer can ensure compatibility with newer 
versions before providing updates to users.

The two recommended use cases for this distribution are described below

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


Re: Fwd: How can I build embeddable zip python on Linux

2020-06-05 Thread Luuk

On 5-6-2020 06:12, Michael Torrie wrote:

On 6/4/20 2:47 AM, Filip Bascarevic wrote:

When I tried to build GDB with Python support on Linux, I realized I
couldn’t find embeddable python for Linux.

Please, can you give me some instructions how can I build embeddable Python
from source in Linux? Is it possible in the Linux environment?


What does "embeddable python" mean?  Do you mean the libpython shared
library and C API?  If so it's just a matter of installing the correct
-devel or -dev package on your distro. On Debian this would likely be
libpython#.#-dev where # is the version. For example, libpython3.8-dev.
On Fedora that might be python-devel (or on CentOS, python36-devel).



probably the same as asked here (with no answer (yet)):
https://stackoverflow.com/questions/49425397/building-an-embeddable-minimal-python-distribution-on-linux


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


Re: "min( arg1, arg2, *args )" vs. "print( value, ... )"?

2020-04-08 Thread Luuk

On 6-4-2020 22:57, Stefan Ram wrote:

   The documentation ("help" under CPython 3.9) for "min" reads
   (simplified):

min( arg1, arg2, *args )

   , for "print" it reads (simplified):

print( value, ... ).

   The caller can place an arbitrary number of arguments at the
   place of "value, ..." or of "*args", respectively.

   So, from the point of view of the caller: is there any
   difference between "args, ..." and "*args" when he reads
   it in the documentation?




`arg1, arg2, *args` is just a smart way to say you need at least 2 args.

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


Re: Exceptions versus Windows ERRORLEVEL

2020-04-04 Thread Luuk

On 3-4-2020 02:08, Stephen Tucker (Stephen Tucker) wrote:

Hi,

I have found that raising an exception in a Python 2.7.10 program running under
Windows does not set ERRORLEVEL.

I realise that Python 2.x is no longer supported.

Does an exception raised by a Python 3.x program on a Windows machine set
ERRORLEVEL?


Yes, it does.


If not, are there plans for it to do so?

Stephen.



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


Re: Testing the data type of a value

2019-05-12 Thread Luuk


On 12-5-2019 16:07, Piet van Oostrum wrote:

Luuk  writes:


After thinking about this, (i am prettry new to python), i was doing this:


print(type(5),type(int),type(5)==type(int),type(5)==int)

  False True

Can someone explain why   type(5)==int   evaluates to   True ?


print(int)



The value of int is the class int, which is the class of 5, so type(5) is also 
that same class int.



Maybe i should have asked this:

What is the difference between 'type(5)==int'  and 'isinstance(5,int)'

and, if there is no difference why did someone invent 'isinstance()' ...

--
Luuk

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


Re: Testing the data type of a value

2019-05-12 Thread Luuk

On 12-5-2019 10:16, Luuk wrote:

On 12-5-2019 09:27, binoythomas1...@gmail.com wrote:

When I run the following code, I get the following output:

print(type(5))

class 'int'

Next, I try to compare the data-type of 5 with the earlier output, I 
get no output:

if type(5) == "":

 print("Integer")

Why isn't this working? Advance thanks for your time.

and regards from
Binoy



print(isinstance(5,int))
True


isinstance(object, classinfo)
Return true if the object argument is an instance of the classinfo 
argument, or of a (direct, indirect or virtual) subclass thereof. If 
object is not an object of the given type, the function always returns 
false. If classinfo is a tuple of type objects (or recursively, other 
such tuples), return true if object is an instance of any of the types. 
If classinfo is not a type or tuple of types and such tuples, a 
TypeError exception is raised.





After thinking about this, (i am prettry new to python), i was doing this:

>>> print(type(5),type(int),type(5)==type(int),type(5)==int)
  False True

Can someone explain why   type(5)==int   evaluates to   True ?

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


Re: Testing the data type of a value

2019-05-12 Thread Luuk

On 12-5-2019 09:27, binoythomas1...@gmail.com wrote:

When I run the following code, I get the following output:

print(type(5))

class 'int'

Next, I try to compare the data-type of 5 with the earlier output, I get no 
output:

if type(5) == "":

 print("Integer")

Why isn't this working? Advance thanks for your time.

and regards from
Binoy



print(isinstance(5,int))
True


isinstance(object, classinfo)
Return true if the object argument is an instance of the classinfo 
argument, or of a (direct, indirect or virtual) subclass thereof. If 
object is not an object of the given type, the function always returns 
false. If classinfo is a tuple of type objects (or recursively, other 
such tuples), return true if object is an instance of any of the types. 
If classinfo is not a type or tuple of types and such tuples, a 
TypeError exception is raised.



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


Re: unicode mail list archeology

2019-04-20 Thread Luuk

On 20-4-2019 12:47, Luuk wrote:

On 20-4-2019 11:26, wxjmfa...@gmail.com wrote:

http://unicode.org/mail-arch/unicode-ml/Archives-Old/UML018/0594.html



[quoot]
 > It is simple to make a compacter version of UTF-8 using the base
 > 256 character codes were possible (comacter for many languages).

No. If you think otherwise, you have completely misunderstood what UTF-8
is all about. Please read the section "What is UTF-8?" in
   http://www.cl.cam.ac.uk/~mgk25/unicode.html
carefully then you will see, why a base256 transfer encoding lacks
essential properties that make UTF-8 so damn useful.
[/quoot]

I must be one of the persons who do not understand what base256 transfer 
encoding means.


UTF-8 is, in bytes, just a sequence of 8 bit things, why can it not be 
transferred using a bas256 transfer  encoding?


$ echo "just my € 0.02 cents" | hexdump -C
6a 75 73 74 20 6d 79 20  e2 82 ac 20 30 2e 30 32 20 63 65 6e 74 73 0a



This is about python...

luuk@computer:$ python
Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a="just my € 0.02 cents"
>>> a
'just my \xe2\x82\xac 0.02 cents'
>>>

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


Re: unicode mail list archeology

2019-04-20 Thread Luuk

On 20-4-2019 11:26, wxjmfa...@gmail.com wrote:

http://unicode.org/mail-arch/unicode-ml/Archives-Old/UML018/0594.html



[quoot]
> It is simple to make a compacter version of UTF-8 using the base
> 256 character codes were possible (comacter for many languages).

No. If you think otherwise, you have completely misunderstood what UTF-8
is all about. Please read the section "What is UTF-8?" in
  http://www.cl.cam.ac.uk/~mgk25/unicode.html
carefully then you will see, why a base256 transfer encoding lacks
essential properties that make UTF-8 so damn useful.
[/quoot]

I must be one of the persons who do not understand what base256 transfer 
encoding means.


UTF-8 is, in bytes, just a sequence of 8 bit things, why can it not be 
transferred using a bas256 transfer  encoding?


$ echo "just my € 0.02 cents" | hexdump -C
6a 75 73 74 20 6d 79 20  e2 82 ac 20 30 2e 30 32 20 63 65 6e 74 73 0a

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


Re: (no subject)

2019-04-19 Thread Luuk

On 19-4-2019 16:37, Tamara Berger wrote:

Hi Python-List,

What code can I use to break out of a program completely, and not just out
of a loop? I wrote code with 3 conditions for saving for a downpayment. The
first addresses cases that don't meet the minimum condition; i.e., enough
money to save for a downpayment within the allotted time. It has its own
print line, but also executes the irrelevant print lines for the other two
conditions.

Thanks,
Tamara



cond1 = 1;
cond2 = 1;
cond3 = 1;

if cond1:
  if cond2:
if cond3:
  print("All OK")
else:
  print("cond3 NOK")
  else:
print("cond2 NOK")
else:
  print("cond1 NOK")



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


Re: (no subject)

2019-04-19 Thread Luuk

On 19-4-2019 16:37, Tamara Berger wrote:

Hi Python-List,

What code can I use to break out of a program completely, and not just out
of a loop? I wrote code with 3 conditions for saving for a downpayment. The
first addresses cases that don't meet the minimum condition; i.e., enough
money to save for a downpayment within the allotted time. It has its own
print line, but also executes the irrelevant print lines for the other two
conditions.

Thanks,
Tamara



cond1 = 1;
cond2 = 1;
cond3 = 1;

if cond1:
  if cond2:
if cond3:
  print("All OK")
else:
  print("cond3 NOK")
  else:
print("cond2 NOK")
else:
  print("cond1 NOK")



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


Re: Multiple log files using logging module

2019-03-24 Thread Luuk

On 24-3-2019 19:33, Peter Otten wrote:

Luuk wrote:


On 24-3-2019 18:13, Sharan Basappa wrote:

I have a test program that imports a design program.
Both the programs need to log messages.

I have tried the following:

1) Both the programs have the following lines:
for handler in logging.root.handlers[:]:
  logging.root.removeHandler(handler)
  
#Create and configure logger

filename = os.path.join(os.path.dirname(os.path.realpath(__file__)),
'<>') logging.basicConfig(filename=filename, filemode='w',
format='%(asctime)s %(message)s')
#Creating an object
logger = logging.getLogger()
#Setting the threshold of logger to DEBUG
logger.setLevel(logging.DEBUG)

replace <> above with respective log file names for test and design
programs. However, the test program logs the messages but not the design
program.

2) I removed the above lines from design program altogether hoping that
the messages will appear in the same log file. There is no error,
however, no message is logged from the design program.

I would like to get comment from members here as well as some simple
programs to illustrate this ...



As mentioned in your other thread, you should take note on HOW you put
the filenames in there.


I don't think that's the problem. Rather, if you call logging.basicConfig()
multiple times in the same program only the first invocation has an effect,
and only if there weren't any handlers added to the root logger by other
means.



It's not clear, at least not to me, if the programs are called from each 
other.


'test' and 'design' is not giving much info about what a program should do.



How do you see the end of the line starting with 'filename =...'?


Is it like:
for TEST:, 'TEST')
for DESIGN: , 'DESIGN')

or did you put a full pathname in there?

and, if you did put a full pathname in there (i.e. 'D:\TEMP\TEST' ),
did you also put the 'r' in front of it, like this:
 , r'D:\TEMP\TEST')








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


Re: Multiple log files using logging module

2019-03-24 Thread Luuk

On 24-3-2019 18:13, Sharan Basappa wrote:

I have a test program that imports a design program.
Both the programs need to log messages.

I have tried the following:

1) Both the programs have the following lines:
for handler in logging.root.handlers[:]:
 logging.root.removeHandler(handler)
 
#Create and configure logger

filename = os.path.join(os.path.dirname(os.path.realpath(__file__)), '<>')
logging.basicConfig(filename=filename, filemode='w', format='%(asctime)s 
%(message)s')
#Creating an object
logger = logging.getLogger()
#Setting the threshold of logger to DEBUG
logger.setLevel(logging.DEBUG)

replace <> above with respective log file names for test and design programs.
However, the test program logs the messages but not the design program.

2) I removed the above lines from design program altogether hoping that the 
messages will appear in the same log file. There is no error, however, no 
message is logged from the design program.

I would like to get comment from members here as well as some simple programs 
to illustrate this ...



As mentioned in your other thread, you should take note on HOW you put 
the filenames in there.


How do you see the end of the line starting with 'filename =...'?


Is it like:
for TEST:, 'TEST')
for DESIGN: , 'DESIGN')

or did you put a full pathname in there?

and, if you did put a full pathname in there (i.e. 'D:\TEMP\TEST' ),
did you also put the 'r' in front of it, like this:
   , r'D:\TEMP\TEST')


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


Re: log file

2019-03-24 Thread Luuk


On 24-3-2019 09:50, Sharan Basappa wrote:


Ah. I finally solved the issue though I don't know what the problem itself it.



The problem, shown with a simple example

Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 
32 bit (Intel)] on win32

Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> print ("hallo")
hallo
>>> print ("h\allo")
hllo
>>> print (r"h\allo")
h\allo
>>>

The first line is a simple print statement to print the text "hallo"   
(which is Dutch for "hello")


In the second line i added a '\' (backslash), the letter 'a' seems to be 
missing, unless audio on your computer works. If audio works you will 
hear a bell.

(see: https://docs.python.org/2.0/ref/strings.html )

In the third line a 'r' is put in front of the string, and now the 'a' 
is shown again (and also the '\').



In your path there is something like '...programs\assertion\CNN..'.

Python does see a '\a', after 'programs', and before 'ssertion', and 
tries to sound a 'bell'





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


Re: Help!!! How to apply my created function to another function

2019-03-10 Thread Luuk

On 10-3-2019 19:30, djoy...@gmail.com wrote:

Please see the last line


When reading above, i was thinking about this joke:
Q: how will you be able to keep a blonde busy for hours?
A: get a paper and write see other side on both sides of the paper




When I put vectorMagnitude(A), it returns perfectly corrected that means my 
function create right. But when I try to put vectorMagnitude(B) which I was 
thinking to put new list from buildRandomVector(A),it returns an error. I have 
been attempting to import buildRandomVector(A) to a list, but I can not 
understand why the list can not apply to  vectorMagnitude(B).





vectorMagnitude(B)  ==>>>> this is problem




Luckily the text 'Please see first line' is missing

;)


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


Re: System Beep?

2019-03-09 Thread Luuk

On 9-3-2019 07:27, Steve wrote:

Mischief almost managed.
They both work when using IDLE but the second one leaves an empty window to
be closed.
I do like the second one.  Is there a follow up command to close that
window?

Steve


see below





Footnote:
I am simply a thing that thinks.
Rene Descartes

-Original Message-
From: Python-list  On
Behalf Of Terry Reedy
Sent: Saturday, March 9, 2019 12:53 AM
To: python-list@python.org
Subject: Re: System Beep?

On 3/8/2019 1:13 PM, Steve wrote:

How can I cause a system beep using code?


  >>> import winsound as ws
  >>> ws.Beep(500, 1000)

and

  >>> from tkinter import Tk
  >>> root = Tk()
  >>> root.bell()

work for me.  The bell is not exactly a bell, but different from a monotone
beep.

--
Terry Jan Reedy

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




root.destroy()

see: 
https://stackoverflow.com/questions/110923/how-do-i-close-a-tkinter-window


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


Re: 0 + not 0

2015-07-11 Thread Luuk

On 11-7-2015 12:38, Irmen de Jong wrote:

On 11-7-2015 12:26, candide wrote:

0 + not 0

   File stdin, line 1
 0 + not 0
   ^
SyntaxError: invalid syntax





What is syntactically wrong with 0 + not 0?



I would say that the boolean operator 'not' cannot occur in an arithmetic 
expression.
Maybe you meant to use the bitwise not:


0 + ~0

-1


Irmen



It can occur in an arithmetic expression, and 'not' has a higher 
precedence than '+'

(https://docs.python.org/2/reference/expressions.html#operator-precedence)

0 + not 0
should evalutate to
0 + True
1

just like this does:
0 + (not 0)
1


True + True
2

But, it gets confusing..
 not 0 + 1
False
 not 0
True
 True + 1
2


i would expect 'not 0 + 1' to return the same value as 'True + 1'


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


Re: 0 + not 0

2015-07-11 Thread Luuk

On 11-7-2015 13:20, Chris Angelico wrote:

On Sat, Jul 11, 2015 at 9:12 PM, Luuk l...@invalid.lan wrote:

It can occur in an arithmetic expression, and 'not' has a higher precedence
than '+'
(https://docs.python.org/2/reference/expressions.html#operator-precedence)



I think you're misreading the table; 'not' has *lower* precedence than '+'.


But, it gets confusing..

not 0 + 1

False

not 0

True

True + 1

2




i would expect 'not 0 + 1' to return the same value as 'True + 1'


(not 0 + 1) == (not (0 + 1))

ChrisA



But operator precedence of 'not' is higher than of '+' 
--
https://mail.python.org/mailman/listinfo/python-list


Re: why can't download file from linux server into local window disk c:

2014-12-09 Thread Luuk
  To: ishish
On 8-12-2014 18:37, ishish wrote:
 with open(localpath, 'wb') as fl:
 PermissionError: [Errno 13] Permission denied: 'c:'

 I remember gloomily (haven't used windows since ages) that newer Windows
 versions don't like users to write directly to C:. Have you tried to
 save the file to your Documents folder?

 Regards,
 Alba

no, it's the ssh-server denying a log on from 'root'

--- SoupGate-Win32 v1.05
 * Origin: SpaceSST.BBS.Fidonetnntp.gatew...@.piz.noip.me (1:249/999)
--- Synchronet 3.15b-Win32 NewsLink 1.92
SpaceSST BBS Usenet  Fidonet Gateway
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: why can't download file from linux server into local window disk c:

2014-12-09 Thread Luuk
  To: pengsir
On 9-12-2014 09:14, pengsir wrote:


 My vps ip is x.y.z.w ,i want to download /etc/passwd from linux server
 into my local window disk c: .

 import paramiko
 host = x.y.z.w
 port = 22
 transport = paramiko.Transport((host, port))
 password = mykey
 username = root
 transport.connect(username = username, password = password)
 sftp = paramiko.SFTPClient.from_transport(transport)
 filepath = '/etc/passwd'
 localpath = 'c:'
 sftp.get(filepath, localpath)

 Traceback (most recent call last):
File stdin, line 1, in module
File D:\Python34\lib\site-packages\paramiko\sftp_client.py, line
 719, in get

  with open(localpath, 'wb') as fl:
 PermissionError: [Errno 13] Permission denied: 'c:'

You, 'root', does not have enoug permission to do it


C:\temp\util\Putty\pscp root@opensuse:/etc/passwd .
Using keyboard-interactive authentication.
Password:
Access denied

--- SoupGate-Win32 v1.05
 * Origin: SpaceSST.BBS.Fidonetnntp.gatew...@.piz.noip.me (1:249/999)
--- Synchronet 3.15b-Win32 NewsLink 1.92
SpaceSST BBS Usenet  Fidonet Gateway
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: why can't download file from linux server into local window disk c:?

2014-12-08 Thread Luuk

On 9-12-2014 09:14, pengsir wrote:



My vps ip is x.y.z.w ,i want to download /etc/passwd from linux server
into my local window disk c: .

import paramiko
host = x.y.z.w
port = 22
transport = paramiko.Transport((host, port))
password = mykey
username = root
transport.connect(username = username, password = password)
sftp = paramiko.SFTPClient.from_transport(transport)
filepath = '/etc/passwd'
localpath = 'c:'
sftp.get(filepath, localpath)

Traceback (most recent call last):
   File stdin, line 1, in module
   File D:\Python34\lib\site-packages\paramiko\sftp_client.py, line
719, in get

 with open(localpath, 'wb') as fl:
PermissionError: [Errno 13] Permission denied: 'c:'


You, 'root', does not have enoug permission to do it


C:\temp\util\Putty\pscp root@opensuse:/etc/passwd .
Using keyboard-interactive authentication.
Password:
Access denied



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


Re: why can't download file from linux server into local window disk c:?

2014-12-08 Thread Luuk

On 8-12-2014 18:37, ishish wrote:

with open(localpath, 'wb') as fl:
PermissionError: [Errno 13] Permission denied: 'c:'


I remember gloomily (haven't used windows since ages) that newer Windows
versions don't like users to write directly to C:. Have you tried to
save the file to your Documents folder?

Regards,
Alba


no, it's the ssh-server denying a log on from 'root'
--
https://mail.python.org/mailman/listinfo/python-list


Re: Beginner python 3 unicode question

2013-11-16 Thread Luuk

On 16-11-2013 20:12, Laszlo Nagy wrote:

Example interactive:

$ python3
Python 3.3.1 (default, Sep 25 2013, 19:29:01)
[GCC 4.7.3] on linux
Type help, copyright, credits or license for more information.
  import uuid
  import base64
  base64.b32encode(uuid.uuid1().bytes)[:-6].lower()
b'zsz653co6ii6hgjejqhw42ncgy'
 

But when I put the same thing into a source file I get this:

Traceback (most recent call last):
   File /home/gandalf/Python/Lib/shopzeus/yaaf/ui/widget.py, line 94,
in __init__
 self.eid = uniqueid()
   File /home/gandalf/Python/Lib/shopzeus/yaaf/ui/__init__.py, line
34, in uniqueid
 base64.b32encode(uuid.uuid1().bytes)[:-6].lower()
TypeError: Can't convert 'bytes' object to str implicitly


Why it is behaving differently on the command line? What should I do to
fix this?




the error is in one of the lines you did not copy here

because this works without problems:
BEGIN-of script
#!/usr/bin/python

import uuid
import base64
print base64.b32encode(uuid.uuid1().bytes)[:-6].lower()
END-of script

But, i need to say, i'm also a beginner ;)
--
https://mail.python.org/mailman/listinfo/python-list


Re: Beginner python 3 unicode question

2013-11-16 Thread Luuk

On 16-11-2013 21:57, Laszlo Nagy wrote:



the error is in one of the lines you did not copy here

because this works without problems:
BEGIN-of script
#!/usr/bin/python


Most probably, your /usr/bin/python program is python version 2, and not
python version 3

Try the same program with /usr/bin/python3. And also try the interactive
mode with the same program and I think you will see the same phenomenon.



adding some '()' helped:
BEGIN-of script
#!/usr/bin/python3

import uuid
import base64
print (base64.b32encode(uuid.uuid1().bytes)[:-6].lower())
END-of script

~/temp python3 --version
Python 3.3.0

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


Re: mySQLdb

2013-02-02 Thread Luuk

On 02-02-2013 11:01, Armin Karner wrote:

MySQLdb for python versions 3.3 or higher


http://lmgtfy.com/?q=MySQLdb+for+python+versions+3.3+or+higher
--
http://mail.python.org/mailman/listinfo/python-list


Re: read a web page using python

2007-03-17 Thread Luuk

[EMAIL PROTECTED] schreef in bericht 
news:[EMAIL PROTECTED]
 Hi All,

 Kindly, could you someone tell me how to read a page(any web site)
 using Python, what method to be used ?

 Paris


http://www.amk.ca/python/howto/sockets/


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


Re: Need help (Basic python)...what did I do wrong?

2006-10-28 Thread Luuk

frankie_85 [EMAIL PROTECTED] schreef in bericht 
news:[EMAIL PROTECTED]
 Hi everyone,

 I just made a simple code which is part of my assignment but I can't
 figure it out what's wrong with it. (always give me error messages)

 What the code basically does is:

 a function that takes one floating point number x as its argument and
 returns (the square root of the absolute value of x) plus (5 times x
 cubed).

 and read 5 floating point values from the user into a list then apply
 the function to each value in the list and print the results in reverse
 order.

 
 import math

 print Enter 5 values:
 a = float(raw_input())
 b = float(raw_input())
 c = float(raw_input())
 d = float(raw_input())
 e = float(raw_input())

 def funct(a, b, c, d, e):
a_1 = math.sqrt(math.fabs(a)) + 5((math.pow(a,3)))
b_2 = math.sqrt(math.fabs(b)) + 5((math.pow(b,3)))
c_3 = math.sqrt(math.fabs(c)) + 5((math.pow(c,3)))
d_4 = math.sqrt(math.fabs(d)) + 5((math.pow(d,3)))
e_5 = math.sqrt(math.fabs(e)) + 5((math.pow(e,3)))
return a_1
return b_2
return c_3
return d_4
return e_5
print e_5, d_4, c_3, b_2, a_1



 funct(a, b, c, d, e)


 

 it always gives me these error messages:

 Traceback (most recent call last):
  File /Users/x/Documents/test3.py, line 25, in module
funct(a, b, c, d, e)
  File /Users/x/Documents/test3.py, line 11, in funct
a_1 = math.sqrt(math.fabs(a)) + 5((math.pow(a,3)))
 TypeError: 'int' object is not callable

 What did I do wrong? Please help me

 Thanks in advance



obviously the error is in the line a_1 = math.sqrt(math.fabs(a)) + 
5((math.pow(a,3)))

try changin this to a_1 = math.sqrt(math.fabs(a)) + 5*math.pow(a,3)

because you seem to want 5 time the result of the pow() function




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


Re: efficient text file search.

2006-09-11 Thread Luuk

noro [EMAIL PROTECTED] schreef in bericht 
news:[EMAIL PROTECTED]
 Is there a more efficient method to find a string in a text file then:

 f=file('somefile')
 for line in f:
if 'string' in line:
 print 'FOUND'



yes, more efficient would be:
grep (http://www.gnu.org/software/grep/)



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


Re: efficient text file search.

2006-09-11 Thread Luuk

noro [EMAIL PROTECTED] schreef in bericht 
news:[EMAIL PROTECTED]
 :)

 via python...

 Luuk wrote:
 noro [EMAIL PROTECTED] schreef in bericht
 news:[EMAIL PROTECTED]
  Is there a more efficient method to find a string in a text file then:
 
  f=file('somefile')
  for line in f:
 if 'string' in line:
  print 'FOUND'
 


 yes, more efficient would be:
 grep (http://www.gnu.org/software/grep/)


ok, a more serious answer:

some googling turned op the following.
Second paragraph of chapter 14 of http://www.amk.ca/python/2.1/

a.. The speed of line-oriented file I/O has been improved because people 
often complain about its lack of speed, and because it's often been used as 
a naïve benchmark. The readline() method of file objects has therefore been 
rewritten to be much faster. The exact amount of the speedup will vary from 
platform to platform depending on how slow the C library's getc() was, but 
is around 66%, and potentially much faster on some particular operating 
systems. Tim Peters did much of the benchmarking and coding for this change, 
motivated by a discussion in comp.lang.python.
A new module and method for file objects was also added, contributed by Jeff 
Epler. The new method, xreadlines(), is similar to the existing xrange() 
built-in. xreadlines() returns an opaque sequence object that only supports 
being iterated over, reading a line on every iteration but not reading the 
entire file into memory as the existing readlines() method does. You'd use 
it like this:


for line in sys.stdin.xreadlines():
# ... do something for each line ...
...
For a fuller discussion of the line I/O changes, see the python-dev summary 
for January 1-15, 2001 at http://www.amk.ca/python/dev/2001-01-1.html.



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

Re: efficient text file search.

2006-09-11 Thread Luuk

John Machin [EMAIL PROTECTED] schreef in bericht 
news:[EMAIL PROTECTED]

 Luuk wrote:
 [snip]
 some googling turned op the following.
 Second paragraph of chapter 14 of http://www.amk.ca/python/2.1/
 [snip]
 For a fuller discussion of the line I/O changes, see the python-dev 
 summary
 for January 1-15, 2001 at http://www.amk.ca/python/dev/2001-01-1.html.

 That is *HISTORY*. That is Python 2.1. That is the year 2001.
 xreadlines is as dead as a dodo.


Thats's why i started my reply with:
some googling turned op the following.
i did not state that further googling was unneeded ;-)


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