Lubuntu 14.04上的WebStorm启动错误

时间:2014-09-11 15:23:03

标签: python python-2.7 ubuntu webstorm ubuntu-14.04

我是Linux新手。我正在使用Lubuntu 14.04。 Python版本是2.7.6。

我已在以下位置安装了WebStorm 8:

david@david:/usr/opt/webstorm/bin$

当我在bin文件夹中运行以下命令时:

./webstorm.sh

它给了我以下错误:

    Traceback (most recent call last):
  File "/usr/lib/python2.7/site.py", line 68, in <module>
    import os
  File "/usr/lib/python2.7/os.py", line 398, in <module>
    import UserDict
  File "/usr/lib/python2.7/UserDict.py", line 83, in <module>
    import _abcoll
  File "/usr/lib/python2.7/_abcoll.py", line 11, in <module>
    from abc import ABCMeta, abstractmethod
  File "/usr/lib/python2.7/abc.py", line 8, in <module>
    from _weakrefset import WeakSet
ImportError: No module named _weakrefset

我已安装&#34; weakrefset&#34;通过使用以下命令(它给我成功安装的消息):

sudo pip install weakrefset

但问题仍然存在,Webstorm没有启动。

WebStrom.sh如下:

    #!/usr/bin/python

import socket
import struct
import sys
import os
import time

# see com.intellij.idea.SocketLock for the server side of this interface

RUN_PATH = '/usr/opt/webstorm/bin/webstorm.sh'
CONFIG_PATH = '/home/david/.WebStorm8/config'

args = []
skip_next = False
for i, arg in enumerate(sys.argv[1:]):
    if arg == '-h' or arg == '-?' or arg == '--help':
        print(('Usage:\n' + \
               '  {0} -h |-? | --help\n' + \
               '  {0} [-l|--line line] file[:line]\n' + \
               '  {0} diff file1 file2').format(sys.argv[0]))
        exit(0)
    elif arg == 'diff' and i == 0:
        args.append(arg)
    elif arg == '-l' or arg == '--line':
        args.append(arg)
        skip_next = True
    elif skip_next:
        args.append(arg)
        skip_next = False
    else:
        if ':' in arg:
            file_path, line_number = arg.rsplit(':', 1)
            if line_number.isdigit():
              args.append('-l')
              args.append(line_number)
              args.append(os.path.abspath(file_path))
            else:
              args.append(os.path.abspath(arg))
        else:
            args.append(os.path.abspath(arg))

def launch_with_port(port):
    found = False

    s = socket.socket()
    s.settimeout(0.3)
    try:
        s.connect(('127.0.0.1', port))
    except:
        return False

    while True:
        try:
            path_len = struct.unpack(">h", s.recv(2))[0]
            path = s.recv(path_len)
            path = os.path.abspath(path)
            if os.path.abspath(path) == os.path.abspath(CONFIG_PATH):
                found = True
                break
        except:
            break

    if found:
        if args:
            cmd = "activate " + os.getcwd() + "\0" + "\0".join(args)
            encoded = struct.pack(">h", len(cmd)) + cmd
            s.send(encoded)
            time.sleep(0.5)   # don't close socket immediately
        return True

    return False

port = -1
try:
    f = open(os.path.join(CONFIG_PATH, 'port'))
    port = int(f.read())
except Exception:
    type, value, traceback = sys.exc_info()
    print(value)
    port = -1

if port == -1:
    # SocketLock actually allows up to 50 ports, but the checking takes too long
    for port in range(6942, 6942+10):
        if launch_with_port(port): exit()
else:
    if launch_with_port(port): exit()

if sys.platform == "darwin":
    # Mac OS: RUN_PATH is *.app path
    if len(args):
        args.insert(0, "--args")
    os.execvp("open", ["-a", RUN_PATH] + args)
else:
    # unix common
    bin_dir, bin_file = os.path.split(RUN_PATH)
    os.chdir(bin_dir)
    os.execv(bin_file, [bin_file] + args)

有人可以指导我解决这个问题。

2 个答案:

答案 0 :(得分:0)

可能是在python-virtualenv-1.4.9-3ubuntu1中修复的python-virtualenv的问题。请参阅:https://bugs.launchpad.net/ubuntu/+source/python-virtualenv/+bug/662611

另见http://devnet.jetbrains.com/message/5514381#5514381

答案 1 :(得分:0)

通过运行“创建桌面条目”来调用问题,该文件用python脚本替换shell脚本(并且可能会执行其他操作,因为只替换 webstorm.sh不起作用)。

我通过删除安装目录并再次解压缩下载的文件来修复它。