Re: pyinstaller wrong classified as Windows virus

2021-11-29 Thread Ulli Horlacher
anthony.flury wrote: > > On 26/11/2021 07:13, Ulli Horlacher wrote > >> But consider another possibility that your compiler software is compromised > > Then https://www.python.org/ftp/python/3.10.0/python-3.10.0-amd64.exe > > is infected. I doubt this. > > B

Re: CERTIFICATE_VERIFY_FAILED Windows only?

2021-11-28 Thread Ulli Horlacher
Chris Angelico wrote: > On Sun, Nov 28, 2021 at 6:38 AM Ulli Horlacher > wrote: > > > > My program uses https and runs fine on Linux, but on Windows it crashes: > > > > Google chrome and firefox both say the certifacte is valid: > > > > https://fex.f

CERTIFICATE_VERIFY_FAILED Windows only?

2021-11-27 Thread Ulli Horlacher
My program uses https and runs fine on Linux, but on Windows it crashes: W10dev:/cygdrive/p: python fextasy.py -D DEBUG(fextasy.py): verbose=0 DEBUG(fextasy.py): User-Agent: fextasy-20211127_1806 Windows 10.0.19041 DEBUG(fextasy.py): TCPCONNECT to fex.flupp.org:443 Traceback (most recent call last

Re: pyinstaller wrong classified as Windows virus

2021-11-26 Thread Ulli Horlacher
Edmondo Giovannozzi wrote: > You can try to download winpython: > https://github.com/winpython/winpython/releases > It is an executable, but you don't need to execute it as it is a 7zip > compressed archive. > You may run it or use directly 7zip to decompress it, the result will be the > same.

Re: pyinstaller wrong classified as Windows virus

2021-11-26 Thread Ulli Horlacher
Avi Gross wrote: > I am not sure what your real problem is, Ulli, but many antivirus programs > can be TEMPORARILY shut off. Meanwhile I found this configuration option. But this does not help me much, because my programs must run on other Windows PCs of other users and they cannot disable the d

Re: pyinstaller wrong classified as Windows virus

2021-11-26 Thread Ulli Horlacher
Richard Damon wrote: > On a somewhat locked down computer, the user does not have admin rights, > so needs to get 'IT' to run any installers that need admin permissions > to run. > > And EXE that just needs to be copied to the computer and rhen just RUN, > doesn't need IT to 'install' it (the

Re: pyinstaller wrong classified as Windows virus

2021-11-25 Thread Ulli Horlacher
Chris Angelico wrote: > Unfortunately, if you're not going to go to the effort of getting your > executables signed I cannot sign my executables (how can I do it anyway?), because Windows deletes my executable as soon as I have compiled them! They exist only for a few seconds and then they are g

Re: pyinstaller wrong classified as Windows virus

2021-11-25 Thread Ulli Horlacher
Barry Scott wrote: > > > > On 25 Nov 2021, at 09:20, Ulli Horlacher > > wrote: > > > > When I compile my programs with pyinstaller, Windows classifies them as > > virus and even deletes them! > > Microsoft will fix the malware detection if you pro

Re: pyinstaller wrong classified as Windows virus

2021-11-25 Thread Ulli Horlacher
Ulli Horlacher wrote: > Dan Purgert wrote: > > > > When I compile my programs with pyinstaller, Windows classifies them as > > > virus and even deletes them! > > > [...] > > > > Have you tried compiling from a different machine? Maybe there'

pyinstaller wrong classified as Windows virus

2021-11-25 Thread Ulli Horlacher
When I compile my programs with pyinstaller, Windows classifies them as virus and even deletes them! pyinstaller.exe --onefile --noconsole -i fex.ico fextasy.py 187 INFO: PyInstaller: 4.7 187 INFO: Python: 3.10.0 218 INFO: Platform: Windows-10-10.0.19041-SP0 218 INFO: wrote P:\W10\fextasy.spec (..

Re: pyinstaller wrong classified as Windows virus

2021-11-25 Thread Ulli Horlacher
Dan Purgert wrote: > > When I compile my programs with pyinstaller, Windows classifies them as > > virus and even deletes them! > > [...] > > Have you tried compiling from a different machine? Maybe there's > something broken on the one that's flagging them. I have only this Windows installati

Re: pyinstaller: icon not visable on desktop?

2021-11-24 Thread Ulli Horlacher
Calvin Spealman wrote: > What version of Windows is this on? That's probably going to be a useful > bit of information, because there could be differences there to how EXE > icons are handled. > > On Tue, Nov 23, 2021 at 4:18 PM Ulli Horlacher < > frams...@r

pyinstaller: icon not visable on desktop?

2021-11-23 Thread Ulli Horlacher
When I compile a python program with pyinstaller, I get an executable: pyinstaller --onefile --icon fex.ico fextasy.py But the executables icon is only visable within the windows file browser, not on the desktop: https://fex.flupp.org/fop/V2ioMZcl/X-20211123213712.png There is only the default

Re: getting source code line of error?

2021-11-20 Thread Ulli Horlacher
Stefan Ram wrote: > r...@zedat.fu-berlin.de (Stefan Ram) writes: > >except Exception as inst: > >print( traceback.format_exc() ) > > More to the point of getting the line number: As I wrote in my initial posting: I already have the line number. I am looking for the source code line! So f

getting source code line of error?

2021-11-19 Thread Ulli Horlacher
I am trying to get the source code line of the last error. I know traceback.format_exc() but this contains much more information, e.g.: Traceback (most recent call last): File "./error.py", line 18, in main x=1/0 ZeroDivisionError: division by zero I could extract the source code line with

several issues with pyinstaller on Windows 10

2021-11-18 Thread Ulli Horlacher
On Windows 10 I have installed: P:\W10>python --version Python 3.10.0 P:\W10>pyinstaller --version 4.7 I can compile a VERY simple Python program: P:\W10>type argv.pv #!/usr/bin/python3 import sys for a in sys.argv: print("["+a+"]") P:\W10>pyinstaller.exe --onefile tcpbm.py But I can run i

Linux/Windows GUI programming: tk or wx?

2017-08-04 Thread Ulli Horlacher
I have to transfer a python 2.7 CLI programm into one with a (simple) GUI. The program must run on Linux and Windows and must be compilable with pyinstall, because I have to ship a standalone windows.exe Any kind of installer is not acceptable. Reading https://github.com/pyinstaller/pyinstaller/wi

advanced SimpleHTTPServer?

2016-11-02 Thread Ulli Horlacher
"python -m SimpleHTTPServer" is really cool :-) But I need some more features: - some kind of a chroot, to prevent file access higher then the base directory - a directory listing mit date and size information - an upload possibility I could modify /usr/lib/python2.7/SimpleHTTPServer.py by m

Re: manually sorting images?

2016-09-04 Thread Ulli Horlacher
Quivis wrote: > On Sun, 04 Sep 2016 21:32:47 +1000, Steve D'Aprano wrote: > > > What does it mean to sort images visually? > > 1. A directory of images collected over say, five years. > > 2. You want to sort them according to red houses, blue houses, green > trees, yellow trees (that's autumn

manually sorting images?

2016-09-04 Thread Ulli Horlacher
I need to sort images (*.jpg), visually, not by file name. It looks, there is no standard UNIX tool for this job? So, I have to write one by myself, using Tkinter. Are there any high-level widgets which can help me, for example a file browser with thumbnails? -- Ullrich Horlacher

Re: extending PATH on Windows?

2016-02-19 Thread Ulli Horlacher
pyotr filipivich wrote: > > Windows (especially 7) search function is highly crippled. There is > >some command sequence that will open it up to looking at other file types > >and locations. > > > >http://answers.microsoft.com/en-us/windows/forum/windows_7-files/windows-7-search-does-not-fi

Re: extending PATH on Windows?

2016-02-18 Thread Ulli Horlacher
Ulli Horlacher wrote: > > but simpler still and more reliable to just call QueryValueEx. > > I find it more complicated. I have now (after long studying docs and examples):: def get_winreg(key,subkey): try: rkey = winreg.OpenKey(winreg.HKEY_CURRENT_USER,key,0,winreg.KEY_READ

Re: extending PATH on Windows?

2016-02-18 Thread Ulli Horlacher
eryk sun wrote: > https://hg.python.org/cpython/file/v2.7.11/Tools/scripts/win_add2path.py > > But there are a few issues with this script. (... lot of flaws ...) > Here's a new version for Python 2. I generalized the shell-variable > replacement to a list of well-known folders. Great script

Re: extending PATH on Windows?

2016-02-18 Thread Ulli Horlacher
Dennis Lee Bieber wrote: > >I have > >"Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:32:19) [MSC > >v.1500 32 bit (Intel)] on win32" > >and there is no "win_add2path.py" > > > C:\Python_x64\Python27\Tools\scripts\win_add2path.py Ok, It is here in C:\Python27\Tools\scripts\win_add2path.py

Re: extending PATH on Windows?

2016-02-17 Thread Ulli Horlacher
eryk sun wrote: > >> The AutoRun command (it's a command line, not a script path) > > > > A script path is a legal command line, too. > > If the registry value were just a script path, you'd have to modify > your script to chain to the previous script, if any. Since it's a > command line you can

Re: extending PATH on Windows?

2016-02-17 Thread Ulli Horlacher
eryk sun wrote: > > At startup cmd.exe runs a script which is defined by the registry variable > > AutoRun in "HKCU\Software\Microsoft\Command Processor" > > > > I set this variable with: > > > > rc = "HKCU\Software\Microsoft\Command Processor" > > ar = "%USERPROFILE%\Desktop\autorun.cmd" > >

Re: extending PATH on Windows?

2016-02-17 Thread Ulli Horlacher
Thorsten Kampe wrote: > By the way: there is a script called `win_add2path.py` in your Python > distribution I have "Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:32:19) [MSC v.1500 32 bit (Intel)] on win32" and there is no "win_add2path.py" But I found another solution: I need the ex

Re: extending PATH on Windows?

2016-02-16 Thread Ulli Horlacher
Thorsten Kampe wrote: > * Ulli Horlacher (Tue, 16 Feb 2016 08:30:59 + (UTC)) > > I need to extend the PATH environment variable on Windows. > > 1. Add the path component yourself into HKEY_CURRENT_USER and make > sure it's not there already (pure Pytho

extending PATH on Windows?

2016-02-16 Thread Ulli Horlacher
I need to extend the PATH environment variable on Windows. So far, I use: system('setx PATH "%PATH%;'+bindir+'"') The problem: In a new process (cmd.exe) PATH contains a lot of double elements. As far as I have understood, Windows builds the PATH environment variable from a system component a

Re: modifying a standard module?

2016-02-12 Thread Ulli Horlacher
Matt Wheeler wrote: > > How can I substitute the standard module function tarfile.extractall() with > > my own function? > > import tarfile > def new_extractall(self, *args, **kwargs): > print("I am a function. Woohoo!") > > tarfile.TarFile.extractall = new_extractall This is more easy tha

Re: tarfile : secure extract?

2016-02-12 Thread Ulli Horlacher
Random832 wrote: > On Thu, Feb 11, 2016, at 18:24, Ulli Horlacher wrote: > > A better approach would be to rename such files while extracting. > > Is this possible? > > What happens if you change member.name before extracting? Ohh... such an easy solution! :-)

Re: tarfile : read from a socket?

2016-02-12 Thread Ulli Horlacher
Lars Gustäbel wrote: > On Fri, Feb 12, 2016 at 09:35:40AM +0100, Antoon Pardon wrote: > > On 02/11/2016 06:27 PM, Lars Gustäbel wrote: > > > What about using an iterator? > > > > > > def myiter(tar): > > > for t in tar: > > > print "extracting", t.name > > > yield t > > > > > >

tarfile : secure extract?

2016-02-11 Thread Ulli Horlacher
In https://docs.python.org/2/library/tarfile.html there is a warning: Never extract archives from untrusted sources without prior inspection. It is possible that files are created outside of path, e.g. members that have absolute filenames starting with "/" or filenames with two dots "..".

modifying a standard module? (was: Re: tarfile : read from a socket?)

2016-02-11 Thread Ulli Horlacher
Ulli Horlacher wrote: > This code works so far: > > sfo = sock.makefile('r') > taro = tarfile.open(fileobj=sfo,mode='r|') > taro.extractall(path=edir) > > But it does not writes anything to the terminal to inform the user. > > W

Re: tarfile : read from a socket?

2016-02-11 Thread Ulli Horlacher
Ulli Horlacher wrote: > With > > taro = tarfile.open(fileobj=sock.makefile('w',kB64),mode='w|') > > I get no more error. Of course, this is the writing client. Now I have a small problem with the reading client. This code works so far: sfo = sock.

Re: tarfile : read from a socket?

2016-02-11 Thread Ulli Horlacher
Chris Angelico wrote: > Sounds like tarfile needs a seekable file. How big is this file you're > reading? No limits. It can be many TBs... The use case is: http://fex.rus.uni-stuttgart.de:8080/ -- Ullrich Horlacher Server und Virtualisierung Rechenzentrum IZUS/TIK E-Mai

Re: tarfile : read from a socket?

2016-02-11 Thread Ulli Horlacher
Ulli Horlacher wrote: > I have: > > sock = socket.create_connection((server,port)) > bs = kB64 > taro = tarfile.open(fileobj=sock.makefile('w',kB64),mode='w') > > > > Traceback (most recent call last): > (...) >

Re: tarfile : read from a socket?

2016-02-11 Thread Ulli Horlacher
Antoon Pardon wrote: > > (How) can I read a tar file from a (tcp) socket? > > I do not have a pathname but a socket object from socket.create_connection > > # First you construct a file object with makefile. > > fo = socket.makefile() > > # Then you use the fileobj argument with tarfile.open.

tarfile : read from a socket?

2016-02-11 Thread Ulli Horlacher
https://docs.python.org/2/library/tarfile.html says: tarfile.open(name=None, mode='r', fileobj=None, bufsize=10240, **kwargs) Return a TarFile object for the pathname name. (How) can I read a tar file from a (tcp) socket? I do not have a pathname but a socket object from socket.create_conn

Re: psss...I want to move from Perl to Python

2016-01-29 Thread Ulli Horlacher
James Harris wrote: > I nearly gave up with Python at the very beginning before I realised not > to mix tabs and spaces. I nearly gave up with Python at the very beginning before I realised that OO-programming is optional in Python! :-) Most tutorials I found so far makes OO mandatory. -- Ul

Re: psss...I want to move from Perl to Python

2016-01-29 Thread Ulli Horlacher
Steven D'Aprano wrote: > Every time I make a half-hearted attempt to learn enough Perl syntax to get > started, I keep running into the differences between $foo, %foo and @foo > and dire warnings about what happens if you use the wrong sigil I have started learning Python several times and surre

Re: OT The fiction section

2016-01-17 Thread Ulli Horlacher
Marko Rauhamaa wrote: > Steven D'Aprano : > > > https://pbs.twimg.com/media/CWgV0ruUsAAcUD7.jpg > > Not bad. $ python Python 2.7.3 (default, Jun 22 2015, 19:33:41) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> bad=False >>> not bad True --

Re: "x == None" vs "x is None"

2016-01-17 Thread Ulli Horlacher
Chris Angelico wrote: > On Sun, Jan 17, 2016 at 8:51 PM, Ulli Horlacher > wrote: > > I have seen at several places "x == None" and "x is None" within > > if-statements. > > What is the difference? > > Which term should I prefer and why? >

"x == None" vs "x is None"

2016-01-17 Thread Ulli Horlacher
I have seen at several places "x == None" and "x is None" within if-statements. What is the difference? Which term should I prefer and why? -- Ullrich Horlacher Server und Virtualisierung Rechenzentrum IZUS/TIK E-Mail: horlac...@tik.uni-stuttgart.de Universitaet Stuttgart

Re: getkey

2016-01-16 Thread Ulli Horlacher
Ulli Horlacher wrote: > The first byte of an escape sequence (example: ^[[21~ for F10) is > recognized, but the trailing bytes then are not discarded by > clear_keyboard_buffer() and get_key() returns the second byte of the > escape sequence. I have found a solution: def clear_key

getkey

2016-01-16 Thread Ulli Horlacher
I have an application which runs on Windows and UNIX where I need to get one keypress from the user (without ENTER). Keys which sends escape sequences (e.g. cursor or function keys) should be ignored. I have a solution for Windows, but not for UNIX: The first byte of an escape sequence (example:

Re: Powerful perl paradigm I don't find in python

2016-01-15 Thread Ulli Horlacher
Charles T. Smith wrote: > while ($str != $tail) { > $str ~= s/^(head-pattern)//; > use ($1); > } use() is illegal syntax in Perl. -- Ullrich Horlacher Server und Virtualisierung Rechenzentrum IZUS/TIK E-Mail: horlac...@tik.uni-stuttgart.de Universitaet Stuttgart

looking for windows testers

2016-01-11 Thread Ulli Horlacher
I have written a Python client for F*EX(*). It is designed for Windows users, though it runs on UNIX, too. I am now looking for testers. If you are interested, I will give you an account on my server. (*) Frams' Fast File EXchange is a service to send files of any size to any user anywhere in

Re: When I need classes?

2016-01-10 Thread Ulli Horlacher
Cameron Simpson wrote: > I always structure this aspect as: > > ... at or near top of script ... > > def main(argv): >... do main logic here ... > > ... at bottom ... > if __name__ == '__main__': >sys.exit(main(sys.argv)) I, as a Python beginner, came to the same solution! It seem

Re: extract script from executable made by pyinstaller?

2016-01-08 Thread Ulli Horlacher
Oscar Benjamin wrote: > On 8 January 2016 at 07:44, Ulli Horlacher > wrote: > > Is it possible to extract (and view) the Python script from the Windows > > executable which was made by pyinstller? > > I may be misremembering but I though that pyinstaller actually

extract script from executable made by pyinstaller?

2016-01-07 Thread Ulli Horlacher
Is it possible to extract (and view) the Python script from the Windows executable which was made by pyinstller? -- Ullrich Horlacher Server und Virtualisierung Rechenzentrum IZUS/TIK E-Mail: horlac...@tik.uni-stuttgart.de Universitaet Stuttgart Tel:++49-711-685

Re: Tk alternative to askopenfilename and askdirectory?

2015-12-18 Thread Ulli Horlacher
Christian Gollwitzer wrote: > Tk calls out into the native file manager to perform the file/open > operation (on Win&Mac, on Unix it brings it's own). This means, on Windows the user gets a "well known" file/directory browser? Then this is an important feature! Anything new and unknown is bad f

Re: Tk alternative to askopenfilename and askdirectory?

2015-12-17 Thread Ulli Horlacher
Rick Johnson wrote: > Oh i understand. What you opine for is something like: askOpenFileOrDir() > -- which displays a dialog from which a file or directory can be selected > by the user. Yes, exactly! Now: how? -- Ullrich Horlacher Server und Virtualisierung Rechenzentrum IZUS/TI

Re: How does one distribute Tkinter or Qt GUI apps Developed in Python

2015-12-17 Thread Ulli Horlacher
Rick Johnson wrote: > Unlike a true "applications language", like say, um, *JAVA*, one cannot > simply compile an executable and distribute it in a teeny tiny binary > form, no, with Python Of course you can! If have done this with pyinstaller. This creates a standalone Windows executable you ca

Re: Tk alternative to askopenfilename and askdirectory?

2015-12-16 Thread Ulli Horlacher
Lorenzo Sutton wrote: > On 16/12/2015 14:18, Ulli Horlacher wrote: > > Is there an alternative to Tk's askopenfilename() and askdirectory()? > > > > I want to select a files and directories within one widget, but > > askopenfilename() let me only select file

Tk alternative to askopenfilename and askdirectory?

2015-12-16 Thread Ulli Horlacher
Is there an alternative to Tk's askopenfilename() and askdirectory()? I want to select a files and directories within one widget, but askopenfilename() let me only select files and askdirectory() let me only select directories. -- Ullrich Horlacher Server und Virtualisierung Rechen

Re: subprocess.call with non-ASCII arguments?

2015-12-16 Thread Ulli Horlacher
Dennis Lee Bieber wrote: > >I want to create a zip file within a Python 2.7 program on windows. > > > >My code: > > > > cmd = ['7za.exe','a','-tzip',archive] + files > > status = subprocess.call(cmd) > > > My first thought would be... > > WHY spawn an OS dependent subprocess...

Re: subprocess.call with non-ASCII arguments?

2015-12-15 Thread Ulli Horlacher
Dennis Lee Bieber wrote: > Python has a zipfile library that is portable between OS. Along with > libraries for gzip, bzip2, and tarfiles... Ohh.. this is new to me! https://docs.python.org/2/library/tarfile.html https://docs.python.org/2/library/zipfile.html What is missing in the doc

Re: cannot open file with non-ASCII filename

2015-12-15 Thread Ulli Horlacher
eryk sun wrote: > pyreadline looked promising for its extensive ctypes implementation of > the Windows console API [1], wrapped by high-level methods such as > peek, getchar, and getkeypress. It turns out it ignores the event > sequences you need for alt+numpad input (used when a file is dragged

Re: subprocess.call with non-ASCII arguments?

2015-12-15 Thread Ulli Horlacher
Ulli Horlacher wrote: > Instead of calling a 7z subprocess with non-ASCII arguments I tried to > call it with a listfile: it starts with a "@" and contains the names of > the files to be packed into the arcive. It is a special 7z feature. > > New code: > >

subprocess.call with non-ASCII arguments?

2015-12-15 Thread Ulli Horlacher
(My first posting seems to got lost) I want to create a zip file within a Python 2.7 program on windows. My code: cmd = ['7za.exe','a','-tzip',archive] + files status = subprocess.call(cmd) leads to: File "fexit.py", line 971, in sendfile_retry status = subprocess.call(cmd) File "C

subprocess.call with non-ASCII arguments?

2015-12-15 Thread Ulli Horlacher
I want to create a zip file within a Python 2.7 program on windows. My code: cmd = ['7za.exe','a','-tzip',archive] + files status = subprocess.call(cmd) leads to: File "fexit.py", line 971, in sendfile_retry status = subprocess.call(cmd) File "C:\Python27\lib\subprocess.py", line 52

Re: cannot open file with non-ASCII filename

2015-12-15 Thread Ulli Horlacher
Laura Creighton wrote: > PyPy wrote its own pyreadline. > You can get it here. https://bitbucket.org/pypy/pyrepl As far as I can see, it has no getkey function. My users do not hit ENTER after drag&drop or copy&paste files. I need an input function with a timeout. -- Ullrich Horlacher

Re: cannot open file with non-ASCII filename

2015-12-14 Thread Ulli Horlacher
Laura Creighton wrote: > Given that Ulli is in Germany, latin-1 is likely to work fine for him. For me, but not for my users. We have people from about 100 nations at our university. > And you do it like this: > > # -*- coding: latin-1 -*- > from Tkinter import * > root = Tk() > s = 'Välkom

cannot open file with non-ASCII filename

2015-12-14 Thread Ulli Horlacher
With Python 2.7.11 on Windows 7 my users cannot open/read files with non-ASCII filenames. They use the Windows explorer to drag&drop files into a console window running the Python program. os.path.exists() does not detect such a file and an open() fails, too. My code: print("\nDrag&drop files

pyinstaller ignores icon

2015-12-14 Thread Ulli Horlacher
pyinstaller ignores a specified icon file: the resulting executable shows the default icon on the desktop. I compile with: S:\python>pyinstaller.exe --onefile --icon=fex.ico fexit.py 31 INFO: PyInstaller: 3.0 31 INFO: Python: 2.7.11 31 INFO: Platform: Windows-7-6.1.7601-SP1 31 INFO: wrote S:\pyth

Re: non-blocking getkey?

2015-12-10 Thread Ulli Horlacher
Ulli Horlacher wrote: > My idea now is: instead of raw_input() I use a get_paste() function, which > reads input character for input character and after a (say) 1 s timeout it > returns the string. Pasting a string with the mouse is rather fast, there > should be no big delay

Re: non-blocking getkey?

2015-12-10 Thread Ulli Horlacher
Christian Gollwitzer wrote: > Another cheap solution comes to mind: On windows, dropping files onto an > icon on the desktop is interpreted as "launch the program with > additional arguments", where the arguments are the file names. Ohhh... great! This helps me a lot! > Maybe you could try i

Re: non-blocking getkey?

2015-12-10 Thread Ulli Horlacher
Christian Gollwitzer wrote: > > My users do not like it :-( > > They want to drag&drop files. > > Therefore I have added it as another option to enter files: > > > > [f] select a file > > [d] select a directory > > [e] enter a file or directory (with drag&drop or copy&paste) >

Re: non-blocking getkey?

2015-12-10 Thread Ulli Horlacher
Ulli Horlacher wrote: > > But... is there a windows program with which one can select files and the > > result is written to STDOUT? > > Found it: > > from Tkinter import Tk > from tkFileDialog import askopenfilename > > Tk().withdraw()

Re: urllib2.urlopen() crashes on Windows 2008 Server

2015-12-06 Thread Ulli Horlacher
Dennis Lee Bieber wrote: > >> Connection reset by peer. > >> > >> An existing connection was forcibly closed by the remote host. > > > >This is not true. > >The server is under my control. Die client has terminated the connection > >(or a router between). > The odds are still good

Re: urllib2.urlopen() crashes on Windows 2008 Server

2015-12-04 Thread Ulli Horlacher
Dennis Lee Bieber wrote: > >I have a Python2 program which runs fine on Windows 7, but > >crashes on Windows 2008 Server R2 64 bit: > > > >downloading http://fex.belwue.de/download/7za.exe > >Traceback (most recent call last): > > File "", line 1992, in > > File "", line 180, in main > > File

urllib2.urlopen() crashes on Windows 2008 Server

2015-12-03 Thread Ulli Horlacher
I have a Python2 program which runs fine on Windows 7, but crashes on Windows 2008 Server R2 64 bit: downloading http://fex.belwue.de/download/7za.exe Traceback (most recent call last): File "", line 1992, in File "", line 180, in main File "", line 329, in get_ID File "", line 1627, in c

Re: static variables

2015-12-01 Thread Ulli Horlacher
Wolfgang Maier wrote: > I'm wondering whether you have a good reason to stick with a function. Easy handling, no programming overhead. Clean, orthogonal code. > What you are trying to achieve seems to be easier and cleaner to > implement as a class: > > class Counter (object): > def __i

Re: static variables

2015-12-01 Thread Ulli Horlacher
Steven D'Aprano wrote: > A better and more general test is: > > if hasattr(a, 'x'): print('attribute of a') Fine! I have now: def a(x=None): if not hasattr(a,'x'): a.x = 0 a.x += 1 print('%d:' % a.x,x) This simply counts the calls of a() But, when I rename the function I have to renam

static variables

2015-11-30 Thread Ulli Horlacher
I try to to implement a "static variable" inside a function: def main(): a(1) a(2) a() print(a.x) if 'a.x' in globals(): print('global variable') if 'a.x' in locals(): print('local variable') def a(x=None): if not x is None: a.x = x print(':',a.x) main() When I run this code,

Re: askopenfilename()

2015-11-28 Thread Ulli Horlacher
Christian Gollwitzer wrote: > Am 28.11.15 um 13:48 schrieb Ulli Horlacher: > > Christian Gollwitzer wrote: > >> Many problems would simply go away if you wrote the whole thing as a GUI > >> program. > > > > Too much hassle. > > The predecessor was

Re: askopenfilename()

2015-11-28 Thread Ulli Horlacher
Ulli Horlacher wrote: > One of my Windows test users reports, that the file dialog window of > askopenfilename() starts behind the console window and has no focus. I have got a followup: this happens only with Windows XP, not with Windows 7. Therefore I will ignore this p

Re: askopenfilename()

2015-11-28 Thread Ulli Horlacher
Christian Gollwitzer wrote: > Am 28.11.15 um 11:29 schrieb Ulli Horlacher: > > One of my Windows test users reports, that the file dialog window of > > askopenfilename() starts behind the console window and has no focus. > > On Linux (XFCE) I do not have this problem. &g

askopenfilename() (was: Re: non-blocking getkey?)

2015-11-28 Thread Ulli Horlacher
Ulli Horlacher wrote: > eryksun wrote: > > On Thu, Nov 19, 2015 at 10:31 AM, Michael Torrie wrote: > > > One windows it might be possible to use the win32 api to enumerate the > > > windows, find your console window and switch to it. > > > > You

Re: fexit: file transfer of ANY size

2015-11-27 Thread Ulli Horlacher
paul.hermeneu...@gmail.com wrote: > > I am now looking for beta testers. If you are interested, send me a mail. > > Can you tell us a git or svn repository from which the kit is available? Available via email request. > Or, is this a proprietary product? No. -- Ullrich Horlacher

fexit: file transfer of ANY size

2015-11-26 Thread Ulli Horlacher
In the last weeks I have asked here some beginners questions and got great response. I was able to solve all my problems. Now, my first real Python program is ready: fexit, a F*EX client. And what is F*EX? ==> Frams' Fast File EXchange, a service for transfering files of ANY size from any user A

Re: readline and TAB-completion?

2015-11-25 Thread Ulli Horlacher
Peter Otten <__pete...@web.de> wrote: > > Is there a way to make TAB-completion work for other directories, too? > > Remove "/" from the set of delimiters: > > readline.set_completer_delims( > "".join(c for c in readline.get_completer_delims() if c != "/")) Great! > > murksigkeiten > > I

readline and TAB-completion?

2015-11-24 Thread Ulli Horlacher
I need an input function with GNU readline support. So far I have: import readline readline.parse_and_bind("tab: complete") file = raw_input('File to send: ') Cursor keys are working, but TAB-completion works only in the current directory. Example: File to send: [TAB][TAB] argv.py

Re: non-blocking getkey?

2015-11-23 Thread Ulli Horlacher
eryksun wrote: > On Thu, Nov 19, 2015 at 10:31 AM, Michael Torrie wrote: > > One windows it might be possible to use the win32 api to enumerate the > > windows, find your console window and switch to it. > > You can call GetConsoleWindow [1] and then SetForegroundWindow [2]. (...) Sorry, for th

Re: non-blocking getkey?

2015-11-19 Thread Ulli Horlacher
Terry Reedy wrote: > On 11/18/2015 11:50 AM, Ulli Horlacher wrote: > > Ulli Horlacher wrote: > > > >> from Tkinter import Tk > >> from tkFileDialog import askopenfilename > >> > >> Tk().withdraw() > >>

Re: pyinstaller and Python 3.5 on Windows?

2015-11-19 Thread Ulli Horlacher
Ulli Horlacher wrote: > C:\Users\admin>pip install pypiwin32 > Collecting pypiwin32 > Downloading pypiwin32-219-cp35-none-win32.whl (7.9MB) > 100% || 7.9MB 61kB/s > Installing collected packages: pypiwin32 > Exception: (...) > Pe

Re: pyinstaller and Python 3.5 on Windows?

2015-11-19 Thread Ulli Horlacher
Kevin Walzer wrote: > I understand that Python 3.5 has shipped how the MS dll's from Visual > Studio are shipped, and perhaps the freezing tools (pyinstaller, py2exe) > haven't yet caught up. Consider filing a bug with the pyinstaller > developers. http://pythonhosted.org/PyInstaller/#windows

Re: handling of non-ASCII filenames?

2015-11-19 Thread Ulli Horlacher
Christian Gollwitzer wrote: > Am 18.11.15 um 17:45 schrieb Ulli Horlacher: > > This is my encoding function: > > > > def url_encode(s): > >u = '' > >for c in list(s): > > if match(r'[_=:,;<>()+.\w\-]',c): > >

Re: pyinstaller and Python 3.5 on Windows?

2015-11-18 Thread Ulli Horlacher
Christian Gollwitzer wrote: > Am 18.11.15 um 23:46 schrieb Ulli Horlacher: > > To run my Python programs on other Windows systems without a Python > > installation I must create standalone Windows executables. > > > > pyinstaller runs without any problems with Pyth

pyinstaller and Python 3.5 on Windows?

2015-11-18 Thread Ulli Horlacher
To run my Python programs on other Windows systems without a Python installation I must create standalone Windows executables. pyinstaller runs without any problems with Python 2.7.10 on Windows 7, but with Python 3.5 I get: S:\python>pyinstaller.exe --onefile tk.py Traceback (most recent call la

Re: handling of non-ASCII filenames?

2015-11-18 Thread Ulli Horlacher
Chris Angelico wrote: > >> If you can use Python 3 > > > > I cannot use it, because the Python compiler pyinstaller does not work > > with it on Windows: > > > > S:\python>pyinstaller.exe --onefile tk.py > > Traceback (most recent call last): > > File "C:\Python35\Scripts\pyinstaller-script.py"

Re: handling of non-ASCII filenames?

2015-11-18 Thread Ulli Horlacher
Chris Angelico wrote: > > As I am Python newbie I have not quite understood the Python character > > encoding scheme :-} > > > > Where can I find a good introduction of this topic? > > Here are a couple of articles on the basics of Unicode: > > http://www.joelonsoftware.com/articles/Unicode.htm

Re: non-blocking getkey?

2015-11-18 Thread Ulli Horlacher
Ulli Horlacher wrote: > from Tkinter import Tk > from tkFileDialog import askopenfilename > > Tk().withdraw() > file = askopenfilename() I found another glitch: After termination of askopenfilename() the window focus is not returned to the callin

handling of non-ASCII filenames?

2015-11-18 Thread Ulli Horlacher
I have written a program (Python 2.7) which reads a filename via tkFileDialog.askopenfilename() (was a good hint here, other thread). This filename may contain non-ASCII characters (German Umlauts). In this case my program crashes with: File "S:\python\fexit.py", line 1177, in url_encode

Re: non-blocking getkey?

2015-11-18 Thread Ulli Horlacher
Chris Angelico wrote: > > In my application the user MUST select files and directories (in one go). > > It's extremely uncommon to be able to select a combination of files > and directories. I have an uncommon application :-) Filetransfer of ANY size: http://fex.rus.uni-stuttgart.de:8080/ >

Re: non-blocking getkey?

2015-11-18 Thread Ulli Horlacher
Steven D'Aprano wrote: > >> The limitation is that this will not work if any of the file names > >> contain astral (non-BMP) chars because tk cannot handle such characters. > > > > What are "astral chars"? > > Unicode characters beyond U+. I see, for very exotic character sets, like Klingo

Re: non-blocking getkey?

2015-11-18 Thread Ulli Horlacher
Terry Reedy wrote: > > from Tkinter import Tk > > from tkFileDialog import askopenfilename > > > > Tk().withdraw() > > file = askopenfilename() > > To get multiple names, add 's'. I have found it already, thanks. > The limitation is that this will not work if any of t

Re: non-blocking getkey?

2015-11-18 Thread Ulli Horlacher
Ulli Horlacher wrote: > it is too complicated to rewrite my application from CLI to GUI. > But... is there a windows program with which one can select files and the > result is written to STDOUT? Found it: from Tkinter import Tk from tkFileDialog import askope

Re: non-blocking getkey?

2015-11-18 Thread Ulli Horlacher
Christian Gollwitzer wrote: > > How can I implement such a get_paste() function? > > I need a non-blocking getkey() function. > > It must work on Windows and Linux. > > Non-blocking I/O from the commandline is OS specific. There are > different solutions, and it's usually hacky (stty on Linux,

  1   2   >