I am trying to access XNAT server via PyXNAT. While doing so i get the following error which i think is an SSL error..
Central=Interface(server='http://hd-hni-xnat.cac.cornell.edu:8443/xnat')
User: sdb99
Password:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/pyxnat/core/interfaces.py", line 228, in __init__
self._get_entry_point()
File "/Library/Python/2.7/site-packages/pyxnat/core/interfaces.py", line 268, in _get_entry_point
raise e
socket.error: [Errno 54] Connection reset by peer
Is there any work around to solve this problem ..?
Many Thanks in advance!!
Suyash
Can you try accessing the URL from the server where you're running XNAT using curl? Something simple like:
curl -u sdb99:passwd -sL -w "%{http_code}\\n" "http://hd-hni-xnat.cac.cornell.edu:8443/xnat/data/projects" -o /dev/null
This should tell you the exact error code or condition and make it easier to figure out what's going wrong where.
Related
This question already has an answer here:
ICMP pinger application in Python - error: operation not permitted?
(1 answer)
Closed 2 months ago.
By running this simple code in Python
>>> from pythonping import ping
>>> ping('127.0.0.1', verbose=True)
I get this error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/j0tz/.local/lib/python3.10/site-packages/pythonping/__init__.py", line 81, in ping
comm = executor.Communicator(target, provider, timeout, interval, socket_options=options, verbose=verbose, output=out,
File "/home/j0tz/.local/lib/python3.10/site-packages/pythonping/executor.py", line 293, in __init__
self.socket = network.Socket(target, 'icmp', options=socket_options, source=source)
File "/home/j0tz/.local/lib/python3.10/site-packages/pythonping/network.py", line 31, in __init__
self.socket = socket.socket(socket.AF_INET, socket.SOCK_RAW, self.protocol)
File "/usr/lib/python3.10/socket.py", line 232, in __init__
_socket.socket.__init__(self, family, type, proto, fileno)
PermissionError: [Errno 1] Operation not permitted
I tried running it as sudo but to no avail.
I don't know what the cause of the error is, so I'm hoping for intelligent answers from knowledgeable people.
Pythonping is a public repository I found on PyPI.
In the code I try to simply ping Localhost, returning the results on the screen when I set the "verbose" parameter to True.
you need root user permission to use it
run python3 such as root user then everything will be OK. and if you use it on a file run it with the root user.
I'm trying to connect a Tektronix TDS 1012B oscilloscope to my PC using Pyvisa.
I'm using Kubuntu 20.04, Python version 3.9.7 and Pyvisa version 1.11.3.
I do the following :
>>> import pyvisa
>>> rm = pyvisa.ResourceManager()
>>> rm.list_resources()
('USB0::1689::870::C021027::0::INSTR')
>>> scope = rm.open_resource('USB0::1689::870::C021027::0::INSTR')
>>> scope.query("*IDN?")
But I get this error message:
Traceback (most recent call last):
File "/home/pierre/anaconda3/lib/python3.9/site-packages/pyvisa_py/protocols/usbtmc.py", line 256, in write
return self.usb_send_ep.write(data)
File "/home/pierre/anaconda3/lib/python3.9/site-packages/usb/core.py", line 408, in write
return self.device.write(self, data, timeout)
File "/home/pierre/anaconda3/lib/python3.9/site-packages/usb/core.py", line 989, in write
return fn(
File "/home/pierre/anaconda3/lib/python3.9/site-packages/usb/backend/libusb1.py", line 837, in bulk_write
return self.__write(self.lib.libusb_bulk_transfer,
File "/home/pierre/anaconda3/lib/python3.9/site-packages/usb/backend/libusb1.py", line 938, in __write
_check(retval)
File "/home/pierre/anaconda3/lib/python3.9/site-packages/usb/backend/libusb1.py", line 602, in _check
raise USBTimeoutError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBTimeoutError: [Errno 110] Operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pierre/anaconda3/lib/python3.9/site-packages/pyvisa/resources/messagebased.py", line 638, in query
self.write(message)
File "/home/pierre/anaconda3/lib/python3.9/site-packages/pyvisa/resources/messagebased.py", line 197, in write
count = self.write_raw(message.encode(enco))
File "/home/pierre/anaconda3/lib/python3.9/site-packages/pyvisa/resources/messagebased.py", line 157, in write_raw
return self.visalib.write(self.session, message)[0]
File "/home/pierre/anaconda3/lib/python3.9/site-packages/pyvisa_py/highlevel.py", line 543, in write
written, status_code = self.sessions[session].write(data)
File "/home/pierre/anaconda3/lib/python3.9/site-packages/pyvisa_py/usb.py", line 179, in write
count = self.interface.write(data)
File "/home/pierre/anaconda3/lib/python3.9/site-packages/pyvisa_py/protocols/usbtmc.py", line 436, in write
bytes_sent += raw_write(data)
File "/home/pierre/anaconda3/lib/python3.9/site-packages/pyvisa_py/protocols/usbtmc.py", line 258, in write
raise ValueError(str(e))
ValueError: [Errno 110] Operation timed out
When I use another type of oscilloscope this very simple code works fine. And when I use Pyvisa under Windows instead of Kubuntu, it also works.
Can someone help me fix this annoying issue?
Check out this link to a post from Tek in Tek's forums. They suggest using the pyvisa-py native Python VISA backend. This command instructs to use the pyvisa-py backend
rm = visa.ResourceManager('#py')
and you install by
pip install pyvisa-py
I don't have an Ubuntu machine at my fingertips so I don't know if there are packages available for installing from apt.
Connecting my TBS 1064 in SUSE has problems due to write permissions. This results in an time-out on requests like ask(). It is likely due to udev/rules, although I did not figure out what to put exactly to make it always work. For now one has to put the write permission (admin) for every USB reconnect, but then it is working.
Other devices do not have this problem and it is only a linux issue.
I'm working on a simple script to send data to an elasticsearch node, but after changing my python version the script no longer runs. It says the error is on line 6, but I have no idea why. I've tried adding a comma after the 'yes', but it had no effect. I've tried moving my braces and parenthesis down and it had to effect. (I'm leaving out the import and other defined variables for brevity)
if "Temporary failure in name resolution" or "Timeout" in output:
es.index(index='data', doc_type='data', body={
'macs' : '',
'data' : line,
'date' : datetime.now(),
'down' : 'yes' })
Here are the errors:
snmpwalk: Timeout
Traceback (most recent call last):
File "script.py", line 6, in <module>
'down' : 'yes' })
File "build/bdist.linux-x86_64/egg/elasticsearch/client/utils.py", line 69, in _wrapped
File "build/bdist.linux-x86_64/egg/elasticsearch/client/__init__.py", line 279, in index
File "build/bdist.linux-x86_64/egg/elasticsearch/transport.py", line 327, in perform_request
File "build/bdist.linux-x86_64/egg/elasticsearch/connection/http_urllib3.py", line 105, in perform_request
elasticsearch.exceptions.ConnectionError: ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f2507668090>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f2507668090>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution)
Thanks
This could either be a network issue or mmapfs directory for elastic search has maxed out.
Try running the following to restart your network server
sudo service network-manager restart
If it does not work, then change your mmap count by running this command
sudo sysctl -w vm.max_map_count=262144
Reference
https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html
I am having problems decoding this error message for the python on my Raspberry Pi. Please don't tell me to head to that SE, they sent me here as no one really knew what it means. It is from [GitHub][1]
Here is the error output:
Traceback (most recent call last):
File "/home/pi/piarduino/MissionControl-master/mcDesk.py", line 8, in <module> serialFromArduino = serial.Serial("/dev/serial/by-id/usb-FTDI_FTDI_FT232R_USB_UART_A900aepy-if800-port0", 115200)
File "/usr/lib/python2.7/dist-packages/serial/serialutil.py", line 260, in __init__
self.open()
File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 276, in open
raise SerialException("could not open por %s: %s" % (self._port, msg))
SerialException: could not open port /dev/serial/by-id/usb-FTDI_FTDI_FT232R_USB_UART_A900aepy-if800-port0: [Errno 2] No such file or directory: '/dev/serial/by-id/usb-FTDI_FTDI_FT232R_USB_UART_A900aepy-if800-port0'
Basic troubleshooting:
Try running your script as root using sudo. It's possible you're being denied access to the serial port.
Run ls /dev/serial/by-id in a shell. Make sure the serial port you are trying to open exists and matches exactly with the port you're trying to open in your program.
If neither of those options work, try these steps.
If you care to update your question with more details, we may be able to help you further.
While accessing the remote server through FTP I am getting following error. Not sure whats the problem of it so I can solve. Any lead will be helpful.
Code:
import ftplib
from ftplib import FTP
ftp = ftplib.FTP("server_name")
Error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.6/ftplib.py", line 116, in __init__
self.connect(host)
File "/usr/lib64/python2.6/ftplib.py", line 131, in connect
self.sock = socket.create_connection((self.host, self.port), self.timeout)
File "/usr/lib64/python2.6/socket.py", line 553, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno -2] Name or service not known
(I don't have enough reputation to just leave a comment for #LonelySoul, and anyone else.)
You'll encounter the Name or service not known exception if "server_name" includes the protocol. Simply removing ftp:// resolved the issue for me.
The error is telling you that it can't find the host named server_name. So, that's what you need to debug.
If you ping server_name in your terminal/DOS prompt, does it work, or give you an error like cannot resolve server_name? What if you ftp server_name in the terminal?
If everything works in the terminal, and you don't have a silly typo in your code, your next step is to debug why Python is getting it wrong. Write some code that tries to call getaddrinfo explicitly and see what happens. Try socket.connect on a normal IPv4 socket to see if it works. (If so, the problem is probably something to do with IPv6.) And so on.
More likely, it will fail in the terminal as well. In that case, either you've got the wrong name for the server, or you've got something wrong with your network or system setup; either way, it's not a programming problem, and StackOverflow won't be able to help you further.