Go to advanced search

by Zilla707
Fri Jan 10, 2020 11:10 pm
Forum: Python
Topic: Code for displaying an image (raspberry pi 3 & Python)
Replies: 13
Views: 14998

Re: Code for displaying an image (raspberry pi 3 & Python)

Real quick, I have found that when I need to run a command with "subprocess.call" or "subprocess.Popen" instead of typing out a list, just use .split() For example: import subprocess subprocess.call('sudo apt-get update'.split()) Instead of import subprocess subprocess.call(['sudo', 'apt-get', 'upda...
by Zilla707
Fri Jan 10, 2020 8:42 pm
Forum: Python
Topic: Classes and For Loops
Replies: 9
Views: 604

Re: Classes and For Loops

Glad you got it working @KetZoom!
by Zilla707
Thu Jan 09, 2020 10:32 pm
Forum: Python
Topic: Classes and For Loops
Replies: 9
Views: 604

Re: Classes and For Loops

Ok, so perhaps only if you had to remove one invader. Or maybe make you if statement more specific. But I agree that, while I have never had any serious errors or bugs when doing stuff like this, it is probably best to make a copy of the list or something like that.
by Zilla707
Thu Jan 09, 2020 3:09 am
Forum: Python
Topic: Classes and For Loops
Replies: 9
Views: 604

Re: Classes and For Loops

I think you can remove an item in a list while looping through it.

Code: Select all

numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
for number in numbers:
	if number == 5:
		numbers.remove(number)
		
print(numbers)
> [0, 1, 2, 3, 4, 6, 7, 8, 9]
So you should be able to remove the invader inside the for loop.
by Zilla707
Thu Jan 09, 2020 2:59 am
Forum: Java
Topic: How to decrypt a .class file
Replies: 7
Views: 1153

Re: How to decrypt a .class file

Ok, I guess I was using the wrong term, and thanks!
by Zilla707
Fri Dec 20, 2019 1:05 am
Forum: Python
Topic: Unable to install pip
Replies: 7
Views: 808

Re: Unable to install pip

I don't know how to fix that, but you can get the pip installer as a python (.py) file and run it to install pip. Here's the link: https://bootstrap.pypa.io/get-pip.py Then just copy and paste into an empty .py file, and run it from the terminal, and use "sudo". I named mine "get_pip.py" and then ru...
by Zilla707
Fri Dec 20, 2019 12:20 am
Forum: Java
Topic: How to decrypt a .class file
Replies: 7
Views: 1153

Re: How to decrypt a .class file

Ok, that one worked, but I can't edit it when i'm viewing it, because its still compiled. So now what I want to know is: is there a way to import a .jar file and decompile all of the .class files at the same time, so it can be edited and re-exported?
by Zilla707
Fri Dec 20, 2019 12:03 am
Forum: AIY Projects
Topic: SEPIA open source voice-assistant
Replies: 15
Views: 9318

Re: SEPIA open source voice-assistant

Its fine. And thanks!
by Zilla707
Thu Dec 19, 2019 5:30 pm
Forum: Java
Topic: How to decrypt a .class file
Replies: 7
Views: 1153

Re: How to decrypt a .class file

The website's link didn't seem to work, so I searched the eclipse marketplace for "JD eclipse" and found one that worked great. Thanks so much!
by Zilla707
Wed Dec 18, 2019 10:38 pm
Forum: Java
Topic: How to decrypt a .class file
Replies: 7
Views: 1153

How to decrypt a .class file

Hello, I know a bit about java, and have come across a .class file that I want to be able to edit. If I am correct, the .class files are just compiled .java files, so what I want to know is how, if possible, do I decompile a .class file to get it's source code in the form of a .java file?
by Zilla707
Sat Dec 14, 2019 12:08 am
Forum: AIY Projects
Topic: SEPIA open source voice-assistant
Replies: 15
Views: 9318

Re: SEPIA open source voice-assistant

Can it run offline?
by Zilla707
Fri Dec 13, 2019 11:57 pm
Forum: General discussion
Topic: recovery from power failure
Replies: 9
Views: 606

Re: recovery from power failure

You could try powering the pi off a USB battery bank, that way if the power fails, the battery is still going. Then, just charge the battery when you're not using the pi. Here's a decent bank that I use for the 7" touchscreen display and a pi 3 B+, https://smile.amazon.com/Anker-PowerCore-13000-Port...
by Zilla707
Fri Dec 13, 2019 9:34 pm
Forum: Python
Topic: ALSA errors with PyAudio and SpeechRecognization
Replies: 3
Views: 744

Re: ALSA errors with PyAudio and SpeechRecognization

Are you on the wifi? Google's sr won't work without wifi.
by Zilla707
Sun Dec 08, 2019 6:36 pm
Forum: Python
Topic: Parent script termination
Replies: 17
Views: 1037

Re: Parent script termination

This could be simpler. I didn't think about this, but it might make more sense than using threading and subprocess. Here's an example of a loop that can be stopped. #!/usr/bin/env python3 import time, pygame from pygame.locals import * pygame.init() running = True WIDTH = 400 HEIGHT = 400 screen = p...
by Zilla707
Sun Dec 08, 2019 1:40 am
Forum: Python
Topic: Parent script termination
Replies: 17
Views: 1037

Re: Parent script termination

Well, if the change in the subprocess.call/run didn't work, I am assuming that the child script had a shebang "#!/usr/bin/env pyhon3" or "#!/usr/bin/env python". If the script doesn't have the shebang telling it how to run, that might be the problem. If it's trying to run the script in py2 then chan...
by Zilla707
Fri Dec 06, 2019 9:23 pm
Forum: Python
Topic: Picamera offline installation
Replies: 2
Views: 289

Re: Picamera offline installation

I am assuming that you have some computer on the internet since you can access the forums. If so, you can try this: go to these links ( https://pypi.org/project/numpy/#files and https://pypi.org/project/picamera/#files ) and download the source release, [for numpy the .zip file and for picamera the ...
by Zilla707
Wed Dec 04, 2019 12:05 am
Forum: Python
Topic: Parent script termination
Replies: 17
Views: 1037

Re: Parent script termination

Does this work? I changed a few things. lines = ["A","B","C","D","E","F"] import pygame pygame.quit() pygame.init() screen = pygame.display.set_mode((400,400)) a = 0 # Starts the new program. def start(): subprocess.run('child_script.py', shell=True) done = False while not done: for event in pygame....
by Zilla707
Mon Dec 02, 2019 9:42 pm
Forum: Python
Topic: i want to Interrupt a loop?
Replies: 4
Views: 324

Re: i want to Interrupt a loop?

If all that you want to do is interrupt a loop try the "break" statement. while True: # infinite loop text = raw_input() # get user's input if text == 'quit': # If the user entered "quit" then break the loop break # Breaks the loop, and jumps the program to "print 'goodbye!'" print 'goodbye!' hope t...
by Zilla707
Mon Dec 02, 2019 8:55 pm
Forum: Python
Topic: Help with 3D graphics programming
Replies: 3
Views: 340

Re: Help with 3D graphics programming

I installed and tried the last one, and ran a few of the examples. It looks decent from what I have seen so far. Thanks for the ideas!
by Zilla707
Mon Dec 02, 2019 8:54 pm
Forum: Python
Topic: Parent script termination
Replies: 17
Views: 1037

Re: Parent script termination

Ok, that makes sense, I was wondering if "subprocess" could be used instead. thx.
by Zilla707
Mon Dec 02, 2019 2:59 am
Forum: Python
Topic: Parent script termination
Replies: 17
Views: 1037

Re: Parent script termination

You could use threading to import/start the new script, and then "exit()" to quit the original program. import threading def startScript(): # The code for the thread is best in a function or class. import child_script newThread = threading.Thread(target=startScript) newThread.start() This imports th...
by Zilla707
Mon Dec 02, 2019 1:47 am
Forum: Python
Topic: Help with 3D graphics programming
Replies: 3
Views: 340

Help with 3D graphics programming

Hello, I have been doing python3 for some time now and have a decent grasp of how to use pygame's [ https://pypi.org/project/pygame/ ] graphics and other functions. But I would like to learn some 3D graphics programming that I can use inside of python3. I have heard/read about OpenGL and how it can ...
by Zilla707
Tue Nov 26, 2019 10:35 pm
Forum: Python
Topic: Help installing snowboy
Replies: 5
Views: 660

Re: Help installing snowboy

K, thx.
by Zilla707
Tue Nov 26, 2019 7:39 pm
Forum: Python
Topic: Help installing snowboy
Replies: 5
Views: 660

Re: Help installing snowboy

Ok, so there's no way to get it to work, practically, on a pi? At least not the new ones?
by Zilla707
Mon Nov 25, 2019 8:23 pm
Forum: Python
Topic: Help installing snowboy
Replies: 5
Views: 660

Help installing snowboy

Hello, I am trying to install snowboy for my AI program, but it gives me errors. I tried using "pip3 install snowboy" but it gave me errors. So then I tried downloading the file from https://pypi.org/project/snowboy/#files Then I unzipped it with the GUI and opened a terminal. I ran "cd Downloads/sn...

Go to advanced search