Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Using subprocess to execute complex command with many arguments
Post: RE: Using subprocess to execute complex command wi...

Worked, thank you all!
medatib531 General Coding Help 5 1,883 Apr-27-2023, 02:23 PM
    Thread: Using subprocess to execute complex command with many arguments
Post: RE: Using subprocess to execute complex command wi...

But what is the correct way to escape the quotes that are originally in the shell command? E.g. for "Load" should it be something like: subprocess.run([ "rrdtool", "graph", "load1h.png", "-Y", "-u",...
medatib531 General Coding Help 5 1,883 Apr-26-2023, 02:27 PM
    Thread: Using subprocess to execute complex command with many arguments
Post: Using subprocess to execute complex command with m...

I have a shell script that is as follows: LOAD_RRD=sysmon.rrd DISK_RRD=disk.rrd DISKTEMP_RRD=disktemp.rrd rrdtool graph load1h.png \ -Y -u 1.1 -l 0 -L 5 -v "Load" -w 700 -h 200 -t "Load stats - `/...
medatib531 General Coding Help 5 1,883 Apr-26-2023, 01:47 PM
    Thread: Initializing, reading and updating a large JSON file
Post: Initializing, reading and updating a large JSON fi...

Hello, I want to work with a large JSON file in the following form: {"1": {"data": "abc"},"2": {"data": "xyz"},...}I want be continually fetching data from my source and adding the data in the above ...
medatib531 General Coding Help 0 1,789 Mar-10-2022, 07:58 PM
    Thread: Can't install project from pypi
Post: RE: Can't install project from pypi

(Nov-10-2021, 03:56 AM)medatib531 Wrote: I want to install this project: https://pypi.org/project/pynubls/ however when I do $ pip install pynubls Collecting pynubls Could not find a version th...
medatib531 General Coding Help 2 1,583 Nov-10-2021, 03:35 PM
    Thread: Can't install project from pypi
Post: Can't install project from pypi

I want to install this project: https://pypi.org/project/pynubls/ however when I do $ pip install pynubls Collecting pynubls Could not find a version that satisfies the requirement pynubls (from ...
medatib531 General Coding Help 2 1,583 Nov-10-2021, 03:56 AM
    Thread: List of lists - merge sublists with common elements
Post: List of lists - merge sublists with common element...

Assume I have list1 as follows: list1 = [['a','b'],['c','d'],['b','e'],['f','g'],['a','h'],['i','c']]I want to merge the sublists that have common elements, so based on the above example the resultin...
medatib531 General Coding Help 1 3,412 May-09-2021, 02:29 AM
    Thread: Convert file of hex strings to binary file
Post: Convert file of hex strings to binary file

Hello, I have a file that has several hex string values, separated by the newline character. E.g. the file looks like: dd5bda81 ae0ac495 b97a7664 ...I can easily parse this file and find e.g. the 10t...
medatib531 General Coding Help 4 13,753 Oct-09-2020, 12:43 AM
    Thread: Matplotlib 2 lines with different markers
Post: Matplotlib 2 lines with different markers

Hello, I want to create a matplotlib plot for 2 different lines, however I need the lines to have different markers. i.e. use 'x' as marker for line 1 and '^' as marker for line 2. I tried to use iter...
medatib531 Data Science 0 1,709 Sep-15-2020, 09:47 PM
    Thread: Iterate 2 large text files across lines and replace lines in second file
Post: RE: Iterate 2 large text files across lines and re...

Worked, needed a minor tweak to make it work for the very last line as well with open("file1", 'r') as fileA, open("file2", 'r+') as fileB: line_start = fileB.tell() line1 = fileA.readline() ...
medatib531 General Coding Help 13 5,852 Aug-10-2020, 11:01 PM
    Thread: Iterate 2 large text files across lines and replace lines in second file
Post: RE: Iterate 2 large text files across lines and re...

Ok so this is the code I have with open("file1", 'r') as fileA, open("file2", 'r+') as fileB: line1 = fileA.readline() line2 = fileB.readline() line_start = fileB.tell() while all(li...
medatib531 General Coding Help 13 5,852 Aug-10-2020, 07:53 PM
    Thread: Iterate 2 large text files across lines and replace lines in second file
Post: RE: Iterate 2 large text files across lines and re...

Hmm so I'm confused. How would I do it?
medatib531 General Coding Help 13 5,852 Aug-10-2020, 06:34 PM
    Thread: Iterate 2 large text files across lines and replace lines in second file
Post: RE: Iterate 2 large text files across lines and re...

(Aug-10-2020, 05:22 PM)bowlofred Wrote: Yes, just taking a while. The simple way is to do a text read, but this is actually quite fragile because the length of a character is not fixed. Any non-as...
medatib531 General Coding Help 13 5,852 Aug-10-2020, 05:48 PM
    Thread: Iterate 2 large text files across lines and replace lines in second file
Post: RE: Iterate 2 large text files across lines and re...

Yes as I said in my previous post, its ok with me to replace a line with a string of the same name. The files are huge so the additional disk I/O from the third file would slow things a lot. Can you s...
medatib531 General Coding Help 13 5,852 Aug-10-2020, 04:05 PM
    Thread: Iterate 2 large text files across lines and replace lines in second file
Post: RE: Iterate 2 large text files across lines and re...

Writing to a third file would be very costly as the files are huge.. So if I do not change the length of the line, (e.g. replace a line with '00' in this example), how would I do it in place?
medatib531 General Coding Help 13 5,852 Aug-10-2020, 02:37 PM
    Thread: Iterate 2 large text files across lines and replace lines in second file
Post: Iterate 2 large text files across lines and replac...

My problem is as follows: suppose I have 2 huge (like 10GB) text files as follows: file1: ad 1a 2b 3c ...file2: 10 0 2b 45 ...What I need to do is to iterate the 2 files simultaneously line by line (...
medatib531 General Coding Help 13 5,852 Aug-10-2020, 06:45 AM
    Thread: Return boolean from recursive class method
Post: RE: Return boolean from recursive class method

(Jul-13-2020, 04:25 AM)ndc85430 Wrote: It was implied: add return statements to those lines. Got it working, thanks!
medatib531 General Coding Help 6 3,491 Jul-13-2020, 04:27 AM
    Thread: Return boolean from recursive class method
Post: RE: Return boolean from recursive class method

(Jul-13-2020, 04:18 AM)ndc85430 Wrote: Your recursive calls don't have return statements, so those branches end up returning None. Can you help on how to fix this?
medatib531 General Coding Help 6 3,491 Jul-13-2020, 04:22 AM
    Thread: Return boolean from recursive class method
Post: RE: Return boolean from recursive class method

(Jul-13-2020, 04:13 AM)bowlofred Wrote: The else blocks on lines 25 and 31 don't seem to have a return. What would you expect to return if you reach those lines? These are the recursive method calls
medatib531 General Coding Help 6 3,491 Jul-13-2020, 04:15 AM
    Thread: Return boolean from recursive class method
Post: Return boolean from recursive class method

I have the following class which stores bit strings in a tree structure. The exists() method should return if the queried string is matched in the tree or not. However, I can't get my method return a ...
medatib531 General Coding Help 6 3,491 Jul-13-2020, 04:08 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020