• Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in How to print Pig Latin in Pig Latin?

    If you want to translate more than one sentence, you can use a loop if __name__ == "__main__": while True: x = main() print(x)
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in How To Create A 2D Coordinate Grid In Python

    You can get this with coordinates = [(i, j) for j in range(11) for i in range(11)] although many programmers would use numpy for such tasks.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in How To Create A 2D Coordinate Grid In Python

    You're running out of memory because `calculatingcoords` never becomes `False`, and the loop runs forever, appending more and more items to `coordinates`. It would be easier if you give us …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in How to change file bits without reading entire file

    Are you looking for a xor cipher https://en.wikipedia.org/wiki/XOR_cipher ?
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python 2 Versus Python 3

    I think these compatibility issues will exist forever. The solution is to stop using python 2.x code. The main sources of backward incompatibility are * The print statement without () …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python 2 Versus Python 3

    If you are learning python now, learn python 3. It has been around for quite a while now, and many features have been added. If you learn python 2, you …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in draw a triangle and its median?

    Where did you copy and paste this code ? There are many errors: `trutle`, `tirangle`, also what is the `triangle` object, and the method `triangle.setFill` etc ? Start with a …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Websocket Server Problem

    According to the documentation, the module requires a python version >= 3.4. I'm afraid it won't run on your python 2.7. I hope somebody else can help you because I …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Websocket Server Problem

    You could perhaps start with an example similar to the "getting started" part of the [websocket documentation](https://websockets.readthedocs.io/en/stable/intro.html)
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in PDF file: Access denied

    In linux, there are programs such as `file` or `kmimetypefinder` to help guess the type of a file, for example here is a sequence of commands $ mv x.zip x.pdf …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in AttributeError: module 'pandas' has no attribute 'read_csv'

    This is annoying. Mine says print(pd) <module 'pandas' from '/usr/local/lib/python3.4/dist-packages/pandas/__init__.py'> I don't understand where your pandas module comes from. Can you try print(pd.__file__) Also is there a file named `pandas.py` …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in AttributeError: module 'pandas' has no attribute 'read_csv'

    Try `print(pd)` to see where this pandas comes from.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in group tuple values with tolerance and average

    @JamesCherrill In your example my 'key' algorithm groups the 3s and the 5s in a one-liner because the keys x//3 for the values (1, 3, 3, 5 ,5, 5, 5) …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in group tuple values with tolerance and average

    Or perhaps you could try n = len(set((x//tol, y//tol) for (x, y) in data)) as a rough estimate of the number of clusters.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in group tuple values with tolerance and average

    I don't know this cluster module. The number of clusters can probably be determined by * The shape of the clusters * Your tolerance * The minimum and maximum values …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in how generate dictionary from checkbutton

    There is a good example at the bottom of this page http://www.python-course.eu/tkinter_checkboxes.php . Take the time to read about the use of tkinter Variable classes.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in group tuple values with tolerance and average

    You could try to compute a key for each pair `(x, y)`, the key could be `(x//3, y//3)` for a tolerance of 3. Then you sort the data by the …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Sync local folder with FTP folder

    I suggest a bash script #!/bin/bash while true; do lftp -f /path/to/lftp-script sleep 300 done lftp is a very good way to sync a local folder with an FTP folder.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in I have a problem with bootloader , it does not appear!!

    Go to this site https://sourceforge.net/projects/boot-repair-cd/ , download and burn the boot-repair-disk, then reboot the computer on the boot-repair disk, click on the displayed button and let the disk repair your …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Resolve a lineare systeme n*m in C

    Rosetta Code has a solution in 27 programming languages https://rosettacode.org/wiki/Gaussian_elimination I didn't test them ... Also, it may work only for square matrices.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in How to re-start a loop in Python?

    You can exit the loop with a `break` statement or by setting start to another value, for example `start = "Don't start"`.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in How to re-start a loop in Python?

    You could replace line 7 with while start == 'Start': and remove the `for loop in start`, which is not good: loop takes the values 'S', 't', 'a', 'r', 't', then …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Getting an input from arrow keys.

    @The_6 This thread is 6 years old, I guess AutoPython moved to another project since then. Please don't revive old threads, start new ones instead !
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python 3 md5 error

    This file is not the file hashlib.py from the python's standard library. You could rename it (for example myhashlib.py). Make sure that there are no hashlib.pyc or hashlib.pyw in the …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python 3 md5 error

    You may be shadowing the standard lib's hashlib module with another module with the same name. Try import hashlib print(hashlib)
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in A contact database using a dynamic-single linked list in ANSI C

    Majestic0100 is probably working on another project now as this thread was started 8 years ago!
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python TKinter delay hangs using after method

    In this new version, the pausing method only generates integers to specify the number of milliseconds to pause. The calls to `after()` are handled by a wrapper class from tkinter …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python TKinter delay hangs using after method

    A still better idea uses a generator (tested with python 3) : from tkinter import * class Helper: __name__ = 'Helper' def __init__(self, func, *args, **kwargs): self.gen = func(self.sleep, *args, …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python TKinter delay hangs using after method

    There are probably several ways to accomplish this, for example def method(self, step, a, b): if step == 'start': do_something(a, b) root.after(2000, self.method, 'again', a, b) elif step == 'again': …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in graphuc design

    Who told you it is important ?
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python TKinter delay hangs using after method

    You probably want to call `after()` with a method argument class App: def test(self): print('hello') root.after(10000, self.endoftest) def endoftest(self): print('world')
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in rsync error

    The mkstemp C function failed to create a temporary directory (see `man mkstemp`). The yr2Xyc looks like a string generated by mkstemp according to this documentation. The question is why …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python subprocess interact cmd with administrator rights

    It is very difficult to run an interactive session with the subprocess module. Some of your statements look suspicious, such as `prog.stdout.read()` instead of `prog.stdout.readline()` to read a single line, …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python sqlalchemy error

    Look at the example [Click Here](http://docs.sqlalchemy.org/en/latest/orm/backref.html). Obviously the `back_populates` value must be the name of one of the other classes attributes.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in File not transfferring to client. (Python)

    The main issue IMHO is that you open the file in mode "wb+" instead of "rb" on the server side. You may have erased some files with this. Also note …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Installing pymongo package to paython 3.5

    If you're in windows, try the version from Christoph Gohlke's site [Click Here](http://www.lfd.uci.edu/~gohlke/pythonlibs/) !
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in With Python

    You could also start by reading this Howto from the python documentation [Click Here](https://docs.python.org/3.5/howto/webservers.html)
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python PySFTP

    Perhaps you need the cryptography module [Click Here](https://pypi.python.org/pypi/cryptography) ?
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python 2 vs. Python 3

    I don't think studying my code snippets is good way to learn python. Most of them deal with specialized tips and tricks. More seriously, you could visit [the hitchiker's guide …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python 2 vs. Python 3

    A crash course for unicode from, to bytes (works in 2 and 3, only the 'str' class in 3 is named 'unicode' in 2, and the 'byte' class in 3 …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python 2 vs. Python 3

    Among the various reasons why some people stick with python 2 is the fact that many linux distributions still come with python 2 as their default python interpreter, because many …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in How to handle Error Handling

    In python, there is an awesome **else** part in the try statement, so you can write for example try: f = open('foo.txt', 'w') except OSError: print('could not open file') else: …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Synsets in Wordnet for NLTK

    I'm getting this output on kubuntu with python 2.7, with almost the same code ========================================== Compare this with the dynamic case when the data is changing , for example watching …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Synsets in Wordnet for NLTK

    But what is the input file ?
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Synsets in Wordnet for NLTK

    If you can attach `answer_token.txt` to a post, I could try the code.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Synsets in Wordnet for NLTK

    It seems to me that there is an indention error at line 11. Line 11 should be in the `for b` loop.
  • Member Avatar for Gribouillis
    Gribouillis

    Gave Reputation to JasonHippy in Having persistent stty settings

    > Of course, you need to restart bash after modifying ~/.bashrc. Actually you don't have to restart bash at all. You can re-load/re-source any of the changed config files in …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Problem Using Python Socket Server

    Can you post the whole error message ? Edit: this is unrelated to the issue, but if you want to run the program several times, it would be good to …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Having persistent stty settings

    You could try the answer here [Click Here](http://superuser.com/questions/212446/binding-backward-kill-word-to-ctrlw) using `"\C-i"` instead of `"\C-w"`. Of course, you need to restart bash after modifying `~/.bashrc`.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Getting Ubuntu Server Virtual Machine to allow scrolling through output

    It should be relatively easy to enable access to USB devices from the ubuntu server. In the machine configuration, activate the USB controler and the USB 2.0 controler, then add …

The End.