I'm trying to play midi sounds from my python program on a RaspberryPi, however when trying to initialise fluidsynth, it errrors:
>>> import fluidsynth
>>> import time
>>> fs = fluidsynth.Synth()
>>> fs.start()
Causes the following errors:
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jackdmp 1.9.9
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2012 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 10
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot lock down 82278944 byte memory area (Cannot allocate memory)
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
fluidsynth: error: Failed to connect to Jack server.
I think the final message can be fixed by starting the Jack server, however I can't fix the
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
errors
Anyone know how?
The default fluidsynth settings apparently are not appropriate for the Raspberry Pi.
Change the audio driver settings so that uses alsa instead of jack.
If you don't know how to do this in Python, start fluidsynth manually from the command line, and tell your Python program to output to fluidsynth's port.
Related
I am making a cli-chat system with python, sockets.
When the server and client are in the same machine, the code works fine.
But now I am trying to port forward my local server with ngrok, to chat with remote clients.
When the client wants to connect he would have to give the server url. If I am giving my localhost url, client connects to the socket server and everything works fine.
But whenever I am giving the ngrok's tcp tunnel url, it doesn't works and throws the error below
Traceback (most recent call last):
File "/storage/emulated/0/Sun/Python/cmd-chat/user.py", line 5, in <module>
client.connect((serverUrl, 5000)) #connecting client to server
socket.gaierror: [Errno 7] No address associated with hostname
The url I am giving as input is,
tcp://x.tcp.ngrok.io:17xxx
Hey I think I got where you are going wrong
# Your Server Url should be
serverUrl = hostAddress = "x.tcp.ngrok.io"
# The Port in which we want to connect to the server Should be
port = 17234 # The number given in the end of URL link
I use mcpi: https://github.com/AdventuresInMinecraft/AdventuresInMinecraft-Linux
Starting the local server.
After, run program:
import mcpi.minecraft as minecraft
mc = minecraft.Minecraft.create()
mc.postToChat("Hello Minecraft World")
I am facing the below error:
Traceback (most recent call last):
File "/home/home/AdventuresInMinecraft/MyAdventures/HelloMinecraftWorld.py", line 2, in mc = minecraft.Minecraft.create()
File "/home/home/.local/lib/python3.6/site-packages/mcpi/minecraft.py", line 376, in create return Minecraft(Connection(address, port))
File "/home/home/.local/lib/python3.6/site-packages/mcpi/connection.py", line 17, in init self.socket.connect((address, port))
ConnectionRefusedError: [Errno 111] Connection refused
A ConnectionRefusedError means that the address + port combination was unable to be secured for this particular Minecraft server and thus raised an exception. This could be because some other application is already using the port of interest, the port is unavailable because of the OS, or a handful of other networking configuration mishaps.
But perhaps a better series of questions to ask yourself is:
What is the default address and port that minecraft.Minecraft.create() will attempt to launch / listen at?
Do I have access to that server (address + port)?
If I do have access, are there any security issues (AKA Firewall)?
This post has already addressed the root issue of your question, and I hope it gives you a good start at understanding the foundation of your problem.
Notice how their question mentions s.connect((host,port)) and your stack trace has self.socket.connect((address, port)) Looks like the same thing to me!
Some more reading:
- localhost
- check if port is in use
I encountered the same issue. I looked into the code of mcpi and found that the default port is 4711. However, a Minecraft Server's default port is 25565. All you need to do is add 2 parameters on the create() function. Code(Python):
mc = minecraft.Minecraft.create(address="127.0.0.1", port=25565)
btw change "address" in the code to the host of the server (only if you modified the "server.properties" file).
Also, ConnectionRefusedError doesn't mean that it's not secured, I believe it means that either the server is not online, it doesn't exist, or the server refused it for some reason.
EDIT:
Oops sorry I just found out that mcpi actually connects to the RaspberryJam plugin which is hosted on another IP and port. The plugin runs on port 4711. So mcpi has the right port.
So check if you have the RaspberryJam plugin installed. If not, download it from
https://www.spigotmc.org/resources/raspberryjuice.22724/
And put the .jar file inside the plugins folder in your server directory.
I am using smtplib to send emails with my SMTP server as localhost and port number 25 in a ubuntu machine. It was working fine until I got connection limit exceeded error. The stack trace is as follows:
File "/src/tasks/driver/sendEmail.py", line 57, in run
s = smtplib.SMTP(smtp)
File "/root/anaconda/lib/python2.7/smtplib.py", line 258, in __init__
raise SMTPConnectError(code, msg)
SMTPConnectError: (421, '4.3.2 Connection rate limit exceeded.')
People suggested to edit /etc/mail/sendmail.mc file to change the window size and throttle.
define(confCONNECTION_RATE_THROTTLE',15')dnl
define(confCONNECTION_RATE_WINDOW_SIZE',60s')dnl
The real problem is I don't see any such configuration file. No traces of sendmail installation in the docker image or the host machine. How does smtplib send emails with localhost as the smtp server? How to increase the throttle if I don't have the configuration file in the machines? Is it because my company manages the SMTP server for all the machines in a separate file?
Trying to get the PYO music module to work on my Chromebook (Chroot Dev) (ARM7 processor) (Precise Penguin/ubuntu 12.04)
pyo:
>>>import pyo
pyo version 0.7.7 (uses single precision)
>>>pyo.Server(audio='jack').boot()
Due to the ARM processor and Precise some small modifications to the dependencies were necessary:
1] ARM changes to /proc/cpuinfo in relation to Jackd2, error:
FATAL: cannot locate cpu MHz in /proc/cpuinfo
solution? The error changed after, but not knowledgeable enough to know if for the better.
2] xwPython3.0 not available for Precise:
solution, shouldn't be a problem as this is UI dependency correct?
And to this is where the error is now:
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jackdmp 1.9.11
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2015 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
/usr/local/bin/jackd: symbol lookup error: /usr/local/bin/jackd: undefined symbol: jackctl_driver_params_parse
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Jack error: Unable to create JACK client
jack_client_close called with a NULL client
Server not booted.
<pyolib.server.Server object at 0x1671150>
None of the solutions to any of the error messages i managed to find on google changed this error message. (google googled other, but you don't care about my messy internet history)
pulseaudio:
>pulseaudio --start
E: [pulseaudio] main.c: Daemon startup failed.
Could this be the main problem as Precise and the ChromeOS are running sidebyside and this causes a lock on the Deamon?
>pulseaudio --kill
E: [pulseaudio] main.c: Failed to kill daemon: No such process
>sudo pulseaudio --kill
E: [pulseaudio] core-util.c: Home directory /home/USERNAME not ours.
E: [pulseaudio] main.c: Failed to kill daemon: Permission denied
sudo permission denied??? PulseAudio running in ChromeOS???
jackd:
>jack_control start
Traceback (most recent call last):
File "/usr/local/bin/jack_control", line 399, in <module>
main()
File "/usr/local/bin/jack_control", line 158, in main
bus = dbus.SessionBus()
File "/usr/lib/python2.7/dist-packages/dbus/_dbus.py", line 211, in __new__
mainloop=mainloop)
File "/usr/lib/python2.7/dist-packages/dbus/_dbus.py", line 100, in __new__
bus = BusConnection.__new__(subclass, bus_type, mainloop=mainloop)
File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 122, in __new__
bus = cls._new_for_bus(address_or_type, mainloop=mainloop)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
This just doesn't work cause i "don't have a display" for Jackd to open up in right?
Solution 1: Connecting JACK to CRAS instead of ALSA, probably what you want unless you want to disconnect ChromeOS from audio (open link from solution 2 for more information)
Solution 2: Connecting ALSA and JACK directly to hardware by turning off CRAS
I am writing a python script to copy python(say ABC.py) files from one directory to another
directory with the same folder name(say ABC) as script name excluding .py.
In the local system it works fine and copying the files from one directory to others by
creating the same name folder.
But actually I want copy these files from my local system (windows XP) to the remote
system(Linux) located in other country on which I execute my script. But I am getting
the error as "Destination Path not found" means I am not able to connect to remote
that's why.
I use SSH Secure client.
I use an IP Address and Port number to connect to the remote server.
Then it asks for user id and password.
But I am not able to connect to the remote server by my python script.
Can Any one help me out how can I do this??
paramiko provides a SFTPClient that can be used to do this.
import paramiko
source = r'C:\Somedir\somefile.txt'
dest = r'/home/user/file.txt'
hostname = 'linux.server.com'
port = 22 # default port for SSH
username = 'user'
password = 'secret'
try:
t = paramiko.Transport((hostname, port))
t.connect(username=username, password=password)
sftp = paramiko.SFTPClient.from_transport(t)
sftp.put(source, dest)
finally:
t.close()
I used the same script, but my host failed to respond. My host is in different network.
WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond