Welcome, Guest
Python Scripts for ComicRack

TOPIC: Python imports and WEXITSTATUS error

Python imports and WEXITSTATUS error 3 years 2 months ago #40299

  • rockminstrel
  • rockminstrel's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 1
  • Karma: 1
Hallo,

I'm trying to write some basic script that opens a tab in the webbrowser for every marked series (dynamic url).

I tried two different approaches:
#1
import subprocess

subprocess.call([r'C:\Program Files (x86)\Mozilla Firefox\Firefox.exe', '-new-tab', 'www.google.com/'])

#2
import webbrowser

webbrowser.open('www.google.com', new=1, autoraise=True)

Both versions want me to import module after module. After I import one after the other I get:
'module' object has no attribute 'WEXITSTATUS'

I don't know how to get rid of this error. I hope there's someone on the board who can help me.

Thanks in advance
The administrator has disabled public write access.

Python imports and WEXITSTATUS error 3 years 2 months ago #40300

  • cbanack
  • cbanack's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 1327
  • Thank you received: 508
  • Karma: 182
In both of your examples, you are attempting to use python standard modules (subprocess and webbrowser), but none of the standard python modules are available when running a ComicRack script.

ComicRack runs your script using a special variant of python called IronPython. IronPython lets you program using the python language, but also makes it very easy to make calls into Microsoft's .NET libraries. The .NET libraries (also called "assemblies") are available to your script, so your script should use them (and not the standard python modules) to do...well, almost everything.

Luckily, there are lots of ways to do what you're trying to do with .NET:

stackoverflow.com/questions/58024/open-a-url-from-windows-forms

The only thing you need to do to use any .NET functions is import the correct assemblies into your script:

ironpython.net/documentation/dotnet/

Hope that helps.
The administrator has disabled public write access.
The following user(s) said Thank You: rockminstrel

Python imports and WEXITSTATUS error 3 years 2 months ago #40301

  • rockminstrel
  • rockminstrel's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 1
  • Karma: 1
Thank you very much. These are great news since I'm much better on C# than Python :laugh:
The administrator has disabled public write access.
Time to create page: 0.165 seconds

Who's Online

We have 224 guests and 4 members online