Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: option -c and semicolon not working as expected
Post: RE: option -c and semicolon not working as expecte...
(Aug-12-2022, 09:51 PM)Skaperen Wrote: any idea why it fails in my output in post #1?The ';' just after the ':' doesn't look right.
Also the semicolon does not separate lines in Python. It separate... |
|
Gribouillis |
News and Discussions |
6 |
115 |
Aug-12-2022, 09:53 PM |
|
|
Thread: Python Hates me
Post: RE: Python Hates me
(Aug-12-2022, 02:08 PM)quarinteen Wrote: I keep getting an error about the json file needs to be a string.Why don't you post the complete error message? Python shows its warmth by providing informat... |
|
Gribouillis |
General Coding Help |
4 |
137 |
Aug-12-2022, 09:47 PM |
|
|
Thread: option -c and semicolon not working as expected
Post: RE: option -c and semicolon not working as expecte...
(Aug-12-2022, 05:35 PM)Skaperen Wrote: the real point is, that i have seen people using -c and ";" and it works for themThe semicolon exists in Python's syntax too, which may be the reason why it wo... |
|
Gribouillis |
News and Discussions |
6 |
115 |
Aug-12-2022, 06:32 PM |
|
|
Thread: Shoud we use PIL or Pillow?
Post: RE: Shoud we use PIL or Pillow?
(Aug-12-2022, 02:08 PM)snippsat Wrote: Just use pip.I did that and it seems to work well
Output:λ python -m pip install Pillow --upgrade
Defaulting... |
|
Gribouillis |
News and Discussions |
3 |
117 |
Aug-12-2022, 02:45 PM |
|
|
Thread: Updating Tkinter label using multiprocessing
Post: RE: Updating Tkinter label using multiprocessing
The object c_queue is not callable. Try this perhaps
def CheckQueuePoll(self, c_queue):
try:
str = c_queue.get_nowait()
c_queue.task_done()
self.current... |
|
Gribouillis |
GUI |
6 |
128 |
Aug-12-2022, 02:37 PM |
|
|
Thread: Shoud we use PIL or Pillow?
Post: Shoud we use PIL or Pillow?
Which of the two should we use and why?
My Kubuntu 22.04 OS comes with python3-pil installed. Can I install python3-pillow and use both of them? |
|
Gribouillis |
News and Discussions |
3 |
117 |
Aug-12-2022, 01:34 PM |
|
|
Thread: Universal(MACWINLIN) canvas pdf export
Post: RE: Universal(MACWINLIN) canvas pdf export
I would try to draw in parallel a PIL image and the tkinter canvas like in this very old forum post. The pil image can be saved as pdf in modern versions of pil. You could define your own functions su... |
|
Gribouillis |
General Coding Help |
3 |
104 |
Aug-12-2022, 11:26 AM |
|
|
Thread: Filter and str.isdigit producing an error
Post: RE: Filter and str.isdigit producing an error
Using regular expressions
>>> import re
>>> s = '1918 November 11 day'
>>> int(re.sub(r'[^\d]+', '', s) or '0')
191811
>>> |
|
Gribouillis |
General Coding Help |
5 |
136 |
Aug-12-2022, 07:50 AM |
|
|
Thread: option -c and semicolon not working as expected
Post: RE: option -c and semicolon not working as expecte...
(Aug-11-2022, 10:04 PM)Skaperen Wrote: can someone tell me what i should be using for this case that the 1st example shows?Instead of the -c option, you can use a here document in bash
Output:$ pyth... |
|
Gribouillis |
News and Discussions |
6 |
115 |
Aug-12-2022, 05:56 AM |
|
|
Thread: repeating a range
Post: RE: repeating a range
(Aug-09-2022, 07:03 PM)Yoriz Wrote: As far as I can tell I turned your description into code.When you have
for x in iter(spam):
...you can as well remove iter() because the for loop calls iter()... |
|
Gribouillis |
News and Discussions |
5 |
162 |
Aug-09-2022, 09:02 PM |
|
|
Thread: Solving an equation by brute force within a range
Post: RE: Solving an equation by brute force within a ra...
(Aug-09-2022, 09:20 AM)Estherbarnes Wrote: (x**0.5) isn't the same as square root, it gives another result, doesn't it? **huh**When x is a nonnegative float, it should give the same result, but it t... |
|
Gribouillis |
General Coding Help |
5 |
659 |
Aug-09-2022, 09:44 AM |
|
|
Thread: looking fo documentation for module files
Post: RE: looking fo documentation for module files
(Aug-09-2022, 04:07 AM)Skaperen Wrote: the fact that my symlinks go to ../../../{bin,lib} instead of ../../../usr/{bin,lib} may be the problem.I'm glad you are so close to solve the issue. You could... |
|
Gribouillis |
News and Discussions |
39 |
1,118 |
Aug-09-2022, 07:37 AM |
|
|
Thread: faster code for my code
Post: RE: faster code for my code
(Aug-07-2022, 07:51 AM)ndc85430 Wrote: Is there a reason you're writing this yourself and not using existing tools like, say, grep?There is a working solution in 8 lines of Python code, why look for... |
|
Gribouillis |
General Coding Help |
19 |
472 |
Aug-08-2022, 04:07 PM |
|
|
Thread: looking fo documentation for module files
Post: RE: looking fo documentation for module files
(Aug-07-2022, 09:44 PM)Skaperen Wrote: Output:
lt1a/forums/3 /home/forums 7> python3.8 -S -c "import sys; print(sys.prefix, sys.exec_prefix, sys.base_exec_prefix)"
/usr /usr /usr
lt1a/forums/3 /h... |
|
Gribouillis |
News and Discussions |
39 |
1,118 |
Aug-08-2022, 08:30 AM |
|
|
Thread: What did I do wrongly?
Post: RE: What did I do wrongly?
(Aug-07-2022, 07:25 AM)Tomi Wrote: The icon.ico is in the same folder as the script im trying to run.Python will use the path relative to the current working directory, not the directory containing ... |
|
Gribouillis |
General Coding Help |
1 |
156 |
Aug-07-2022, 08:05 AM |
|
|
Thread: faster code for my code
Post: RE: faster code for my code
The slow part is the accumulative string concatenation at line 8 (the + operator). Try this code
def good_lines(file):
for line in file:
line = line.strip()
if line[:1] == '[' and ... |
|
Gribouillis |
General Coding Help |
19 |
472 |
Aug-07-2022, 07:27 AM |
|
|
Thread: looking fo documentation for module files
Post: RE: looking fo documentation for module files
You can use the -S option to disable the import of the site module. Does the following command give the same prefixes?
Output:$ python3.8 -S -c "import sys; print(sys.prefix, sys.exec_prefix, sys.base... |
|
Gribouillis |
News and Discussions |
39 |
1,118 |
Aug-07-2022, 07:15 AM |
|
|
Thread: looking fo documentation for module files
Post: RE: looking fo documentation for module files
Clearly these prefixes are wrong but is is becoming more and more difficult to find where it may come from. What do you have in sitecustomize.py and usercustomize.py ? Do you by any chance redefine si... |
|
Gribouillis |
News and Discussions |
39 |
1,118 |
Aug-06-2022, 08:50 PM |
|
|
Thread: looking fo documentation for module files
Post: RE: looking fo documentation for module files
Do you by any chance have a PYTHONHOME environment variable defined ?
Python documentation Wrote:PYTHONHOME
Change the location of the standard Python libraries. By default, the libraries are searche... |
|
Gribouillis |
News and Discussions |
39 |
1,118 |
Aug-06-2022, 07:12 AM |
|
|
Thread: looking fo documentation for module files
Post: RE: looking fo documentation for module files
(Aug-05-2022, 05:41 PM)Skaperen Wrote: where does python look for modules before it has site loaded so it can find site.py?I think it is in <base_exec_prefix>/lib/pythonX.Y where the prefix is... |
|
Gribouillis |
News and Discussions |
39 |
1,118 |
Aug-05-2022, 06:03 PM |