• Member Avatar for Gribouillis
    Gribouillis

    Edited Print with line and file information

    This snippet defines a function `printat()` which adds line and file information to the normal `print()` function output. The intended use is a quick and dirty debugging information for everyday's …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python subprocess return code without waiting with multiprocessing

    You only need to start all the jobs before you call `out_q.get()`.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python subprocess return code without waiting with multiprocessing

    The following code works for me #!/usr/bin/env python # -*-coding: utf8-*- # ./main.py from multiprocessing import Process, Queue from subprocess import Popen, PIPE def runJob(out_q): p1 = Popen(['./jobexe','job_to_run'], stdout=PIPE) out, …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python subprocess return code without waiting with multiprocessing

    It seems to me that with `stdout=PIPE`, the subprocess may hang if nobody reads its stdout. Apparently, you are not doing anything with the output of jobexe, so you don't …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in How can I create a loop that changes a number in a sentence?

    The *conversion specifier* is not the single character `%`. It has 7 components, most of them optional, as described in the documentation: [click here](https://docs.python.org/2/library/stdtypes.html#string-formatting-operations). So, for example `%s` and `%d` …
  • Member Avatar for Gribouillis
    Gribouillis

    Gave Reputation to mattster in old posts

    You might have a question asking for a solution with jQuery version 1.9.X, for instance. But then when someone Googles the same problem 2 years later, when v3.1.0 is out, …
  • Member Avatar for Gribouillis
    Gribouillis

    Gave Reputation to ShawnM9913 in ubuntu 12.04...help

    hello all, well sometimes we just need to be shown the path...problem with Ubuntu 12.04 error "low graphics mode",seems to be my own doing...prior to updating system was low on …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in How to bind extension of file to application?

    If you like utorrent, why don't you install it on your system instead of *spamming me* the performance of torrent clients while I'm trying to help you. Some people [use …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Working SQL client.

    Perhaps this answer [click here](http://stackoverflow.com/questions/11630412/phpmyadmin-xampp-error).
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Working SQL client.

    Sorry, I'm using phpmyadmin very often in kubuntu and it works very well. Perhaps your unorthodox install of xampp instead of lamp creates problems. I would look in the xampp …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Working SQL client.

    You can install phpmyadmin: sudo apt-get install phpmyadmin I hope it will work with your previous xampp install.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in How to bind extension of file to application?

    Whatever the protocol, I don't see why you would need Wine. Your ubuntu has torrent clients (among which deluge). The better solution is to look into linux programs. Only a …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in How to bind extension of file to application?

    I'm not sure about what you mean exactly, and we don't have the same configuration because I'm in kubuntu. If nautilus is your file manager, you can access an ftp …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in How to bind extension of file to application?

    Assuming you installed 14.04 Trusty, look in [this page](http://ubuntuguide.org/wiki/Ubuntu_Trusty_Tips#Associate_default_applications).
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in ubuntu 12.04...help

    Did you try googling for similar issues in ubuntu forums ? Start by reading threads such as this one [click here](http://ubuntuforums.org/showthread.php?t=1968492), where you can find solutions that worked for others.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in How do you run program as root.

    Your installer is not executable. Run chmod a+x xampp* ls -l xampp* In linux one uses `ls` instead of `dir`. You should see -rwxr-xr-x 1 rik rik 124487989 aug 30 …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in How do you run program as root.

    what is the output of `ls -l xampp*` Edit: by the way, why don't you install *lamp* instead of *xampp* ?
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in How do you run program as root.

    do `sudo chmod 755 xampp-linux-*-installer.run` first.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in openSUSE doesn't see different partitions

    > Is it even possible to crash Ubuntu? Ubuntu is very good but not perfect. In fact if something goes wrong, it is generally easy to repair.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in configuration could not be loaded

    You can backup your user data with luckybackup, which is a GUI interface to rsync. Boot with a live ubuntu CD, install luckybackup, visit your hard drive with the file …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in configuration could not be loaded

    I would backup and reinstall if I were you. Why did you run these `chmod -R` commands on system files ? You're not the first one to do such thing, …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Break up a sequence into groups of 3 elements

    Nice, but it shortens the list if the length is not a multiple of 3.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Break up a sequence into groups of 3 elements

    It was [my first code snippet](https://www.daniweb.com/software-development/python/code/217111/cutting-a-string-in-equal-pieces) in daniweb :). Here we go >>> splitIt = lambda d, s: [s[i:i+d] for i in range(0, len(s), d)] >>> mylist = [0, 1, …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Generating Keyboard Presses

    > Can this module use the hex codes It probably does as this [source code](https://github.com/SavinaRoja/PyUserInput/blob/master/pykeyboard/windows.py) suggests. You could write some tests like >>> from pykeyboard import PyKeyboard >>> k = …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Need help to linux ubuntu FAST!!

    Here is an [official page](https://help.ubuntu.com/12.04/serverguide/mysql.html). Sorry I can't help finding a good Javascript/HTML/PHP/CSS Coder. I'm mostly a python coder.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Generating Keyboard Presses

    Great! let us know if PyUserInput suits your needs.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Need help to linux ubuntu FAST!!

    I often use aptitude because of the search command sudo apt-get install aptitude Now search packages related to mysql sudo aptitude search mysql Install what you want sudo apt-get install mysql-common …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Need help to linux ubuntu FAST!!

    In ubuntu one uses `apt-get` instead of `yum`.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Generating Keyboard Presses

    You need to install *setuptools*. Follow [these instructions](https://pypi.python.org/pypi/setuptools).
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in configuration could not be loaded

    You could try a very nice trick which I used recently to restart a ubuntu PC without the password - Restart the computer and in Grub, choose *Recovery Mode* - …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Generating Keyboard Presses

    Sorry, the folder must be added to PATH (provided there is a file `C:\Python33\Scripts\pip.exe`)
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Generating Keyboard Presses

    For pip, you need `C:\Python33\Scripts` in the PYTHONPATH
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Generating Keyboard Presses

    PATH and PYTHONPATH are 2 different things. You must update the PATH to contain C:\Python33, but be careful not to remove useful folders. Edit: [this tutorial](http://computertutorialsonline.com/change-path-environment-variable-in-windows-8) may help you.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Generating Keyboard Presses

    You must set the PATH environment variable. It must contain a python directory (C:\Python34). Also, if you dont need 2 versions of python 3, you could uninstall python 3.3.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Generating Keyboard Presses

    I see that you have several installs of python on your computer. First type python -c "import sys; print(sys.executable)" in a cmd prompt, to see which is the default python. …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in openSUSE doesn't see different partitions

    I agree with Slavi that *gparted* is probably the tool you need. What you can do is burn a [boot-repair-disk](http://sourceforge.net/projects/boot-repair-cd/files/). Apart from repairing boots, it contains a few tools, among …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Generating Keyboard Presses

    Perhaps the pip executable is not on your path. Find the location of pip.exe in your file system. (If you can't find it, install Locate32 to find it)
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in HOW TO LEARN LINUX IN WINDOWS

    http://www.ubuntu.com/download/desktop
  • Member Avatar for Gribouillis
    Gribouillis

    Gave Reputation to mike_2000_17 in HOW TO LEARN LINUX IN WINDOWS

    > tell me which ubuntu version shall i go along with virtual machine? The latest LTS version is probably the best place to start, that is, version 14.04. > can …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Generating Keyboard Presses

    Did you run the pip installer first ?
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Generating Keyboard Presses

    To use pip, in Windows, execute the program `cmd`, and type pip install PyUserInput in cmd's terminal window. In ubuntu linux, open a terminal and type sudo pip install PyUserInput …
  • Member Avatar for Gribouillis
    Gribouillis

    Gave Reputation to snippsat in Generating Keyboard Presses

    Use [PyUserInput](https://github.com/SavinaRoja/PyUserInput) Install [Pywin32](http://www.lfd.uci.edu/~gohlke/pythonlibs/#pywin32) and [Pyhook](http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyhook) Install [pip](http://www.lfd.uci.edu/~gohlke/pythonlibs/#pip) Then do `pip install PyUserInput` from pykeyboard import PyKeyboard k = PyKeyboard() # pressing a key k.press_key('H') # which you then follow …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in IndexError: list index out of range

    You must not consider that the first problem is *fixed* by the above code, it is at most hidden or ignored as long as we don't write corrective code to …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in IndexError: list index out of range

    The first thing you can do is raise an exception when this error is detected, for example: class CannotGrabTime(Exception): pass def findNST(html): NST = re.findall(r'<td id="nst">(.*) am', html) if NST …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in IndexError: list index out of range

    If you want to fix this, you must say what the bot should do when it doesnt grab the time because it gets a blank page.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in LINUX IDE FOR WINDOWS

    Use a video tutorial such as [this one](https://www.youtube.com/watch?v=0WiiswmOH1Q).
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Print with line and file information

    > I like this. I modified it so the function name would be included with frame.f_code.co_name. Yes it is tempting to do so. In exceptions tracebacks, the function name is …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in lamda expression to match beginning of line with any digit

    Don't forget the case where there is no `line[0]`: lambda line: bool(line and (line[0] in string.digits))
  • Member Avatar for Gribouillis
    Gribouillis

    Revoked Solved Status for lamda expression to match beginning of line with any digit

    I'm trying to design a lambda function that returns any line in a file that begins with any digit [0-9]. The point would be to return the whole line if …
  • Member Avatar for Gribouillis
    Gribouillis

    Marked Solved Status for lamda expression to match beginning of line with any digit

    I'm trying to design a lambda function that returns any line in a file that begins with any digit [0-9]. The point would be to return the whole line if …

The End.