errno

python: can't open file in macbook terminal - [Errno 2]!

▼魔方 西西 提交于 2021-02-05 10:50:49
问题 In my macbook air terminal I wrote python eggshell.py but I got this error python: can't open file 'eggshell.py': [Errno 2] No such file or directory s-user:/ user$ After I got that error I tried a number of things, like specifying exactly were eggshell.py is: python Users/myuser/Eggshell/eggshell.py Doing that just gave me a different Errno 2 error: OSError: [Errno 2] No such file or directory: 'modules/commands/macOS' If you have anything that can help me figure this out, I'd be incredibly

python: can't open file in macbook terminal - [Errno 2]!

久未见 提交于 2021-02-05 10:50:28
问题 In my macbook air terminal I wrote python eggshell.py but I got this error python: can't open file 'eggshell.py': [Errno 2] No such file or directory s-user:/ user$ After I got that error I tried a number of things, like specifying exactly were eggshell.py is: python Users/myuser/Eggshell/eggshell.py Doing that just gave me a different Errno 2 error: OSError: [Errno 2] No such file or directory: 'modules/commands/macOS' If you have anything that can help me figure this out, I'd be incredibly

UNIX C send() errno 14

早过忘川 提交于 2020-12-15 06:51:35
问题 I have this code: void caller() { char buffer[20][20]; int sd; ... send(sd, buffer[7], 5, 0); } Now I have this code: void funct(int sd, char **buffer) { send(sd, buffer[7], 5, 0); } void caller() { char buffer[20][20]; int sd; ... funct(sd, buffer); } To simplify suppose that instead of ... I have an initialization of socket UDP and connection with the server to use send instead of sendto. I don't understand why the second code generates on send an error and errno is set with value 14, but

Errno 13 Permission Denied on mac

拥有回忆 提交于 2020-08-25 06:58:16
问题 I am simply testing how to call external .py files from one .py file. I have 2 .py files, both in the same directory. Here is the code for the main one (runext.py suppose to call ext.py): import subprocess subprocess.call("/Users/training/PycharmProjects/MarcouFirstProject/ext.py") ext.py is just print("hey this actually worked") However, every time I run runext.py, I get this error message: Traceback (most recent call last): File "/Users/training/PycharmProjects/MarcouFirstProject/runext.py"

Python ConnectionRefusedError: [Errno 61] Connection refused

耗尽温柔 提交于 2020-06-15 12:12:26
问题 Ive seen similar questions but they I couldn't fix this error. Me and my friend are making a chat program but we keep getting the error ConnectionRefusedError: [Errno 61] Connection refused We are on different networks by the way. Here is my code for the server import socket def socket_create(): try: global host global port global s host = '' port = 9999 s = socket.socket() except socket.error as msg: print("Socket creation error" + str(msg)) #Wait for client, Connect socket and port def

为什么要同步

我只是一个虾纸丫 提交于 2020-03-31 08:22:11
8.1、为什么要同步 线程之间是合作关系。既然是合作,那就要由某种约定的规则,否则合作就会出现问题。 例子1 : 有两个线程同时运行,第一个线程在执行了一些操作后想检查当前的错误状态errno,但在其做检查之前,线程2却修改了errno。这样,当第一个线程再次获得控制权后,检查结果将是线程2改写过的errno,而这是不正确的。 线程1 线程2 。。。。。 。。。。 读errno变量 。。。。 。。。。 写errno变量 从读操作返回 。。。。 检查errno值 。。。。 一个进程的两个线程因为操作不同步而造成线程1运行错误。 之所以出现上述问题,是基于两个原因: l errno是线程之间共享的全局变量 l 线程之间的相对执行顺序是不确定的 因此,要解决上述问题有两个办法,即分别消除上述两个原因。消除第1个原因的办法就是限制全局变量,给每个线程一个私有的errno变量。事实上,如果可以将所有的资源都私有化,让线程之间不共享,那么这种问题就不复存在。 但问题是,如果所有资源都不共享,那么还有必要发明线程吗?甚至也没有必要发明进程了。因为这样就违背了进程和线程设计的初衷:共享资源、提高资源利用率。因此,这种解决办法是不切实际的。 那剩下的办法就是消除第2个原因,即让线程之间的相对执行顺序在需要的时候可以确定。 例子2 : 有两个线程A和B,分别执行指令x=1和x=2,即 线程A:x=1;

linux网络编程常见socket错误分析

爱⌒轻易说出口 提交于 2020-03-25 12:46:23
3 月,跳不动了?>>> 常见socket错误码 EINTR: 阻塞的操作被取消阻塞的调用打断。如设置了发送接收超时,就会遇到这种错误。 只能针对阻塞模式的socket。读,写阻塞的socket时,-1返回,错误号为INTR。另外,如果出现EINTR即errno为4,错误描述Interrupted system call,操作也应该继续。如果recv的返回值为0,那表明连接已经断开,接收操作也应该结束。 ETIMEOUT: 1、操作超时。一般设置了发送接收超时,遇到网络繁忙的情况,就会遇到这种错误。 2、服务器做了读数据做了超时限制,读时发生了超时。 3、错误被描述为“connect time out”,即“连接超时”,这种情况一般发生在服务器主机崩溃。此时客户 TCP 将在一定时间内(依具体实现)持续重发数据分节,试图从服务 TCP 获得一个 ACK 分节。当最终放弃尝试后(此时服务器未重新启动),内核将会向客户进程返回 ETIMEDOUT 错误。如果某个中间路由器判定该服务器主机已经不可达,则一般会响应“destination unreachable”-“目的地不可达”的ICMP消息,相应的客户进程返回的错误是 EHOSTUNREACH 或ENETUNREACH。当服务器重新启动后,由于 TCP 状态丢失,之前所有的连接信息也不存在了,此时对于客户端发来请求将回应 RST

socket example

自闭症网瘾萝莉.ら 提交于 2020-03-25 03:16:27
for code copy in the future simple server and client may be useful for copy in the future server: [cpp] view plain copy #include <errno.h> #include "sys/types.h" #include "sys/socket.h" #include "sys/stat.h" #include "unistd.h" #include <netinet/in.h> //#include <arpa/inet.h> #include <fcntl.h> #define SERVER_PORT (56738) #define SERVER_IP "127.0.0.1" #define LOG printf static void handle_crashing_process_new( int fd) { int n; unsigned int tid; int length = getpid(); int retry = 30; printf( "handle_crashing_process_new in\n" ); while ((n = read(fd, &tid, sizeof (unsigned))) != sizeof (unsigned