2,646 Posted Topics

Member Avatar for Zach_2

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

Member Avatar for Zach_2
0
408
Member Avatar for Gribouillis

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, so that the robot would be satisfied. Can you help me ? (qupzilla/linux) edit: with firefox, it works. Only it's …

Member Avatar for Gribouillis
0
631
Member Avatar for Xavier_6

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 parameter. As I don't know this module, the best thing to do is to post here the whole error traceback …

Member Avatar for Gribouillis
0
2K
Member Avatar for Ramaah

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 Aeonix
-5
632
Member Avatar for inkcoder

> n i have to make mini project in python.... n i have completed it half bt i cannot do the remaining... plx help me anyone bcx i hv 2 submit the project on monday Start a new thread describing your project and post the code you have so far, …

Member Avatar for Gabriel_9
1
49K
Member Avatar for Pi

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
0
303
Member Avatar for Kristians

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
0
435
Member Avatar for lokesh_6

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 :) I would start with pydicom for example.

Member Avatar for Gribouillis
0
318
Member Avatar for Lucas_10

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

Member Avatar for Lucas_10
0
390
Member Avatar for Lucas_10

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 will not be fluent in modern python. Some tiny details may seem weird, such as the parenthesis in `print()`, but …

Member Avatar for ddanbe
0
1K
Member Avatar for bryann

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 the floating point number 3.56 according to my machine's precision. The corresponding real value is not exactly 3.56, it is …

Member Avatar for Gribouillis
0
364
Member Avatar for happygeek

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 right to vote. I don't believe the media. I remember in 1980, they described Reagan as a cowboy with rough …

Member Avatar for AssertNull
2
994
Member Avatar for Mr.M
Member Avatar for paul_46

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 rproffitt
0
293
Member Avatar for Amber_6

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 = re.compile(r'^\s*ACT\s+(\d+)\s*$') scene_re = re.compile(r'^\s*Scene\s+(\d+)\s*$') character_re = re.compile(r'^(\s*[A-Z]{2}[A-Z]*)+') def scan(lines): for x in lines: mo = act_re.match(x) if mo: yield …

Member Avatar for Gribouillis
0
345
Member Avatar for Roger_2

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 Taywin
0
461
Member Avatar for wine_1

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 array elements. You could print(img.dtype) before and after the division to see what it does. You can also print the …

Member Avatar for Gribouillis
0
250
Member Avatar for Viasur

@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 if you have questions.

Member Avatar for Gribouillis
0
4K
Member Avatar for Nether_1

> 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 of your own interpretation of this message ? Also it is much better to raise an exception than to print …

Member Avatar for Gribouillis
0
538
Member Avatar for JamesCherrill

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, and it is very practical. This python version uses **generators**, which is a kind of coroutine, but I think it …

Member Avatar for JamesCherrill
1
462
Member Avatar for Aeonix

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 don't know if this will work in more recent versions of kubuntu

Member Avatar for Aeonix
0
2K
Member Avatar for pasta

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
0
535
Member Avatar for Nether_1

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 an example of your expected result in the list `coordinates`.

Member Avatar for Nether_1
0
9K
Member Avatar for Mengchen

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 simple code **that runs on your python interpreter**, so that we can run it too. Start with code that simply …

Member Avatar for slate
0
988
Member Avatar for Andrew_34

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 Andrew_34
0
679
Member Avatar for Jim_14

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 $ kmimetypefinder -c x.pdf application/zip $ file x.pdf x.pdf: Zip archive data, at least v2.0 to extract Using a live …

Member Avatar for happygeek
0
314
Member Avatar for giancan

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 key and you group together the points having the same key, using `itertools.groupby()`. You can then average the values in …

Member Avatar for JamesCherrill
0
824
Member Avatar for Pandey_1

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
0
513
Member Avatar for Aeonix

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 cereal
0
2K
Member Avatar for rose_2

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 boot. It never failed for me !

Member Avatar for Gribouillis
0
227
Member Avatar for daniel_61

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
0
200
Member Avatar for Artur_5

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 the loop exits. This is probably not what you want.

Member Avatar for Gribouillis
0
483
Member Avatar for AutoPython

@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
1
49K
Member Avatar for <HHH>

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 <HHH>
0
2K
Member Avatar for Crazyscript77

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
0
7K
Member Avatar for hpoddar

You could add a 'mock section' and still use ConfigParser # tested with python 2.7.2 import ConfigParser from functools import partial from itertools import chain class Helper: def __init__(self, section, file): self.readline = partial(next, chain(("[{0}]\n".format(section),), file, ("",))) config = ConfigParser.RawConfigParser(allow_no_value=True) with open("essconfig.cfg") as ifh: config.readfp(Helper("Foo", ifh)) print(config.get("Foo", "old_passwords")) The config …

Member Avatar for Anand_10
0
12K
Member Avatar for Khalid_8
Member Avatar for pythonBasic

I don't understand the question. You could perhaps use the `requests` library. [Click Here](http://docs.python-requests.org/en/master/user/quickstart/#make-a-request)

Member Avatar for mcroni
0
288
Member Avatar for lewashby

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 did the program fail to create a temporary directory on your SD card ? Are you sure the card is …

Member Avatar for rproffitt
0
441
Member Avatar for Crazyscript77

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, `prog.stdout.seek(0)` (prog.stdout is not a regular file). If you write lines to `prog.stdin`, the lines should end with a newline …

Member Avatar for Gribouillis
0
10K
Member Avatar for <HHH>

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 ~s.o.s~
0
2K
Member Avatar for <HHH>

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 <HHH>
0
10K
Member Avatar for Zach_2

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 that serving files through your own socket server is not the most robust solution. You could use turnkey solutions such …

Member Avatar for Gribouillis
0
288
Member Avatar for lewashby

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 lewashby
0
1K
Member Avatar for lewashby

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

Member Avatar for Gribouillis
0
2K
Member Avatar for vegaseat

You can reach the same result without a thread. Can you explain why you start a thread ? Here is my code #!/usr/bin/env python # -*-coding: utf8-*- from __future__ import (absolute_import, division, print_function, unicode_literals) from datetime import datetime import sys # make this work with Python2 or Python3 if sys.version_info[0] …

Member Avatar for Viresh_2
0
9K
Member Avatar for AssertNull

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 of their system scripts are written in python 2. For example, I'm using kubuntu 14.04, so April 2014, and my …

Member Avatar for AssertNull
0
1K
Member Avatar for influx

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 influx
0
413
Member Avatar for Violet_82

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: f.write('Hello there\n') f.close() finally: print('executing finally') The else part is only executed if the try part succeeded, and the finally …

Member Avatar for Gribouillis
0
418
Member Avatar for Nathan_6

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 Nathan_6
0
2K

The End.