2,646 Posted Topics
Re: `socket.send()` may not send all its data as per the socket module's documentation. Use `sendall()` for example. | |
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 … | |
Re: 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 … | |
Re: 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. | |
Re: > 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, … | |
Re: 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) | |
Re: 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) | |
Re: 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. | |
Re: As a python beginner, I suggest that you stick to a single version of python. Don't pile up difficulties. | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: Are you looking for a xor cipher https://en.wikipedia.org/wiki/XOR_cipher ? | |
Re: 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)): | |
Re: 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 … | |
Re: Here is a short python version def digitinc(a): return int(''.join(str((1 + int(x)) % 10) for x in str(a))) | |
Re: 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 … | |
Re: @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. | |
Re: > 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 … | |
Re: 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 … | |
Re: 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 | |
![]() | Re: If you want to translate more than one sentence, you can use a loop if __name__ == "__main__": while True: x = main() print(x) |
Re: 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`. | |
Re: 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 … | |
Re: 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) | |
Re: 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 … | |
Re: 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 … | |
Re: 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. | |
Re: 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. | |
Re: 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 ! | |
Re: 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. | |
Re: 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. | |
Re: @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 ! | |
Re: You may be shadowing the standard lib's hashlib module with another module with the same name. Try import hashlib print(hashlib) | |
Re: 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') | |
Re: 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 … | |
Re: 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) | |
Re: 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 … | |
Re: 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 … | |
Re: If you're in windows, try the version from Christoph Gohlke's site [Click Here](http://www.lfd.uci.edu/~gohlke/pythonlibs/) ! | |
Re: 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. | |
Re: 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 … | |
Re: You could also start by reading this Howto from the python documentation [Click Here](https://docs.python.org/3.5/howto/webservers.html) | |
Re: Perhaps you need the cryptography module [Click Here](https://pypi.python.org/pypi/cryptography) ? | |
Re: 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] … ![]() | |
Re: 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 … | |
Re: It seems to me that there is an indention error at line 11. Line 11 should be in the `for b` loop. | |
Re: 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 … | |
![]() | Re: 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`. ![]() |
The End.