• Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python program to extract IP Addresses from a log file

    Thank you for your support. I'm a python programming enthusiast and I like to share this knowledge! You could get the IP by regex, for exemple match = re.search(r'->\s*([0-9]+(?:\.[0-9]+){3})', entry) …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python program to extract IP Addresses from a log file

    1- If you want to group when the sequence is unordered, you must sort the input before using groupby() 2- The `elif` needs the same indention as the corresponding `if`. …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python program to extract IP Addresses from a log file

    Well, `groupby()` works by computing a key for each item and by grouping together items having the same key. I could as well have written def get_key_of_line(line): return line.split('.', 1)[0] …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in DICE ROLL

    The home site www.python.org has a special [page for beginners](https://www.python.org/about/gettingstarted/) with good links, you could perhaps start from here. Concerning your specific code, without entering into details * At line …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in arguments with non latin character

    This is a windows issue, so I cannot help you much, furthermore, it seems to be a python 2 issue only. You could try solutions such as [<this one>](http://stackoverflow.com/questions/846850/read-unicode-characters-from-command-line-arguments-in-python-2-x-on-windows) for …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python program to extract IP Addresses from a log file

    You could use `itertools.groupby` and `collections.Counter`. Something along the lines of newip = [] c = Counter() for key, group in groupby(logfile, key=lambda e: e.split('.',1)[0]): for entry in group: c.update(re.findall(r'[0-9]+(?:\.[0-9]+){3}', …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Restart your python program.

    @Aman_7 The only thing that doesn't work in your case is input/output to the console. Your tkinter program could create a text widget and redirect its output to the text …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python 3.6 Beginner here, need help

    That's where we completely disagree. I think it is one of the best design choices in the python language.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python 3.6 Beginner here, need help

    Well, `range(10)` contains the numbers `0 1 2 3 4 5 6 7 8 9` while `range(10, 110, 10)` contains `10 20 30 40 50 60 70 80 90 100` …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in python-django

    You should be using the python interpreter and the pip command from your venv bin/ directory. What's in your venv's bin directory ?
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in python-django

    This is strange, there should be a python interpreter in the virtualenv's bin/ directory. Didn't you create the virtualenv with a python interpreter such as in virtualenv --python=python2.7 mydir ?
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in python-django

    Try `which pip` and `which python`. Both should be in your virtual env's `bin` directory. `django-admin.py` should be in the same directory. You can also use `locate django-admin.py` to find …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python Socket not Sending All of an Image.

    Can you post your code (in the forum please, not in github) ?
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python Socket not Sending All of an Image.

    `f=open('conflict.png','wb')` should be out of the while loop !
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python Socket not Sending All of an Image.

    `socket.send()` may not send all its data as per the socket module's documentation. Use `sendall()` for example.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Restart your python program.

    @Claire_2 It works by calling the [execl](https://docs.python.org/3/library/os.html#os.execl) system function. This is a fundamental mechanism of the OS that also belongs to the posix standard ([See here](http://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html)).
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in We are unable to verify that you are human

    Hm, no, I can not turn it off once I'm logged in. I'll keep my referer headers on :)
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in We are unable to verify that you are human

    @rproffitt I was only playing with the browser settings in order to solve an unrelated issue. I unchecked the referer headers just to see if it would change anything, also …
  • Member Avatar for Gribouillis
    Gribouillis

    Gave Reputation to rproffitt in We are unable to verify that you are human

    OK, I grabbed the Windows Portable version, ran it, Dazah login and now this reply. That's as clean as I can make this. If this posts, it worked on W10.
  • Member Avatar for Gribouillis
    Gribouillis

    Marked Solved Status for We are unable to verify that you are human

    This is the message I get while trying to answer in a thread. Only, there is no clue of what I could do to prove that I'm actually a human, …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in We are unable to verify that you are human

    Solved: it started to work again when I configured qupzilla to send the Referer headers to the server !
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in could not broadcast input array from shape (1688) into shape (2)?

    It seems that your code is trying to execute indirectly an invalid numpy [broadcasting operation](https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html). My guess is that one of your calls to the pybrain API receives an incorrect …
  • Member Avatar for Gribouillis
    Gribouillis

    Edited We are unable to verify that you are human

    This is the message I get while trying to answer in a thread. Only, there is no clue of what I could do to prove that I'm actually a human, …
  • Member Avatar for Gribouillis
    Gribouillis

    Created We are unable to verify that you are human

    This is the message I get while trying to answer in a thread. Only, there is no clue of what I could do to prove that I'm actually a human, …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in object oriented programming

    My browser cannot follow this link. I thought about «moderating» the post for spam reason, but well, let it live as an example of a terrible post.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in change update method with time.sleep into after method

    You could use the technique I described in this post [https://www.daniweb.com/programming/software-development/threads/505937/python-tkinter-delay-hangs-using-after-method#post2209392](https://www.daniweb.com/programming/software-development/threads/505937/python-tkinter-delay-hangs-using-after-method#post2209392)
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Patchworks using Python graphics (graphics.py)

    Hello This thread looks very close to your issue [https://www.daniweb.com/programming/software-development/threads/468573/help-with-improving-the-code-using-the-python-graphic-py-john-zelle](https://www.daniweb.com/programming/software-development/threads/468573/help-with-improving-the-code-using-the-python-graphic-py-john-zelle)
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in how to readdicom image in python

    Various python packages handling dicom images can be found in the Python Package Index [https://pypi.python.org/pypi?%3Aaction=search&term=dicom](https://pypi.python.org/pypi?%3Aaction=search&term=dicom) . I don't know them, so I suggest you test them and evaluate them :) …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Restart your python program.

    There are two ways to restart your program: either you exit the running process and you start a new one, this is what this snippet does, or you stay in …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Restart your python program.

    @aman_7 your question is a little too vague. Did you try to run your code outside of idle (from an ordinary terminal) to see what it does ? You could …
  • Member Avatar for Gribouillis
    Gribouillis

    Edited Group Thread | CodeNet.com

    So, I'm making a ton of games like Bubble Blaster but will anyone help me with my currunt one, CodeNet! Currently this is the code. #CodeNet.com #Game Script import time …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Group Thread | CodeNet.com

    As a python beginner, I suggest that you stick to a single version of python. Don't pile up difficulties.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Mod- unexpected result

    On my computer, when I write f = 3.56 in a python program, the following bits are stored in memory 0 10000000000 1100011110101110000101000111101011100001010001111011 This is the IEEE 754 representation of …
  • Member Avatar for Gribouillis
    Gribouillis

    Gave Reputation to AssertNull in Good luck America

    > In a way I think it is too easy to denigrate a leader for people who do nothing but watch the world events on TV. Teddy Roosevelt called it. …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Good luck America

    Wikipedia has a [<whole page>](https://en.wikipedia.org/wiki/Public_image_of_George_W._Bush) about G.W.Bush's popularity. As a citizen, I don't like the idea of following the herd and make my opinions about a leader just because most …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Finding 1,2,3, in a user defined list

    You could use if all(x in A for x in (1, 2, 3)): or if set((1, 2, 3)).issubset(A): or if 3 == len(set(range(1, 4)) & set(A)):
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Good luck America

    When the president is unpopular, it creates a detestable political atmosphere in the country. The french president currently has a popularity rating of about 4%. Here is an [<article>](https://www.washingtonpost.com/news/worldviews/wp/2016/07/05/nearly-90-percent-of-the-french-now-disapprove-of-their-president/) from …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Good luck America

    Hmm. Politicians never want to get rid of power. I think the republicans will govern the US with Trump as president. Do you think they want to give power to …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in find the first appearance of a word and count its occurrence

    You could start by scanning the text with the re module #!/usr/bin/env python # -*-coding: utf8-*- '''doc ''' from __future__ import (absolute_import, division, print_function, unicode_literals) import io import re act_re …
  • Member Avatar for Gribouillis
    Gribouillis

    Gave Reputation to rproffitt in find the first appearance of a word and count its occurrence

    This reads like a wheel. I took a google like https://www.google.com/search?q=shakespeare+full+indexed+in+python and found not only Shakespeare fully indexed but [Whoosh](https://pypi.python.org/pypi/Whoosh/). Everywhere I looked, the solutions were > 32 lines. But …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Good luck America

    To speak frankly, as non american, I don't have any opinion about this election. Media in France support Clinton, whatever that means to support someone when you don't have the …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in A function that takes a 4 digit integer and adds 1 to each digit in scheme

    Here is a short python version def digitinc(a): return int(''.join(str((1 + int(x)) % 10) for x in str(a)))
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in the operator or / in python

    Ok, I tried it on my computer. The answer is that with python 3 or python 2 with `from __future__ import division`, the result is an array of float, but …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in the operator or / in python

    Images in this context are simply numpy arrays (see http://scikit-image.org/docs/dev/user_guide/numpy_images.html) Read this guide about data types http://scikit-image.org/docs/dev/user_guide/data_types.html Numpy arrays have a property `.dtype` to tell you the datatype of the …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in syntax error on csv importing file

    @Temitope_2 you may be using an old version of python without a with statement. Run `python --version` to check. Also don't revive old forum threads. Start your own thread instead …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Function Not Recognizing Parameters Being Passed To It

    `if vertice in self.vertice:` should be `if vertice in self.vertices:`. It is not a very good idea to use both vertice and vertices. You could write `if ver in self.vertices:` …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Function Not Recognizing Parameters Being Passed To It

    > it gives an error saying that the term 'vertice' in the function editVertice is not recognized Can you post (as code) the complete error message sent by python instead …
  • Member Avatar for Gribouillis
    Gribouillis

    Gave Reputation to JamesCherrill in Nested array printing etc - designing for reuse

    This is a little discussion/example of design for modularity and re-use, inspired by javaAddict and Orlando Augusto posts in their thread “Dynamic Multidimensional Array Printing” https://www.daniweb.com/programming/software-development/code/305580/dynamic-multidimensional-array-printing That thread has 3 …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Nested array printing etc - designing for reuse

    I once wrote an alternative code to using the visitor pattern for this in the python language. See this snippet [Generic non recursive tree traversal](https://www.daniweb.com/programming/software-development/code/395270/generic-non-recursive-tree-traversal). I'm using it quite often, …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Can't change keyboard layout, some cryptic stuff I don't understand.

    In kubuntu 14.04 you can do it with the System Configuration app. See the attached snapshots (sorry it's in french). I can add as many keyboard layouts as needed. I …

The End.